Jenkins Views

Jenkins Views

ยท

2 min read

Task Requirements :

The DevOps team of ABC Industries is planning to create some 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 the 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.

  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 the same as it is mentioned here)

  5. Make sure the job builds successfully.

Execution :

Step 1: Create a Jenkins Job

  • Open your Jenkins UI and log in with the provided credentials.

  • Click on the "New Item" link on the left side.

  • Enter the item name as "nautilus-test-job".

  • Choose "Freestyle project" as the project type.

  • In the configuration page, go to the "Build" section, click on "Add build step," and choose "Execute shell."

  • In the command box, enter the following bash command

    echo "hello world!!"

Step 2: Create a View

  • Go back to the Jenkins dashboard.

  • Click on "New View" on the left side.

  • Enter the view name as "nautilus-crons" and choose "List View".

  • In the "Job Filters" section, select "Builds with certain names" and enter "nautilus-test-job" and "nautilus-cron-job" (if not present already) in the text box.

  • Save the view.

Step 3: Schedule the Job

  • Go back to the Jenkins dashboard.

  • Find your "nautilus-test-job" in the list of jobs.

  • Click on the job, then click on "Configure" in the left sidebar.

  • Scroll down to the "Build Triggers" section and check the "Build periodically" option.

  • Enter the cron expression: * * * * *

  • Save the configuration.

ย