diff --git a/02-job-creation.md b/02-job-creation.md index e69de29..fc1ae99 100644 --- a/02-job-creation.md +++ b/02-job-creation.md @@ -0,0 +1,83 @@ +# Key CI/CD/Jenkins Concepts and their Usage + +## Defining, Configuring and Organizing a Job + +1. From the dashboard, click the "New Item" button. +2. Enter the item name "my-freestyle-job" and select "Freestyle project". Press the "OK" button. +3. In the job configuration, define the option to only keep the last 2 builds. Provide the description "A simple freestyle job". Upon building the project, a String parameter named `message` should be provided. Press the "Save" button. +4. Trigger a new build by pressing the "Build with Parameters" button. Enter a value for the `message` parameter. The build should finish successfully. Locate the provided parameter value in the build information. +5. Run the build two more times. What do you see? +6. Create a new view named "test". Add the job to the view. +7. Create a new folder named "freestyle" as part of the view. Move the job into the folder. +8. Locate the build information in `$JENKINS_HOME`. Inspect the directory structure. + +
Show Solution +

+ +We'll start by creating the new freestyle job. + +![New Freestyle Job](./images/02-job-creation/new-freestyle-job.png) + +Configure the job as follows. + +![Job Configuration](./images/02-job-creation/job-configuration.png) + +The build will ask for a parameter value when triggered. + +![Build with Parameters](./images/02-job-creation/build-with-params.png) + +The build history only stores the previous two builds. + +![Build History](./images/02-job-creation/build-history.png) + +Create a new view. + +![New View](./images/02-job-creation/new-view.png) + +After adding the job to the view, it will show up in a separate tab. + +![Job in View](./images/02-job-creation/job-in-view.png) + +Create a new folder. + +![New Folder](./images/02-job-creation/new-folder.png) + +The job became a child of the folder after moving it there. + +![Job In Folder](./images/02-job-creation/job-in-folder.png) + +Navigating to the `job` directory under the Jenkins Home reveals the build history. + +```bash +$ cd /Users/bmuschko/.jenkins/jobs/freestyle/jobs +$ tree my-freestyle-job +my-freestyle-job +├── builds +│   ├── 1 +│   │   ├── build.xml +│   │   ├── changelog.xml +│   │   └── log +│   ├── 2 +│   │   ├── build.xml +│   │   ├── changelog.xml +│   │   └── log +│   ├── 3 +│   │   ├── build.xml +│   │   ├── changelog.xml +│   │   └── log +│   ├── lastFailedBuild -> -1 +│   ├── lastStableBuild -> 3 +│   ├── lastSuccessfulBuild -> 3 +│   ├── lastUnstableBuild -> -1 +│   ├── lastUnsuccessfulBuild -> -1 +│   └── legacyIds +├── config.xml +├── lastStable -> builds/lastStableBuild +├── lastSuccessful -> builds/lastSuccessfulBuild +└── nextBuildNumber + +8 directories, 15 files +``` + +

+
\ No newline at end of file diff --git a/images/02-job-creation/build-history.png b/images/02-job-creation/build-history.png new file mode 100644 index 0000000..1522e25 Binary files /dev/null and b/images/02-job-creation/build-history.png differ diff --git a/images/02-job-creation/build-with-params.png b/images/02-job-creation/build-with-params.png new file mode 100644 index 0000000..53393f9 Binary files /dev/null and b/images/02-job-creation/build-with-params.png differ diff --git a/images/02-job-creation/job-configuration.png b/images/02-job-creation/job-configuration.png new file mode 100644 index 0000000..9a9750d Binary files /dev/null and b/images/02-job-creation/job-configuration.png differ diff --git a/images/02-job-creation/job-in-folder.png b/images/02-job-creation/job-in-folder.png new file mode 100644 index 0000000..4136e97 Binary files /dev/null and b/images/02-job-creation/job-in-folder.png differ diff --git a/images/02-job-creation/job-in-view.png b/images/02-job-creation/job-in-view.png new file mode 100644 index 0000000..a0a3981 Binary files /dev/null and b/images/02-job-creation/job-in-view.png differ diff --git a/images/02-job-creation/move-job.png b/images/02-job-creation/move-job.png new file mode 100644 index 0000000..37b4eca Binary files /dev/null and b/images/02-job-creation/move-job.png differ diff --git a/images/02-job-creation/new-folder.png b/images/02-job-creation/new-folder.png new file mode 100644 index 0000000..9d54bd6 Binary files /dev/null and b/images/02-job-creation/new-folder.png differ diff --git a/images/02-job-creation/new-freestyle-job.png b/images/02-job-creation/new-freestyle-job.png new file mode 100644 index 0000000..46e158c Binary files /dev/null and b/images/02-job-creation/new-freestyle-job.png differ diff --git a/images/02-job-creation/new-view.png b/images/02-job-creation/new-view.png new file mode 100644 index 0000000..b46df4a Binary files /dev/null and b/images/02-job-creation/new-view.png differ