Skip to content

Instantly share code, notes, and snippets.

@ericlong
Created August 29, 2017 20:26
Show Gist options
  • Save ericlong/25fd60f197f6c4c7b8f265af7a351e75 to your computer and use it in GitHub Desktop.
Save ericlong/25fd60f197f6c4c7b8f265af7a351e75 to your computer and use it in GitHub Desktop.
Let's Build a Jenkins Pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Hello from Build'
}
}
stage('Test') {
steps {
echo 'Testing Testing 123'
}
}
stage('Deploy') {
steps {
echo 'Deploy some things'
}
}
}
}
pipeline {
agent {
label 'docker'
}
stages {
stage('Build') {
steps {
echo 'Hello from Build'
}
}
stage('Test') {
steps {
echo 'Testing Testing 123'
}
}
stage('Deploy') {
steps {
echo 'Deploy some things'
}
}
}
}
pipeline {
agent {
label 'docker'
}
stages {
stage('Build') {
steps {
echo 'Hello from Build'
writeFile(file: 'config', text: 'version=1', encoding: 'UTF-8')
stash(name: 'pom-config', includes: 'config')
}
}
stage('Test') {
environment {
configValue = readFile(encoding: 'UTF-8', file: 'config')
}
steps {
echo 'Testing Testing 123'
unstash 'pom-config'
sh 'echo "$configValue"'
}
}
stage('Deploy') {
steps {
echo 'Deploy some things'
}
}
}
}
pipeline {
agent {
label 'docker'
}
stages {
stage('Build') {
steps {
echo 'Hello from Build'
writeFile(file: 'config', text: 'version=1', encoding: 'UTF-8')
stash(name: 'pom-config', includes: 'config')
}
}
stage('Test') {
environment {
configValue = readFile(encoding: 'UTF-8', file: 'config')
}
steps {
echo 'Testing Testing 123'
unstash 'pom-config'
sh 'echo "$configValue"'
}
}
stage('Deploy') {
steps {
echo 'Deploy some things'
input 'Do you want to deploy?'
echo 'deployed'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment