- From the dashboard, click the "New Item" button.
- Enter the item name "my-freestyle-job" and select "Freestyle project". Press the "OK" button.
- 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. - 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. - Run the build two more times. What do you see?
- Create a new view named "test". Add the job to the view.
- Create a new folder named "freestyle" as part of the view. Move the job into the folder.
- Locate the build information in
$JENKINS_HOME
. Inspect the directory structure.
Show Solution
We'll start by creating the new freestyle job.
Configure the job as follows.
The build will ask for a parameter value when triggered.
The build history only stores the previous two builds.
Create a new view.
After adding the job to the view, it will show up in a separate tab.
Create a new folder.
The job became a child of the folder after moving it there.
Navigating to the job
directory under the Jenkins Home reveals the build history.
$ 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