Browse Source

Add files for Windows and 'nix systems

02_01
Michael Jenkins 4 years ago
parent
commit
6611816982
3 changed files with 104 additions and 2 deletions
  1. +4
    -2
      02_01.md
  2. +50
    -0
      MAC_LINUX_DOCKER.md
  3. +50
    -0
      WINDOWS.md

+ 4
- 2
02_01.md View File

@ -11,13 +11,15 @@ If you are running Jenkins on a Windows system:
```
```
[Follow this link for more details on Windows](WINDOWS.md)
# MacOS, Linux, and Docker
If you are running Jenkins on MacOS, Linux, or Docker:
1. Select the EXECUTE SHELL build step.
1. Select the `Execute shell` build step.
2. Enter the following for the command:
```
echo "Hello, Jenkins"
```
[Follow this link for more details on MacOS, Linux, and Docker](MAC_LINUX_DOCKER.md)

+ 50
- 0
MAC_LINUX_DOCKER.md View File

@ -0,0 +1,50 @@
# Learning Jenkins, 02-01: Your First Jenkins Job
In this lesson you create your first job.
Use the console to create a freestyle job with one build step.
# MacOS, Linux, and Docker
If you are running Jenkins on MacOS, Linux, or Docker:
1. Select the `Execute shell` build step.
2. Enter the following for the command:
```
echo "Hello, Jenkins"
```
# Getting an Error in the First Job
If you select the `Execute Windows batch command` build step, you will see an error similar to the following:
```
Building in workspace /var/jenkins_home/workspace/hello
[hello] $ cmd /c call /tmp/jenkins3248756842772121939.bat
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/workspace/hello"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at hudson.Proc$LocalProc.<init>(Proc.java:253)
at hudson.Proc$LocalProc.<init>(Proc.java:222)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:144)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
at hudson.model.Run.execute(Run.java:1889)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:100)
at hudson.model.Executor.run(Executor.java:433)
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
```
This is because the program Jenkins uses with the `Execute Windows batch command` build step is not available on your system.
To fix this error, use the `Execute shell` build step as described above.

+ 50
- 0
WINDOWS.md View File

@ -0,0 +1,50 @@
# Learning Jenkins, 02-01: Your First Jenkins Job
In this lesson you create your first job.
Use the console to create a freestyle job with one build step.
# WINDOWS SYSTEMS
If you are running Jenkins on a Windows system:
1. Select the `Execute Windows batch command` build step
2. Enter the following for the command:
```
echo "Hello, Jenkins"
```
# Getting an Error in the First Job
If you select the `Execute shell` build step, you will see an error similar to the following:
```
Building in workspace C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\hello-jenkins
[hello-jenkins] $ sh -xe C:\Windows\TEMP\jenkins4677419767712773799.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "sh" (in directory "C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\hello-jenkins"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:253)
at hudson.Proc$LocalProc.<init>(Proc.java:222)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:144)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:92)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:516)
at hudson.model.Run.execute(Run.java:1889)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:100)
at hudson.model.Executor.run(Executor.java:433)
Build step 'Execute shell' marked build as failure
Finished: FAILURE
```
This is because the program Jenkins uses with the `Execute shell` build step is not available on your system.
To fix this error, use the `Execute Windows batch command` as described above.

Loading…
Cancel
Save