-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
config.yml
257 lines (257 loc) · 7.93 KB
/
config.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
version: 2.1
orbs:
sonarcloud: sonarsource/[email protected]
commands:
maybe_skip_job:
steps:
- run:
name: Maybe skip job if not relevant
command: ./hack/maybe-skip-job.sh $CIRCLE_JOB
install_kustomize:
steps:
- run:
name: Install Kustomize
command: cd /usr/local/bin && curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | sudo bash
restore_go_mod:
steps:
- restore_cache:
name: Restore go mod cache
keys:
- go-mod-v3-{{ checksum "go.sum" }}-{{ .Environment.CIRCLE_JOB }}
save_go_mod:
steps:
- save_cache:
name: Save go mod cache
key: go-mod-v3-{{ checksum "go.sum" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- /home/circleci/.go_workspace/go/pkg/mod
when: always
install_golang:
steps:
- run:
name: Install Golang v1.13.4
command: |
go get golang.org/dl/go1.13.4
[ -e /home/circleci/sdk/go1.13.4 ] || go1.13.4 download
echo "export GOPATH=/home/circleci/.go_workspace" | tee -a $BASH_ENV
echo "export PATH=/home/circleci/sdk/go1.13.4/bin:\$PATH" | tee -a $BASH_ENV
save_go_cache:
steps:
- save_cache:
name: Save Golang cache
key: go-v7-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
paths:
- /home/circleci/.cache/go-build
- /home/circleci/sdk/go1.13.4
when: always
restore_go_cache:
steps:
- restore_cache:
name: Restore Golang cache
keys:
- go-v7-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}
- go-v7-master-{{ .Environment.CIRCLE_JOB }}
e2e:
steps:
- checkout
- maybe_skip_job
- install_kustomize
- run:
name: Preemptively pull images
command: make pull-build-images test-images
background: true
- run:
name: Install and start K3S v1.0.1
command: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.0.1 INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
background: true
- restore_go_cache
- install_golang
- restore_go_mod
- run: go mod download
- run:
name: Create KUBECONFIG
# Copy kubeconfig file, and add a fake user for "argo --token xxx" testing
command: |
mkdir -p ~/.kube
until stat /etc/rancher/k3s/k3s.yaml ; do sleep 10s ; done
cat /etc/rancher/k3s/k3s.yaml | sed "s/127.0.0.1/$(hostname)/g" > ~/.kube/config
echo "- name: fake_token_user" >> ~/.kube/config
echo " user:" >> ~/.kube/config
echo " token: xxxxxx" >> ~/.kube/config
- run:
name: Start Argo
command: |
echo '127.0.0.1 minio' | sudo tee -a /etc/hosts
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
echo '127.0.0.1 mysql' | sudo tee -a /etc/hosts
mkdir dist
KUBECONFIG=~/.kube/config make start DB=$DB E2E_EXECUTOR=docker DEV_IMAGE=true
# CircleCI will kill spawned processes, so lets block for 20m
sleep 20m
background: true
- run:
name: Wait for Argo Server to be ready
command: make wait
- run:
name: Run tests
command: |
trap 'make test-results/junit.xml' EXIT
make smoke $SUITE
- store_test_results:
path: test-results
when: always
- store_artifacts:
name: Store test results
path: test-results
destination: .
when: always
- store_artifacts:
name: Store logs
path: /tmp/log/argo-e2e
destination: .
when: always
- save_go_mod
- save_go_cache
jobs:
codegen:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- maybe_skip_job
- install_kustomize
- restore_go_cache
- install_golang
- run:
name: Install protoc
command: |
set -eux -o pipefail
PROTOC_ZIP=protoc-3.11.1-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.11.1/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod +x /usr/local/bin/protoc
sudo find /usr/local/include -type f | xargs sudo chmod a+r
sudo find /usr/local/include -type d | xargs sudo chmod a+rx
rm -f $PROTOC_ZIP
ls /usr/local/include/google/protobuf/
- run: go mod download
- run: make codegen
- run: make manifests
- run: make lint
- run: git diff --exit-code
- save_go_cache
- save_go_mod
test:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- maybe_skip_job
- install_kustomize
- restore_go_cache
- install_golang
- restore_go_mod
- run: go mod download
- run:
name: Run tests
command: |
trap 'make test-results/junit.xml' EXIT
make test
- run: |
cp sonar-project.properties dist/
if [ "$(echo "$CIRCLE_BRANCH" | grep 'master\|release-')" = '' ]; then
echo "sonar.pullrequest.branch=$CIRCLE_BRANCH" >> sonar-project.properties
echo "sonar.pullrequest.key=$CIRCLE_PR_NUMBER" >> sonar-project.properties
fi
- sonarcloud/scan
- run: cp dist/sonar-project.properties .
- store_test_results:
path: test-results
when: always
- store_artifacts:
path: test-results
destination: .
when: always
- save_go_cache
- save_go_mod
e2e-cron:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
environment:
DB: mysql
SUITE: test-e2e-cron
steps:
- e2e
e2e-no-db:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
environment:
DB: no-db
SUITE: test-e2e
steps:
- e2e
e2e-postgres:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
environment:
DB: postgres
SUITE: test-e2e
steps:
- e2e
e2e-mysql:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
environment:
DB: mysql
SUITE: test-e2e
steps:
- e2e
docker-build:
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- maybe_skip_job
- run: DOCKER_BUILDKIT=1 docker build .
ui:
docker:
- image: circleci/node:11.15.0
steps:
- checkout
- maybe_skip_job
- restore_cache:
name: Restore Yarn cache
keys:
- yarn-packages-v3-{{ checksum "ui/yarn.lock" }}
- run:
name: Download dependencies
command: yarn --cwd ui install --frozen-lockfile --ignore-optional --non-interactive
# - run: yarn test
- run: yarn --cwd ui build
- run: yarn --cwd ui lint
- run: git diff --exit-code
- save_cache:
name: Save Yarn cache
key: yarn-packages-v3-{{ checksum "ui/yarn.lock" }}
paths: [~/.cache/yarn, node_modules]
when: always
workflows:
version: 2
argo-workflow:
jobs:
- test
- ui
- codegen
- e2e-cron
- e2e-mysql
- e2e-no-db
- e2e-postgres
- docker-build