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
- Create a Shared Infrastructure Folder
- Add Folder-Scoped Credentials
- Nest a Team A Folder
- Build and Run a Pipeline in Team A
1. Create a Shared Infrastructure Folder
Add a new folder called Shared Infrastructure:
Configure Display Name, Description, health metrics, and custom properties:
Scroll to advanced settings to add Docker labels, registry URLs, pipeline libraries, or Kubernetes cloud support:
After saving, the Shared Infrastructure folder appears on your dashboard:
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:
Select Username with password and enter:
- Username: Shared Database Username
- Password: (demo value)
- ID: shared-db-creds
- Description: Shared DB Credential
After saving, verify the credential under the Shared Infrastructure domain:
Security Reminder
Never print full secret values in logs. Always reference credentials via credentials()
to keep them masked.
Credential Summary
Credential ID | Scope | Description |
---|---|---|
shared-db-creds | Shared Infrastructure | Shared 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:
Inside Team A, add credentials:
- Username: Team A Username
- Password: (demo)
- ID: team-a-creds
- Description: Team A Bricks
Credential ID | Scope | Description |
---|---|---|
team-a-creds | Shared Infrastructure > Team A | Team 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:
After the build, verify the pipeline status on the dashboard:
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