This file contains 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
#!/usr/bin/env groovy | |
stage('build') { | |
node('java8') { | |
// this is a comment | |
} | |
} | |
stage('test') { | |
node('testing') { | |
// this is where testing code goes | |
} |
This file contains 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
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.' | |
} | |
} |
This file contains 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
stage('build') { | |
node('java8') { | |
sh 'mvn clean deploy -U' | |
} | |
} |
This file contains 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
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' | |
} | |
} |
This file contains 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
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 |