First Jenkins Job
Now that Jenkins is running, let's create your first job. We'll start with a simple freestyle job that prints "Hello Jenkins" and runs a shell command.
Step 1: Create a New Job
1. Click "New Item" on the Jenkins dashboard.
2. Enter a name, e.g., "My-First-Job".
3. Select "Freestyle project" and click OK.
Step 2: Configure the Build Step
Scroll down to the "Build" section. Click "Add build step" and select "Execute shell" (Linux/macOS) or "Execute Windows batch command" (Windows).
In the command box, type:
echo "Hello from Jenkins!"
dateStep 3: Save and Build
Click "Save". On the job page, click "Build Now". You'll see a build appear in the "Build History" section. Click on the build number, then "Console Output" to see the result.
Step 4: Add a Build Trigger (Optional)
To run the job automatically, you can add triggers. For now, go to "Configure", under "Build Triggers", check "Poll SCM" or "Build periodically". For a cron example:
H * * * * (every hour).Step 5: View Build Results
Each build records:
- Console output (logs)
- Build status (success/failure)
- Duration and timestamp
- Artifacts (if any)
Two Minute Drill
- Freestyle jobs are the simplest Jenkins jobs.
- Add build steps like "Execute shell" to run commands.
- Click "Build Now" to run the job.
- View console output to see results.
- Build triggers can automate execution (cron, SCM poll).
Need more clarification?
Drop us an email at career@quipoinfotech.com
