Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Steps · Jenkins

Direct answer

Steps are individual actions inside a Jenkins stage, such as sh, bat, git, junit or archiveArtifacts, provided by Jenkins core and plugins.

When to use this

Use this when using steps in Jenkins stages.

First 30 seconds

1. Steps are actions (sh, checkout, archiveArtifacts).

2. Fail on errors.

3. withCredentials for secrets.

4. timeout/retry wrappers.

5. Avoid string interpolation of secrets in Groovy (use single quotes).

Operational verification

step → action → result

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Jenkins controller/agent and Pipeline automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformJenkins controller/agent and Pipeline automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when using steps in Jenkins stages.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as controller/agent drift, plugin behavior changes, workspace contamination, credential leakage, retrying non-idempotent stages and green Pipeline status masking bad external state, choosing the cases most relevant to step action/shell/uses identity, inputs/env, condition, outputs and conclusion, plus correlation to the external side effect made by the step.

Step 2 Common mistakes Narrow the fault
  • sh steps that ignore exit codes.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Steps include sh, bat, git, junit, archiveArtifacts.
  • They come from core and plugins.
  • A non-zero exit fails the step.
Key checks
  • sh/bat/powershell steps with error handling — commands
  • withCredentials blocks — secrets
  • Step timeouts/retry — resilience
ReferenceWhy it matters1 section · depth on demand

In depth

Steps are the individual commands inside a stage: run a shell command, check out code, archive files, call a plugin. They are where the actual work happens, and each step's result decides whether the stage continues.

StepUse
sh / bat / powershellRun commands
checkout scmGet the source
withCredentialsExpose secrets to a block
archiveArtifactsKeep build outputs
junitPublish test results
retry(3) { } / timeout(5) { }Wrap flaky or slow steps
inputManual approval

sh fails the build on a non-zero exit code; use returnStatus: true or returnStdout: true only when you deliberately want to handle the result yourself.

def rc = sh(script: './check.sh', returnStatus: true)
if (rc == 2) { unstable('warnings found') }
ReferenceImportant terms & boundaries1 section · depth on demand
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docJenkins controller/agent and Pipeline automation current

Authoritative/upstream documentation reviewed for bounded claims in Jenkins > Steps. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.jenkins.io/doc/ · confidence 94%
Confirmation

Confirm action

Continue?