skip to content

Jenkins

2 roadmaps32 questionsupdated

The long-standing, plugin-driven automation server: declarative or scripted Jenkinsfiles, a controller with distributed agents, and a plugin for everything. Still asked constantly because a large share of enterprise pipelines run on it, and maintaining or migrating one is real work.

on this pageshow

guide

overview

~1 min

Jenkins is a self-hosted automation server that runs pipelines described in a `Jenkinsfile` kept beside the code: a controller schedules the work, agents carry it out, and plugins supply nearly everything else. It stays on interview loops because a large share of enterprise delivery still runs on it, and the engineers who inherit those installations must explain why a build behaved as it did, not only how to write one. The hub follows the life of a pipeline. [Pipeline syntax](/topics/cloud-jenkins-pipeline-syntax) covers the two dialects and the Groovy runtime beneath them. [Stages and flow control](/topics/cloud-jenkins-stages-flow) is about ordering, parallel branches, manual gates, retries and how a failure reaches the build result. [Agents and distributed builds](/topics/cloud-jenkins-agents) is where the work physically runs. [Plugins and ecosystem](/topics/cloud-jenkins-plugins) and [credentials and security](/topics/cloud-jenkins-credentials-security) are the operator's side: what the controller loads, and what it is trusted with. [Shared libraries](/topics/cloud-jenkins-shared-libraries) is how an organisation stops copying the same pipeline between repositories. Junior rounds check that you can read a declarative Jenkinsfile and say where each part runs. Senior and principal rounds become debugging and ownership stories: a green build that should have been red, a token that surfaced in a log, a library change that broke every team at once, a controller nobody dares to upgrade. Start with the declarative syntax and the controller/agent split. Flow control makes sense once you know where each stage executes, and security and shared libraries build on both.

primer

### A pipeline is a program with a runtime A Jenkinsfile reads like configuration but is Groovy. **Declarative** syntax wraps it in a fixed schema Jenkins can check before the run starts; **scripted** syntax hands you the language directly. Either way the code runs under an interpreter that checkpoints its state so a build can outlive a controller restart, and, for untrusted code, inside a sandbox that vets each method call. Both explain error messages that look baffling until you know those layers exist. Interviewers expect you to default to declarative and justify each step outside it. ### The controller coordinates, agents execute The controller holds job configuration, build history, credentials and the plugin set; agents supply executors and workspaces. Keeping build code off the controller is a security rule as much as a capacity one. Agents may be long-lived machines or created per build as containers or Kubernetes pods: the ephemeral kind gives up warm caches in exchange for a clean, reproducible environment. **Labels** decide which agent receives which work. ### Workspaces belong to a node By default, nothing on disk travels between agents. A stage that runs elsewhere starts without the previous stage's output, so anything it needs is moved deliberately. Many "file not found" reports are really "different machine" reports. ### Failure is carried by exceptions A failing step throws, its stage fails, later stages are skipped and `post` handlers react. Anything that catches or downgrades that failure changes the outcome quietly, which is how a green build can hide a deploy that never happened. `retry` and `timeout` wrap blocks of steps; they do not make the work inside safe to repeat. ### Plugins are the product, and the risk Source control integration, the pipeline engine itself, credentials handling, container and Kubernetes agents all ship as plugins. They load into the controller with its privileges and release on their own schedules, dragging dependencies and core versions along. Pinning the plugin set and building the controller as an image is how teams keep that under control. ### Jenkins holds the keys Secrets live in one store and are bound into a limited block of steps, with console masking as a convenience rather than a guarantee. Edit rights on a job extend to every secret that job is able to bind, so permissions and folder layout are credential policy. ### Shared code means shared blast radius Shared libraries end copy-paste, but each pipeline inherits every change made to the library version it tracks. How a library is versioned, how much it is trusted, and who may merge into it matter as much as its code.

Jenkinsfile
A file, usually at the repository root, that defines a pipeline in declarative or scripted Groovy syntax, so the pipeline is versioned and reviewed with the code it builds.
Controller
The central Jenkins process: serves the UI and API, schedules builds, and keeps job configuration, history, credentials and plugins in JENKINS_HOME. Older documentation calls it the master.
Agent
A machine, container or pod connected to the controller that provides executors and a workspace for pipeline steps; either permanent or provisioned for one build.
Executor
A slot on a node that runs one piece of pipeline work at a time; a node's executor count caps how much it runs concurrently.
Label
A tag assigned to nodes. A pipeline's label expression restricts which nodes may run its work, routing builds to machines with the right tools or hardware.
Workspace
The directory on a node where a build checks out code and writes output. Each node has its own; nothing is shared between nodes automatically.
Declarative pipeline
Jenkinsfile syntax with a fixed pipeline, agent, stages and steps structure, validated before the run, with directives such as when, post, options and input.
Scripted pipeline
Jenkinsfile syntax built from node blocks and general Groovy control flow: more flexible than declarative, with less checking before the run.
CPS
Continuation-passing style: the transformation Jenkins applies to pipeline Groovy so the program's state can be saved between steps and resumed after a restart.
Script security sandbox
The layer that intercepts method calls made by untrusted pipeline code and permits only signatures on an approved list; administrators can approve more.
withCredentials
The pipeline step that binds a stored credential, by ID, to environment variables for the steps inside its block only, masking the literal value in the console log.
Shared library
A separate repository of reusable pipeline steps and classes, registered in Jenkins and loaded by Jenkinsfiles by name and version.
Configuration as Code
A plugin, often called JCasC, that defines controller configuration in YAML, so a controller can be rebuilt from files instead of settings clicked into the UI.

Follow one commit. The source host notifies the controller through a webhook, or the controller polls. The controller reads the `Jenkinsfile` from that commit, compiles it, loads any shared library it names and queues its work. Each block that needs a machine waits in the queue until a node whose labels match has a free executor; with a cloud plugin configured, a matching agent can be created on demand and discarded afterwards. Steps run on that agent, in its workspace, and stream their output back to the controller, which stores logs and results. The example below is illustrative rather than a template, but it shows most of the hub meeting in one file: ```groovy @Library('[email protected]') _ // versioned shared library pipeline { agent none // no executor held at pipeline level stages { stage('Build') { agent { label 'linux && jdk21' } steps { sh './gradlew build'; stash name: 'app', includes: 'build/libs/*.jar' } } stage('Deploy') { agent { label 'deploy' } // another node, another workspace steps { unstash 'app' withCredentials([string(credentialsId: 'deploy-token', variable: 'TOKEN')]) { sh './deploy.sh' // reads $TOKEN from the environment } } } } post { failure { notifyTeam() } } // a step defined in the library's vars/ } ``` Each line leans on a different section. The first line is shared-library versioning. `agent none` and the per-stage agents are the controller/agent model, and the `stash` exists because the two stages may land on different machines. The credential stays in the controller's store and reaches the process environment for a single block. The `post` handler reacts to the result that flow control computed. Around the file sit the parts a pipeline author rarely sees: the plugin set that makes every one of those steps exist, the authorization rules that decide who can edit the job or the library, and the controller configuration that ideally lives in version control too.

  1. Pipeline Syntax →

    Where every Jenkinsfile starts: the declarative skeleton, how scripted differs, and the Groovy runtime behind both.

  2. Agents & Distributed Builds →

    Where each stage actually runs: controller versus agent, labels, container and pod agents, and workspaces that stay on their node.

  3. Stages & Flow Control →

    Parallel branches, post conditions, manual gates and retries, and how a step failure does or does not become the build result.

  4. Credentials & Security →

    How secrets are stored, scoped and bound, where masking stops helping, and why job permissions amount to credential access.

  5. Shared Libraries →

    Reusing pipeline code across repositories once the single-Jenkinsfile basics are solid, including versioning and trust.

  6. Plugins & Ecosystem →

    The operator's view: what plugins are, why upgrades are coupled, and how to keep a controller's plugin set reproducible.

  • Running build steps on the controller's built-in node because it is convenient; that gives build code a path to JENKINS_HOME and every credential stored there.

  • Treating console masking as secret protection: it hides one exact string, so an encoded, escaped or archived copy of the value still leaks.

  • Interpolating a secret into a double-quoted Groovy string for sh, which puts the value into the command line before masking can see it.

  • Silencing a failing command with returnStatus, catchError or a bare try/catch, then shipping a deploy on top of tests that actually failed.

  • Wrapping a deployment or migration in retry as if it were idempotent; each attempt reruns the whole block from its start.

  • Assuming a later stage on a different agent can see files an earlier stage wrote; move them explicitly with stash or an artifact store.

  • Loading a shared library implicitly from a moving branch, so one merge changes every pipeline at once with no way for a team to pin or roll back.

  • Handing out merge rights on a globally configured library casually; its code runs outside the sandbox, so those rights amount to controller administration.

Interviewers expect you to place Jenkins as well as operate it. Its neighbours are hosted CI systems tied to a source host, such as GitHub Actions and GitLab CI, and Kubernetes-native pipeline engines such as Tekton. The trade-off that separates them is ownership: Jenkins is self-hosted and extended through plugins, which gives full control over where builds run and what they can reach, at the price of running, patching and securing the controller yourself. Hosted systems remove that operational load but tie pipeline definitions to the platform's own format and runners. Jenkins usually sits mid-toolchain: it pulls from Git, builds and tests with the project's own tools, publishes to an artifact repository or registry, and either deploys itself or hands off to a GitOps tool such as Argo CD or Flux. Many teams keep Jenkins for build and test and move deployment to that reconciliation model. Migration is a question in its own right. A convincing answer inventories what the controller actually does — jobs, plugins, credentials, shared libraries, the agents and network access they depend on — before choosing a target, because the plugins and libraries usually hold the logic that does not port directly.

explore

report an issue with this guide →

questions

page 1 of 2

In a declarative Jenkinsfile, what is the difference between `agent any` at the top of the pipeline and `agent none`, and what must each stage do when the top-level directive is `agent none`?

level: juniorimportance: must knowfreq 74%

answer

  1. one directive, two shorthands
  2. who holds the executor, and how long
  3. approval stages should not pin a machine
  4. none means every stage declares its own
  5. fresh workspace, fresh checkout per stage agent

basics

~20 s

agent any lets Jenkins run the whole pipeline on any available executor, allocating one workspace for the entire run. agent none allocates no executor at pipeline level, so every stage must declare its own agent block.

solid answer

~50 s

The top-level `agent` directive in a declarative Jenkinsfile decides where the pipeline body runs. `agent any` tells Jenkins to pick any node with a free executor, allocate a workspace there, check out the SCM automatically, and hold that executor for the whole run — including the time spent waiting on an `input` step. `agent none` allocates nothing at the top level; it is the way you say "different stages run in different places". Under `agent none`, every `stage` must supply its own `agent` (for example `agent { label 'linux' }` or `agent { docker { image 'node:22' } }`), and a stage without one fails the pipeline. Each stage agent gets its own workspace and its own automatic `checkout scm`, so nothing carries over between them implicitly. Steps that need a workspace — `sh`, `readFile`, `archiveArtifacts` — cannot sit at pipeline level under `agent none`, including in a pipeline-level `post` block.

code

groovy · 22 lines
groovy
pipeline {
  agent none
  stages {
    stage('Build') {
      agent { label 'linux' }
      steps {
        sh 'make dist'
        stash name: 'dist', includes: 'dist/**'
      }
    }
    stage('Approve') {
      steps { input message: 'Deploy to production?' }
    }
    stage('Deploy') {
      agent { label 'deploy' }
      steps {
        unstash 'dist'
        sh './deploy.sh dist'
      }
    }
  }
}

go deeper

for a junior

Be able to say that the top-level agent directive is mandatory, that any runs the pipeline on any free executor with an automatic source checkout, and that none requires every stage to declare its own agent.

for a middle

Explain the executor cost: with agent any the node stays reserved through waits and approvals, which is exactly the case agent none plus per-stage agents exists to solve. Mention the implicit checkout scm and skipDefaultCheckout().

for a senior

Show you have debugged it: a pipeline-level post with no node, a deploy stage that cannot see build output because its workspace is fresh, and a fleet starved by pipelines parked on input while holding executors.

for a principal

Frame it as capacity and blast radius. Decide a house convention for approval-bearing pipelines, cap how long an executor may be held, and be ready to justify per-stage agents against the extra scheduling latency and workspace churn they create.

## What the agent directive actually decides In declarative Jenkins pipelines the `agent` directive answers one question: on which machine, and in which workspace, does this block of the pipeline execute? Jenkins has a controller that orchestrates and a set of agents that execute; the `agent` directive is how a Jenkinsfile expresses which of those agents it wants. It is mandatory at the top level of a `pipeline { }` block — you must write something, even if that something is "nothing". ## agent any ```groovy pipeline { agent any stages { stage('Build') { steps { sh 'make' } } } } ``` `agent any` means: take any node that has a free executor and no restriction preventing this job from running there. Jenkins then does three things before the first stage runs. It reserves an executor, it creates (or reuses) a workspace directory on that node, and it performs an implicit `checkout scm` so the repository the Jenkinsfile came from is present. That implicit checkout is easy to forget, and you can turn it off with `options { skipDefaultCheckout() }`. The important consequence is duration. The executor is held for the *entire* pipeline, not just the parts doing work. If a stage sits on an `input` step waiting for a human to click Deploy, the executor and the workspace stay reserved the whole time. On a small fleet, a handful of pipelines parked on approvals can starve every other job. ## agent none ```groovy pipeline { agent none stages { stage('Build') { agent { label 'linux' } steps { sh 'make' } } stage('Approve'){ steps { input message: 'Ship it?' } } stage('Deploy') { agent { label 'deploy' } steps { sh './deploy.sh' } } } } ``` `agent none` allocates nothing at pipeline level. Each stage that needs to run commands declares its own agent, and stages that need no workspace — an `input` gate, a `milestone`, a notification built from `currentBuild` metadata — hold no executor at all. This is the standard shape for any pipeline with a human approval in the middle, and the standard shape for pipelines that build on one platform and deploy from another. The rules that follow from it are strict: - A stage with steps but no `agent` fails validation at run time. (`stage` blocks that only contain `parallel` or `stages` are the exception — the nested blocks carry the agents.) - Each stage agent gets a **fresh workspace** and its own implicit `checkout scm`. Build outputs from the previous stage are not there, because they were never in source control. Moving files between stages needs `stash`/`unstash` or an artifact repository. - Pipeline-level `post` blocks execute without a node. `post { always { sh 'cleanup.sh' } }` will fail under `agent none` because `sh` requires a workspace. Wrap it in a `node('label') { }` block, or put the `post` inside a stage that has an agent. ## Stage-level agents also work under a top-level agent A stage may declare its own `agent` even when the pipeline has one. Jenkins then allocates a second executor for that stage, on top of the one the pipeline already holds. That is occasionally what you want (a stage that must run on Windows in an otherwise Linux pipeline), but it doubles the executor cost, which is why `agent none` plus per-stage agents is the cleaner pattern when *every* stage has its own home. ## Other forms the directive takes `agent any` and `agent none` are the two built-in shorthands. The others name a target explicitly: `agent { label 'expr' }` for label routing, `agent { node { label 'x'; customWorkspace '/build/x' } }` when you need to control the workspace path, `agent { docker { image '...' } }` to run inside a container, `agent { dockerfile true }` to build that container from a Dockerfile in the repository, and `agent { kubernetes { ... } }` to get a pod per build. ## What interviewers are checking The short answer — "any means anywhere, none means nowhere" — is table stakes. What separates candidates is the follow-through: knowing that an executor is held across an `input`, knowing that each stage agent brings a fresh checkout and an empty workspace, and knowing that a pipeline-level `post` under `agent none` has no place to run a shell command.

  • Why does a pipeline-level post block often fail under agent none, and how do you fix it?
    A pipeline-level `post` block runs outside any stage, so under `agent none` there is no node and no workspace. Steps like `sh`, `junit` or `archiveArtifacts` fail immediately. Either wrap the body in a `node('label') { ... }` block so it allocates its own executor, or move the `post` block inside a stage that already has an agent.
  • What does options { skipDefaultCheckout() } change, and when would you want it?
    It suppresses the implicit `checkout scm` that Jenkins performs when it allocates an agent. You want it when a stage does not need the source at all — a deploy stage that only consumes a stashed artifact, for example — or when you need to control the checkout yourself with an explicit `checkout` step and custom refspec, depth or submodule options.
  • If a pipeline already declares a top-level agent, what happens when a single stage declares its own?
    Jenkins allocates an additional executor and workspace for that stage while still holding the pipeline-level one. The stage runs on its own node, and its workspace is separate. It is legitimate for a one-off platform requirement, but paying for two executors for the length of a stage is why `agent none` with per-stage agents is preferred when most stages need distinct machines.

saying these in an interview costs you the question

  • Thinking agent none makes the pipeline run on the controller
  • Assuming stage workspaces are shared because it is one pipeline
  • Believing an input step releases the executor under agent any
  • Saying agent any picks the least loaded agent by CPU
  • Forgetting that each stage agent re-runs checkout scm

context

open as a page

In a Jenkins Pipeline, what does the withCredentials step do, and how should a bound secret be referenced inside a sh step?

level: juniorimportance: must knowfreq 72%

basics

~20 s

withCredentials fetches a stored credential by its ID and exposes it as an environment variable only inside its block, masking the value in the console log. Inside sh, reference it with single quotes so Groovy never interpolates the secret.

open as a page

In a Jenkins declarative Jenkinsfile, which blocks are mandatory, and where do the actual build commands go?

level: juniorimportance: must knowfreq 78%

basics

~20 s

A declarative Jenkinsfile is one pipeline block that must contain an agent directive and a stages block. Inside stages, every stage needs a name and a steps block, and the actual commands live in steps. Everything else is optional.

open as a page

In Jenkins, what is a plugin, and what does the Plugin Manager actually do when you install one?

level: juniorimportance: must knowfreq 70%

basics

~20 s

A Jenkins plugin is a packaged extension (.hpi/.jpi) supplying almost everything Jenkins does beyond scheduling builds. The Plugin Manager downloads it plus its declared dependencies into JENKINS_HOME/plugins and loads it, in many cases only after a restart.

open as a page

In a Jenkinsfile, what does the line `@Library('[email protected]') _` do, and why is there a bare underscore after it?

level: juniorimportance: must knowfreq 62%

basics

~20 s

It loads the Jenkins shared library registered as utils at version v1.4 — a branch, tag or commit in the library's repository — so the library's steps become callable in that Jenkinsfile. The underscore is a throwaway statement the annotation must attach to.

open as a page

In Jenkins, what does the controller do compared with an agent, and why is running build steps on the built-in node treated as an anti-pattern?

level: middleimportance: must knowfreq 68%

basics

~20 s

The Jenkins controller schedules builds, serves the UI and owns JENKINS_HOME with all job config and credentials; agents execute the steps. Building on the controller gives arbitrary build code read access to that home directory, so its executors are set to zero.

open as a page

What is the difference between Jenkins declarative and scripted pipeline syntax, and what do you give up by choosing scripted?

level: middleimportance: must knowfreq 80%

basics

~20 s

Declarative wraps the build in a fixed pipeline/agent/stages/steps schema that Jenkins validates before running; scripted is a node block of ordinary-looking Groovy with real control flow. Scripted trades away up-front validation, the when directive and restart-from-stage for programmability.

open as a page

In a Jenkins shared library repository, what do the vars/, src/ and resources/ directories each hold, and how does a Jenkinsfile reach each one?

level: middleimportance: must knowfreq 70%

basics

~20 s

vars/ holds one file per callable pipeline step, named after the step. src/ holds a normal Groovy class hierarchy on the pipeline classpath, imported by package and class name. resources/ holds non-Groovy files read with the libraryResource step.

open as a page

In a Jenkins Declarative Pipeline, when do a stage's post conditions always, success, failure and unstable each run, and which condition runs last?

level: middleimportance: must knowfreq 68%

basics

~20 s

A stage's post block runs after its steps finish, however they finished. always runs every time; success, failure and unstable run only when the stage ended with that result; cleanup runs last, after every other condition has been evaluated.

open as a page

A Jenkins pipeline's test stage reports success and the deploy stage runs, even though the test command failed. How does a step failure normally become the build result, and what breaks that chain?

level: seniorimportance: must knowfreq 52%

basics

~20 s

In Jenkins a step signals failure by throwing: sh throws on a non-zero exit, the stage becomes FAILURE and the build FAILED, and later stages are skipped. Anything that swallows the exception — returnStatus, catchError, a bare try/catch — leaves the build green.

open as a page

In a Jenkins Declarative Pipeline, what does a stage's parallel block do, and what can that stage no longer contain?

level: juniorimportance: should knowfreq 60%

basics

~20 s

A parallel block runs several nested stages at the same time, each able to pick its own agent. A stage that uses parallel can no longer have its own steps block or its own stages block — parallel replaces them.

open as a page

How do agent labels route a Jenkins build to the right machine, and what happens to a build whose `agent { label 'gpu && linux' }` expression matches no online agent?

level: middleimportance: should knowfreq 58%

basics

~20 s

Labels are tags assigned to Jenkins nodes; a pipeline's label expression, which supports && || ! and parentheses, selects nodes that satisfy it. If none matches, the build sits in the queue indefinitely rather than failing.

open as a page

In Jenkins, what do the credential scopes System, Global and User control, and why can a job report "Could not find credentials entry with ID" for an ID an administrator can plainly see?

level: middleimportance: should knowfreq 45%

basics

~20 s

Scope decides who may use a Jenkins credential: System means the controller itself only (agent launches, cloud configuration) and is invisible to jobs; Global means the storing object and its children; User means one person's private store. A System-scoped entry produces the "not found" error in a build.

open as a page

In a Jenkins declarative pipeline, what does a stage's when directive do, and what does beforeAgent true change?

level: middleimportance: should knowfreq 55%

basics

~20 s

A stage's when directive decides at runtime whether that stage executes; a false condition marks the stage skipped without failing the build. By default the condition is checked after the stage's agent is allocated, and beforeAgent true evaluates it first instead.

open as a page

Why can upgrading Jenkins plugins be risky, and what does the LTS release line have to do with it?

level: middleimportance: should knowfreq 55%

basics

~20 s

Plugins and Jenkins core release on separate schedules, and each plugin declares a minimum core version. Upgrading one plugin can pull its dependencies, the core, and even the JVM forward — so upgrades are coupled, never isolated.

open as a page

What changes for Jenkins pipelines when a shared library is configured to load implicitly, and what can an individual Jenkinsfile still control about it?

level: middleimportance: should knowfreq 42%

basics

~20 s

Implicit loading makes the library available to every pipeline in its scope with no @Library line, always at the library's configured default version. A Jenkinsfile can still name a different version — but only if the configuration permits overriding the default.

open as a page

Using the Jenkins Kubernetes plugin, how is a build executed, and in a pod template that defines a maven container alongside the default agent container, what decides which container an `sh` step runs in?

level: seniorimportance: should knowfreq 46%

basics

~20 s

The plugin creates one pod per build from a pod template; its inbound agent container connects back to the controller and the workspace lives on a volume shared by all containers. Steps run in the agent container unless wrapped in container('maven') or covered by defaultContainer.

open as a page

A Jenkins pipeline builds target/app.jar in one stage, and a later stage that declares a different agent cannot find the file. Why, and how do you get the artifact onto the second agent?

level: seniorimportance: should knowfreq 52%

basics

~20 s

Each Jenkins node has its own workspace directory and nothing is shared between them, so the second agent starts from a fresh checkout with no build output. Move the file explicitly with stash/unstash, archived artifacts, or an artifact repository.

open as a page

On a Jenkins controller where every developer has permission to configure any job, why is that effectively the same as handing out every credential, and how do you restrict it?

level: seniorimportance: should knowfreq 48%

basics

~20 s

Anyone who can change what a job runs can bind any credential that job's context can see and send the value anywhere, so job-configure permission equals credential access. Restrict it with matrix or role-based authorization, per-team folders holding their own credentials, and pipelines defined in reviewed source control.

open as a page

A Jenkins build printed a usable API token into its console log even though the value was bound with withCredentials and Jenkins masks credentials. How does that happen, and what do you do about it?

level: seniorimportance: should knowfreq 50%

basics

~20 s

Jenkins masks only exact literal occurrences of the bound value in the console log. Any transformation — base64, URL-encoding, JSON escaping, splitting across lines — passes through unmasked, and masking never covers archived files or process listings. Rotate the credential first, then fix the pipeline.

open as a page

Why can a Jenkins Pipeline script fail with java.io.NotSerializableException, and what does @NonCPS change about a method?

level: seniorimportance: should knowfreq 42%

basics

~20 s

A Jenkinsfile runs under a continuation-passing-style interpreter that saves the program's state, including local variables, at every step so a build can survive a controller restart. Holding a non-serializable object across a step call breaks that save. @NonCPS runs a method as plain Groovy, outside the transform.

open as a page

How would you make a Jenkins controller's plugin set reproducible instead of installing plugins by clicking in the Plugin Manager?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Describe the plugin set as a pinned list in a file, install it at image-build time with jenkins-plugin-cli, and keep controller configuration in Configuration as Code YAML. Upgrades become a reviewed diff; rollback is redeploying the previous image.

open as a page

In Jenkins, how much trust does an installed plugin actually get, and how do you handle a security advisory against one you depend on?

level: seniorimportance: should knowfreq 38%

basics

~20 s

A Jenkins plugin runs inside the controller JVM with the controller's full privileges — every stored credential, all of JENKINS_HOME, the network. There is no per-plugin sandbox, so trusting a plugin means trusting it with the whole controller.

open as a page

In Jenkins, how does a shared library configured globally differ in trust from one configured on a folder, and what does that mean for who may merge to the library repository?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Globally configured Jenkins shared libraries are trusted: their Groovy runs outside the script sandbox with full access to Jenkins internals. Folder-scoped libraries are untrusted and run sandboxed. So merge rights on a trusted library repository are effectively administrator rights on the controller.

open as a page

Forty Jenkins pipelines load a shared library implicitly at its default version, the branch main. A merge to main breaks all forty builds at once. How would you change the setup?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Stop using a moving branch as the default version. Pin the default to an immutable tag, make sure Jenkinsfiles are allowed to override it so individual repos can canary or roll back, and treat library changes as releases with tests rather than as merges.

open as a page

A Jenkins pipeline stage waiting on a manual approval has held a build agent and its workspace for two days. Why is that happening, and how do you gate the deploy without pinning the executor?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Because the input step sits inside the stage's steps, it blocks while the surrounding agent's executor and workspace stay allocated. Use the stage-level input directive instead — it pauses before the agent is allocated — and bound the wait with a timeout.

open as a page

In a declarative Jenkinsfile, what does `agent { docker { image 'maven:3.9-eclipse-temurin-17' } }` actually do, and why do steps inside it often fail writing to the home directory?

level: middleimportance: nice to knowfreq 40%

basics

~20 s

Jenkins picks a node with a working Docker daemon, starts that image as a long-running container with the workspace bind-mounted, and runs each step inside it as the agent's own user id. That uid usually has no passwd entry in the image, so its home directory is not writable.

open as a page

A script that POSTs to a Jenkins controller's REST API is rejected with HTTP 403 and "No valid crumb was included in the request". What is Jenkins' crumb, and how should the script satisfy it?

level: middleimportance: nice to knowfreq 38%

basics

~20 s

The crumb is Jenkins' CSRF token: state-changing requests must carry a value fetched from the controller's crumb issuer, sent in a request header on the same session. Scripts should either fetch the crumb per session or authenticate with a user API token, which is exempt in current Jenkins versions.

open as a page

In a Jenkins Pipeline, what exactly does wrapping steps in retry(3) re-run, and why is that dangerous around a deployment step?

level: middleimportance: nice to knowfreq 32%

basics

~20 s

retry(3) re-executes the entire enclosed block from the top when it fails, for up to three attempts in total. Nothing is undone between attempts, so any non-idempotent work inside — a partial upload, an applied migration — is simply done again.

open as a page

A Jenkins Pipeline build fails with "Scripts not permitted to use method ...". What produced that message, and what are the ways to resolve it?

level: seniorimportance: nice to knowfreq 32%

basics

~20 s

The Groovy sandbox produced it. Jenkins runs pipeline scripts with every method call intercepted and checked against an approved list, and rejected the exact signature named in the message. Resolve it by rewriting to approved APIs or by having an administrator approve that signature.

open as a page

showing 1–30 of 32