Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 1.3 KB

Jenkins.md

File metadata and controls

22 lines (14 loc) · 1.3 KB

Jenkins

Pass a value from a script to Jenkins build steps (SO)

Can't just set environment variables in script steps because they are lost when the script step ends.

Instead, write them to a properties file, and then inject that into the subsequent step:

mkdir -p target
echo "CONTENT_VERSION=$(src/jenkins/content_version.sh)" > target/jenkins-env.properties

Then specify target/jenkins-env.properties in a Parameters from properties file parameters option.

Use local branch names in Git

From ref and ref, in the Git configuration for a job, add Additional Behaviours -> Check out to specific local branch with a value of ** or empty. This will mean that Git will attempt to give the checked-out branches the same branch name as in the remote repository (instead of having just a commit id).