Jenkins part 5: agents, labels and credentials
Choose which machine a stage runs on with a label, keep a secret in the credentials store, and use it in a step without printing it.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a hotel desk with room types and a key safe. A guest asks for a room type, such as a quiet room. The desk picks a room that has it. Spare keys sit in a safe. The desk hands a key over and does not read the number aloud.
The room type is the . The safe is the credentials store. The quiet handover is the mask in the log.
Leo, a developer at Daily List, a to-do list app, sets the label. Tom needs a browser room for the UI (user interface) job.
What it is: This is a slice of Jenkins, the (CI) server. An agent label is a tag such as browser that a stage can demand. The keeps secrets outside the Jenkinsfile, and the bound secret mask prints four stars in the log. Writing the secret in the file is the neighbour, and it is a mistake. Anyone who can read the project can then read the key.
Why it matters: Browser tests for Daily List fail on a machine with no Chrome. A label sends them to a machine that has it. An (application programming interface) token in the Jenkinsfile is copied into git and into . The store plus the mask lets Mei share a console log without handing out the test token.
PLAIN WORDS · 1 in this section
- handover
- passing a task or duty on to someone else
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB A hotel desk with room types and a key safe.
- Room type
- Safe
- Key
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The room type a guest asks for | The agent label |
| The desk choosing a room | Jenkins picking a machine |
| The key safe behind the desk | The credentials store |
| Handing over a key quietly | The bound secret mask |
WHERE THIS PICTURE STOPS
- A room is picked by a person, but Jenkins picks by label.
- A safe is locked, but the store is read by approved jobs.
- A desk says nothing aloud, but a step can still print a secret.
HOOK
Room type, safe, quiet key.
TELL A FRIEND
A room type, a safe and a quiet key.
OFTEN MIXED UP WITH Jenkins part 4: your first Jenkinsfile pipeline. That topic writes stages and reads the stage view. This one picks the machine for a stage and uses a secret safely.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
Agents, labels and credentials (Jenkins documentation) ↗ — Jenkins · Jenkins docs say the agent directive accepts any, none or a label. Label expressions can join labels with and or or. Credentials are added under Manage Jenkins and Credentials with an ID that cannot be changed later. The credentials helper in the environment directive gives a secret to steps. Jenkins prints four stars in the log. Masking only catches exact matches. On a node with many executors another build may read a secret
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Agents, labels and credentials (Jenkins documentation) ↗ — Jenkins · Jenkins docs on nodes say an agent connects to the controller and runs tasks for it. An executor is a slot for running work. Labels group agents by what they can do. Builds on the controller are discouraged
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Credentials Binding plugin pipeline steps ↗ — Jenkins project · Best-effort masking including shell-mangled forms, encoded leaks and trust boundaries.
Actual primary documentation body read during the complete V30 domain analysis before implementation. Live documentation access-dated; no claim this version is installed in the learner environment. No artwork copied by this content change.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.