From 0eb9ea0094b6325b1196b0de3fbf868b148ef8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Hedenstro=CC=88m?= <erik@hedenstroem.com> Date: Thu, 3 Nov 2016 10:03:23 +0100 Subject: [PATCH] Made build script more generic --- .gitlab-ci.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c32b95..acd026a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,33 +1,39 @@ -image: registry.hedenstroem.com/gitlab/gitlab-builder-go:1.7.1 +image: registry.hedenstroem.com/gitlab/gitlab-builder-go:1.7.3 before_script: - - export GOPATH=${CI_PROJECT_DIR}/go - - export GOBIN=${GOPATH}/bin - - export PATH=${GOBIN}:$PATH + - CI_PROJECT_HOST=gitlab.hedenstroem.com + - git config --global url."git@$CI_PROJECT_HOST:".insteadOf "https://$CI_PROJECT_HOST/" + - CI_PROJECT_GOPATH=$GOPATH/src/$CI_PROJECT_HOST/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME + - mkdir -p $CI_PROJECT_GOPATH + - ln -s $CI_PROJECT_DIR $CI_PROJECT_GOPATH + - cd $CI_PROJECT_GOPATH stages: - build - deploy - trigger -go get: +go build: stage: build only: - master script: - - go get ./cmd/... + - CGO_ENABLED=0 go build -tags netgo --ldflags '-extldflags "-static"' ./cmd/genpasswd + - CGO_ENABLED=0 go build -tags netgo --ldflags '-extldflags "-static"' ./cmd/consul-backup artifacts: paths: - - go/bin/ + - genpasswd + - consul-backup upload to aws: stage: deploy only: - master script: - - aws s3 cp go/bin s3://s3.erlang.ninja/consul_proxy/extras/ --recursive + - aws s3 cp genpasswd s3://s3.erlang.ninja/consul_proxy/extras/ + - aws s3 cp consul-backup s3://s3.erlang.ninja/consul_proxy/extras/ -trigger: +trigger downstream: stage: trigger only: - production -- GitLab