DEV Community

Janak Shrestha
Janak Shrestha

Posted on

Jenkins Views

The DevOps team of xFusionCorp Industries is planning to create a number of Jenkins jobs for different tasks. So to easily manage the jobs within Jenkins UI they decided to create different views for all Jenkins jobs based on usage/nature of these jobs, - for example nautilus-crons view for all cron jobs. Based on the requirements shared below please perform the below mentioned task:

Click on the Jenkins button on the top bar to access the Jenkins UI. Login using username admin and password Adm!n321.

  1. Create a Jenkins job named nautilus-test-job.
  2. Configure this job to run a simple bash command i.e echo "hello world!!".
  3. Create a view named nautilus-crons (it must be a global view of type List View) and make sure nautilus-test-job and nautilus-cron-job (which is already present on Jenkins) jobs are listed under this new view.
  4. Schedule this newly created job to build periodically at every minute i.e * * * * * (please make sure to use the cron expression exactly same how it is mentioned here).
  5. Make sure the job builds successfully.

Note:

  1. You might need to install some plugins and restart Jenkins service. So, we recommend clicking on Restart Jenkins when installation is complete and no jobs are running on plugin installation/update page i.e update centre. Also, Jenkins UI sometimes gets stuck when Jenkins service restarts in the back end. In this case please make sure to refresh the UI page.
  2. For these kind of scenarios requiring changes to be done in a web UI, please take screenshots so that you can share it with us for review in case your task is marked incomplete. You may also consider using a screen recording software such as loom.com to record and share your work.

Step 1: Access the Jenkins UI

Click the Jenkins button on the top bar of your KodeKloud lab environment. This opens the Jenkins UI in a new tab.

Log in with:

  • Username: admin
  • Password: Adm!n321

Once logged in, you'll land on the Jenkins dashboard. Take a moment to note the existing jobs and the "All" view tab at the top.


Step 2: Create the nautilus-test-job

From the dashboard:

  1. Click New Item in the left sidebar
  2. In the Enter an item name field, type: nautilus-test-job
  3. Select Freestyle project
  4. Click OK

You'll be taken to the job configuration page.


Step 3: Configure the Build Command

Scroll down to the Build section:

  1. Click Add build step
  2. Select Execute shell
  3. In the Command text area, type exactly:
echo "hello world!!"
Enter fullscreen mode Exit fullscreen mode

Tip: Use double quotes exactly as shown. Using single quotes may cause inconsistent behavior during evaluation.


Step 4: Schedule the Job (Every Minute)

Still on the job configuration page, scroll up to the Build Triggers section:

  1. Check the box: Build periodically
  2. In the Schedule text field, enter exactly:
* * * * *
Enter fullscreen mode Exit fullscreen mode

Understanding the Cron Expression

Field Value Meaning
Minute * Every minute
Hour * Every hour
Day of Month * Every day of the month
Month * Every month
Day of Week * Every day of the week

This means Jenkins will trigger the job once per minute, continuously.

⚠️ Important: The expression must be exactly * * * * * with single spaces between each asterisk. Any extra spaces or characters will cause the schedule to fail validation or behave incorrectly.


Step 5: Save and Trigger a Manual Build

  1. Click Save at the bottom of the page
  2. You'll be redirected to the job page
  3. Click Build Now in the left sidebar
  4. Watch the Build History box on the left — a blue ball will appear

Verify the Build Output

Click on the build number (e.g., #1) → Console Output. You should see:

Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/nautilus-test-job
[nautilus-test-job] $ /bin/sh -xe /tmp/jenkins...sh
+ echo 'hello world!!'
hello world!!
Finished: SUCCESS
Enter fullscreen mode Exit fullscreen mode

If you see hello world!! and Finished: SUCCESS, the job is working.


Step 6: Create the nautilus-crons List View

Image

Now let's organize our jobs. From the Jenkins dashboard:

  1. Look at the top-left area, next to the All tab
  2. Click the small + button — this is the New View button

Note: The "+" button is easy to miss because it's small and unlabeled. It's located right next to the "All" tab. If you can't find it, you can also navigate directly to <jenkins-url>/newView.

On the New View page:

  1. Name: nautilus-crons
  2. Type: Select List View (radio button)
    • ❌ Do NOT select "My View" — this creates a personal view, not a global one
  3. Click Create

Step 7: Add Jobs to the View

Image

On the view configuration page:

  1. Under Job Filters, make sure All is selected
  2. Scroll down to the Jobs section
  3. Check the boxes next to:
    • ☑️ nautilus-cron-job (existing job)
    • ☑️ nautilus-test-job (newly created)
  4. Optionally customize columns (Last Success, Last Failure, Last Duration are useful)
  5. Click Save

Step 8: Verify the View

After saving, you'll be redirected to the nautilus-crons view. Confirm:

  • ✅ A new tab named nautilus-crons appears next to All
  • ✅ Both jobs are listed:
    • nautilus-cron-job
    • nautilus-test-job

Step 9: Confirm Automated Builds Are Working

Wait 1–2 minutes, then check nautilus-test-job again.

You should see:

  • ✅ Build History growing (#1, #2, #3, ...)
  • ✅ Each new build shows "Started by timer" in the console output
  • ✅ Last Success column shows a recent timestamp
  • ✅ A green checkmark next to the job name

This confirms the cron schedule is working correctly.

Sample Console Output from an Automated Build

Started by timer
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/nautilus-test-job
[nautilus-test-job] $ /bin/sh -xe /tmp/jenkins...sh
+ echo 'hello world!!'
hello world!!
Finished: SUCCESS
Enter fullscreen mode Exit fullscreen mode

The key indicator here is "Started by timer" — that's proof Jenkins is triggering the job based on the cron schedule, not manual clicks.


Top comments (0)