Skip to content

Instantly share code, notes, and snippets.

View evagonz's full-sized avatar

Eva Gonciarczyk evagonz

  • Chicago, IL
View GitHub Profile
stage('deploy') {
node('aws') {
// this is going to be a multi-line 'sh'
sh """
new_stack = "my-aws-cloudformation-stack-name"
aws cloudformation create-stack \
--region us-east-3 \
--capabilities CAPABILITY_IAM \
--stack-name $new_stack
--template-body file://path-to-file-for-stack-template
stage('get code') {
node('jenkins-worker') {
// just by specifying your git credentials and repo, the pipeline knows to check it out and run the next steps from that repo
git credentialsId: '$key', url: 'git@github.com:$usr/$repo.git', branch: "${env.BRANCH_NAME}"
// this is a script in the root of the $repo.git repository
sh './run-me.sh'
}
}
node('centos') {
stage('step 1') {
echo 'This is the first stage.'
}
stage('step 2') {
echo 'This is stage 2, running on the same node as stage 1. By having both stage blocks *inside* the node block, the pipeline runs much quicker.'
}
}
#!/usr/bin/env groovy
stage('build') {
node('java8') {
// this is a comment
}
}
stage('test') {
node('testing') {
// this is where testing code goes
}