Last active
February 5, 2019 23:53
-
-
Save simonmcc/29071aade32012f186ed8273ff1442ed to your computer and use it in GitHub Desktop.
Running a Jenkins post stage in a docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent none | |
stages { | |
stage('Step1'){ | |
agent { docker { image 'simonmcc/hashicorp-pipeline:latest' } } | |
steps { | |
echo "Hello from Step1" | |
} | |
} | |
stage('Stage2') { | |
steps { | |
script { | |
echo "this is a scripted fragment" | |
docker.image("simonmcc/hashicorp-pipeline:latest").inside { | |
sh 'ls' | |
} | |
} | |
} | |
} | |
} | |
post { | |
always { | |
echo "post-always" | |
script { | |
echo "this is a scripted fragment" | |
docker.image("simonmcc/hashicorp-pipeline:latest").inside { | |
sh 'ls' | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment