Certified Jenkins Engineer

Jenkins Administration and Monitoring Part 1

Demo Jenkins Folder Part 1

In this tutorial, you’ll learn how to isolate jobs, credentials, and configurations in Jenkins using folders. Folders create independent namespaces so that:

  • Identically named jobs (e.g., build) don’t collide
  • Credentials and properties are scoped per folder
  • Pipelines access only the libraries, credentials, and cloud profiles in their folder tree

This guide is Part 1 of 4 in our Jenkins Folders series.

Table of Contents

  1. Create a Shared Infrastructure Folder
  2. Add Folder-Scoped Credentials
  3. Nest a Team A Folder
  4. Build and Run a Pipeline in Team A

1. Create a Shared Infrastructure Folder

Add a new folder called Shared Infrastructure:

The image shows a Jenkins interface where a user is creating a new item named "shared-infrastructure" and selecting an item type from options like Freestyle project, Pipeline, Multi-configuration project, and Folder.

Configure Display Name, Description, health metrics, and custom properties:

The image shows a Jenkins configuration page with options for setting a display name, description, health metrics, and properties. The interface is dark-themed and includes buttons for saving and applying changes.

Scroll to advanced settings to add Docker labels, registry URLs, pipeline libraries, or Kubernetes cloud support:

The image shows a configuration page for a shared infrastructure, featuring fields for Docker label, Docker registry URL, registry credentials, and options for adding pipeline libraries and Kubernetes support. There are buttons for saving and applying changes.

After saving, the Shared Infrastructure folder appears on your dashboard:

The image shows a Jenkins dashboard for a folder named "shared-infrastructure," which is currently empty. There are options on the left for configuring and managing items within Jenkins.

Tip

Use clear, consistent folder names (e.g., shared-infrastructure) to help teams find shared resources quickly.


2. Add Folder-Scoped Credentials

Inside Shared Infrastructure, go to Credentials and click Add Credentials:

The image shows a Jenkins interface displaying a list of credentials, including IDs and names for various services like MongoDB, DockerHub, and AWS.

Select Username with password and enter:

  • Username: Shared Database Username
  • Password: (demo value)
  • ID: shared-db-creds
  • Description: Shared DB Credential

The image shows a Jenkins interface where new credentials are being added, including fields for username, password, ID, and description.

After saving, verify the credential under the Shared Infrastructure domain:

The image shows a Jenkins interface displaying global credentials, specifically a shared database credential with a username and password.

Security Reminder

Never print full secret values in logs. Always reference credentials via credentials() to keep them masked.

Credential Summary

Credential IDScopeDescription
shared-db-credsShared InfrastructureShared DB Credential

3. Nest a Team A Folder

Under Shared Infrastructure, create a subfolder named Team A. It inherits parent settings but allows its own additions:

The image shows a web interface displaying a list of credentials and their associated domains, likely from a shared infrastructure management system. It includes sections for "Stores scoped to shared-infrastructure » team-a" and "Stores from parent."

Inside Team A, add credentials:

  • Username: Team A Username
  • Password: (demo)
  • ID: team-a-creds
  • Description: Team A Bricks

The image shows a Jenkins interface displaying global credentials, specifically a username with a password for "team-a-creds."

Credential IDScopeDescription
team-a-credsShared Infrastructure > Team ATeam A Bricks

4. Build and Run a Pipeline in Team A

Still within Team A, create a Pipeline named Team A Pipeline. Use this Jenkinsfile to demonstrate folder-scoped credential access:

pipeline {
    agent any
    environment {
        SHARED_DB_CREDS = credentials('shared-db-creds')
        TEAM_A_CREDS    = credentials('team-a-creds')
    }
    stages {
        stage('Accessing Credentials') {
            steps {
                script {
                    echo "Shared DB Username: ${SHARED_DB_CREDS_USR}"
                    echo "Team A Username: ${TEAM_A_CREDS_USR}"
                }
            }
        }
    }
}

Save and run the pipeline. In Blue Ocean or the classic UI, you’ll see both usernames echoed:

The image shows a Jenkins pipeline interface displaying a successful build process, with credentials being accessed and verified.

After the build, verify the pipeline status on the dashboard:

The image shows a Jenkins dashboard displaying the status of a pipeline named "team-A-pipeline," with stages marked as completed. The interface includes options for configuring, building, and managing the pipeline.


Next Steps

In Part 2, we’ll explore folder-level pipeline libraries and cloud agents for advanced CI/CD workflows.


References

Watch Video

Watch video content

Previous
Demo Lambda Invoke Function