In this session we are going to create and launch our first project with jenkins. We will be using a free style project for this example.
With Jenkins you could create following kind of projects or jobs.
- Free Style
- Maven
- External Job
- Multi Configuration
A typical style jenkins jobs has the following sections.
- Name/description
- Advanced Option
- Source Code Management
- Build Triggers
- Pre Build
- Build
- Post Build
Lets now create a simple job using jenkins to run a hello world program.
- From Jenkins Main page, click on New Item.
- Provide a name to the project in Item Name i.e. "job1". Check against Free Style Project.
Next screen opens the job configuration page. On the job configuration page,
-
Add job description. e.g., "Our first Jenkins Job".
-
Skip Source Code Management and Build Triggers, and scroll down to Build configurations.
-
From "Add Build Step" select Execute Shell and provide commands to execute. Since this is a mock job, you could provide following sample code,
#!/bin/bash
echo "Hello World!"
sleep 10
Review and click on save to go to project page.
Click on Build Now to launch a build. Once the build is started, you would see the status in the Build History section.
Once build is finished, click on the build number which starts with # . Clicking on the build number e.g. #1 will take you to the page which shows the build stats. Option of interest on this page might be Console Status which shows the run time output.