Skip to content

Instantly share code, notes, and snippets.

@ifiok
Forked from robertstettner/Jenkinsfile
Created April 6, 2019 22:49
Show Gist options
  • Save ifiok/b59127856d52f8bb3563014d61e908d9 to your computer and use it in GitHub Desktop.
Save ifiok/b59127856d52f8bb3563014d61e908d9 to your computer and use it in GitHub Desktop.
Example Jenkinsfile
pipeline {
stages {
stage("install") {
agent {
docker {
reuseNode true
image 'node:6.10'
}
}
steps {
sh 'npm install'
}
}
stage("test") {
agent {
docker {
reuseNode true
image 'node:6.10'
}
}
steps {
sh 'npm test'
}
}
stage("deploy") {
when {
branch "master"
}
agent {
docker {
reuseNode true
image 'hashicorp/terraform'
args '--entrypoint=""'
}
}
steps {
sh '''
cd ./terraform
terraform apply -auto-approve
'''
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment