Skip to content

Instantly share code, notes, and snippets.

@jbleduigou
Created February 19, 2020 21:01
Show Gist options
  • Save jbleduigou/86f68896edb33671b03fed502127a1ae to your computer and use it in GitHub Desktop.
Save jbleduigou/86f68896edb33671b03fed502127a1ae to your computer and use it in GitHub Desktop.
#!/usr/bin/groovy
pipeline {
agent {
docker { image 'golang:1.13' }
}
environment {
XDG_CACHE_HOME='/tmp/.cache'
GOOS='linux'
GOARCH='amd64'
}
stages {
stage('Build') {
steps {
// Get the code from GitHub repository
git 'https://github.com/jbleduigou/budgetcategorizer.git'
// Code is checked out in a separate folder, create symlink to GOPATH
sh 'mkdir -p $GOPATH/src/github/jbleduigou'
sh 'ln -s $WORKSPACE $GOPATH/src/github/jbleduigou/budgetcategorizer'
// Build the go project
sh 'cd $GOPATH/src/github/jbleduigou/budgetcategorizer && go build -o budgetcategorizer ./cmd/budgetcategorizer'
}
post {
success {
archiveArtifacts artifacts: 'budgetcategorizer', fingerprint: true
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment