Fix jenkins (#139)
* Attempt to fix Jenkinsfile * Only deploy on master
This commit is contained in:
parent
ff4e63b74f
commit
544cf46b10
52
Jenkinsfile
vendored
52
Jenkinsfile
vendored
@ -1,40 +1,23 @@
|
||||
node('node') {
|
||||
|
||||
// Install the desired Go version
|
||||
def root = tool name: 'Go 1.10', type: 'go'
|
||||
|
||||
// Export environment variables pointing to the directory where Go was installed
|
||||
withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin", "PATH=$PATH:${root}/bin"]) {
|
||||
sh 'go version'
|
||||
}
|
||||
try {
|
||||
|
||||
stage 'Checkout'
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
checkout scm
|
||||
stage('Build Images') {
|
||||
sh 'make images'
|
||||
}
|
||||
|
||||
stage 'Test'
|
||||
|
||||
sh """#!/bin/bash -e
|
||||
echo $root
|
||||
echo "path="
|
||||
echo $PATH
|
||||
make build-dev-deps lint
|
||||
"""
|
||||
|
||||
stage 'Build Docker'
|
||||
echo 'Build'
|
||||
|
||||
stage 'Deploy'
|
||||
echo 'Deploy'
|
||||
|
||||
|
||||
stage 'Cleanup'
|
||||
|
||||
echo 'prune and cleanup'
|
||||
stage('Deploy') {
|
||||
if (env.BRANCH_NAME != 'master') {
|
||||
echo 'Skipping deploy stage'
|
||||
return
|
||||
}
|
||||
sh 'make push-images'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
currentBuild.result = "FAILURE"
|
||||
|
||||
@ -47,5 +30,14 @@ node('node') {
|
||||
|
||||
throw err
|
||||
*/
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
stage('Cleanup') {
|
||||
sh 'make clean-images'
|
||||
deleteDir()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
7
Makefile
7
Makefile
@ -79,12 +79,15 @@ clean-local:
|
||||
|
||||
images:
|
||||
docker build --build-arg VERSION=${GO_VERSION} -t storjlabs/overlay:${TAG}-${GO_VERSION} -f cmd/overlay/Dockerfile .
|
||||
docker tag storjlabs/overlay:${TAG}-${GO_VERSION} overlay:latest
|
||||
docker tag storjlabs/overlay:${TAG}-${GO_VERSION} storjlabs/overlay:latest
|
||||
|
||||
push-images:
|
||||
docker push storjlabs/overlay:${TAG}-${GO_VERSION}
|
||||
docker push storjlabs/overlay:latest
|
||||
|
||||
clean-images:
|
||||
-docker rmi storjlabs/overlay:${TAG}-${GO_VERSION} storjlabs/overlay:latest
|
||||
|
||||
install-deps:
|
||||
go get -u -v golang.org/x/vgo
|
||||
cd vgo install ./...
|
||||
cd vgo install ./...
|
||||
|
Loading…
Reference in New Issue
Block a user