Fix jenkins (#139)
* Attempt to fix Jenkinsfile * Only deploy on master
This commit is contained in:
parent
ff4e63b74f
commit
544cf46b10
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@ -1,40 +1,23 @@
|
|||||||
node('node') {
|
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 {
|
try {
|
||||||
|
|
||||||
stage 'Checkout'
|
stage('Checkout') {
|
||||||
|
|
||||||
checkout scm
|
checkout scm
|
||||||
|
|
||||||
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('Build Images') {
|
||||||
|
sh 'make images'
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
if (env.BRANCH_NAME != 'master') {
|
||||||
|
echo 'Skipping deploy stage'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sh 'make push-images'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
currentBuild.result = "FAILURE"
|
currentBuild.result = "FAILURE"
|
||||||
|
|
||||||
@ -47,5 +30,14 @@ node('node') {
|
|||||||
|
|
||||||
throw err
|
throw err
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
|
||||||
|
stage('Cleanup') {
|
||||||
|
sh 'make clean-images'
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
Makefile
5
Makefile
@ -79,12 +79,15 @@ clean-local:
|
|||||||
|
|
||||||
images:
|
images:
|
||||||
docker build --build-arg VERSION=${GO_VERSION} -t storjlabs/overlay:${TAG}-${GO_VERSION} -f cmd/overlay/Dockerfile .
|
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:
|
push-images:
|
||||||
docker push storjlabs/overlay:${TAG}-${GO_VERSION}
|
docker push storjlabs/overlay:${TAG}-${GO_VERSION}
|
||||||
docker push storjlabs/overlay:latest
|
docker push storjlabs/overlay:latest
|
||||||
|
|
||||||
|
clean-images:
|
||||||
|
-docker rmi storjlabs/overlay:${TAG}-${GO_VERSION} storjlabs/overlay:latest
|
||||||
|
|
||||||
install-deps:
|
install-deps:
|
||||||
go get -u -v golang.org/x/vgo
|
go get -u -v golang.org/x/vgo
|
||||||
cd vgo install ./...
|
cd vgo install ./...
|
Loading…
Reference in New Issue
Block a user