forked from litmuschaos/chaos-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
98 lines (84 loc) · 2.07 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
stages:
- setup
- build
- test
- push
- baseline
- cleanup
ClusterSetup:
stage: setup
tags:
- setup
script:
- chmod 755 ./build/gitlab/stages/1-cluster-setup/gcp
- ./build/gitlab/stages/1-cluster-setup/gcp
artifacts:
when: always
paths:
- .kube/
Build:
stage: build
tags:
- build
script:
- export COMMIT=${CI_COMMIT_SHORT_SHA}
- export GOPATH=$HOME/go
- export GOROOT=/usr/local/go
- export PATH=$HOME/go/bin:$PATH
- mkdir -p $HOME/go/src/github.com/${REPONAME}/${IMAGENAME}
- rsync -az --delete ${CI_PROJECT_DIR}/ ${GOPATH}/src/github.com/${REPONAME}/${IMAGENAME}/ #CI_PROJECT_DIR is full path where project is cloned
- go env
- cd ${GOPATH}/src/github.com/${REPONAME}/${IMAGENAME}
- make deps
- make gotasks
Test:
stage: test
tags:
- test
script:
- cd ${HOME}/go/src/github.com/${REPONAME}/${IMAGENAME}
- make test
Push:
stage: push
tags:
- push
script:
- cd ${HOME}/go/src/github.com/${REPONAME}/${IMAGENAME}
- sudo make dockerops
baseline-image:
when: always
stage: baseline
tags:
- test
only:
refs:
- /^(v[0-9][.][0-9][.]x|master)?$/
script:
- pwd
- export BRANCH=${CI_COMMIT_REF_NAME}
- echo $BRANCH
- export COMMIT=${CI_COMMIT_SHORT_SHA}
- echo $COMMIT
- git clone https://github.com/litmuschaos/litmus-e2e.git
- cd litmus-e2e
- git checkout ${BASELINE_BRANCH}
- cd baseline
- ansible-playbook commit-writer.yml --extra-vars "branch=$BRANCH repo=$CI_PROJECT_NAME commit=$COMMIT"
- git status
- git add baseline
- git status
- git commit -m "updated $CI_PROJECT_NAME commit:$COMMIT"
- git push http://${YOUR_USERNAME}:${PERSONAL_ACCESS_TOKEN}@github.com/litmuschaos/litmus-e2e.git --all
ClusterCleanup:
when: always
stage: cleanup
tags:
- cleanup
script:
- chmod 755 ./build/gitlab/stages/2-cluster-cleanup/cluster-cleanup
- ./build/gitlab/stages/2-cluster-cleanup/cluster-cleanup
artifacts:
when: always
paths:
- .kube/