Skip to content

Instantly share code, notes, and snippets.

@ssbostan
Created August 1, 2021 10:25
Show Gist options
  • Save ssbostan/275ae72ab5078a8e6e6f0b90895d324d to your computer and use it in GitHub Desktop.
Save ssbostan/275ae72ab5078a8e6e6f0b90895d324d to your computer and use it in GitHub Desktop.
Jenkins pipeline syntax reference
pipeline {
agent any
environment {
SAMPLE_GLOBAL_ENV_VAR = "Test global ENV variables."
}
stages {
stage("Build") {
environment {
SAMPLE_STAGE_ENV_VAR = "Test stage ENV variables."
}
steps {
echo "Build stage."
echo "$SAMPLE_GLOBAL_ENV_VAR"
echo "$SAMPLE_STAGE_ENV_VAR"
}
}
stage("Test") {
steps {
echo "Test stage."
echo "$env.SAMPLE_GLOBAL_ENV_VAR"
}
}
stage("Release") {
steps {
echo "Release stage."
echo "${SAMPLE_GLOBAL_ENV_VAR}"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment