forked from nebtex/vault-migrator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
79 lines (71 loc) · 1.94 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
image: cr.genos.nebtex.com/publicdev/golang:1.8
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- vendor/
untracked: true
before_script:
- mkdir -p /go/src /go/bin /go/src/github.com/nebtex
- export GOPATH=/go
- export PATH=$PATH:/go/bin
- ln -s /builds/publicdev/vault-migrator /go/src/github.com/nebtex/vault-migrator
- cd /go/src/github.com/nebtex/vault-migrator
- echo $PWD
- add-apt-repository ppa:masterminds/glide --yes && apt-get update -y
- apt-get install glide make curl zip unzip -y
stages:
- deps
- test
- build
- deploy
- publish
deps:
stage: deps
script:
- glide install
build_master:
stage: build
only:
- master
script:
- export VAULT_MIGRATOR_RELEASE=latest
- make build
build_tags:
stage: build
only:
- tags
script:
- export prefix=v
- export VAULT_MIGRATOR_RELEASE=${CI_COMMIT_TAG#$prefix}
- make build
deploy:
stage: deploy
only:
- master
script:
- curl --request POST --form token=$VAULT_BACKUP_TRIGGER_TOKEN --form ref=master https://git.genos.nebtex.com/api/v4/projects/219/trigger/pipeline
set_stable_version:
stage: publish
allow_failure: true
only:
- tags
script:
- export prefix=v
- export VAULT_MIGRATOR_RELEASE=${CI_COMMIT_TAG#$prefix}
- mkdir -p $HOME/.ssh
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- git config --global user.name "nebot"
- git config --global user.email [email protected]
- echo -e "$nebot_key" > $HOME/.ssh/id_rsa
- echo -e "$nebot_gpg" > $HOME/private.key
- gpg --import $HOME/private.key
- git config --global user.signingkey $nebot_secret_key_gpg
- chmod 400 $HOME/.ssh/id_rsa
- cd /tmp
- git clone [email protected]:nebtex/vault-migrator.git
- cd vault-migrator
- rm -rf stable.txt
- printf $VAULT_MIGRATOR_RELEASE > stable.txt
- git add .
- git commit -S -m "set stable version to $VAULT_MIGRATOR_RELEASE, [skip ci]"
- git push origin master