forked from NVIDIA/ais-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
211 lines (195 loc) · 5.52 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
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
image: ubuntu:18.04
stages:
- build
- test:short
- test:long
- push
variables:
ADMIN_IMAGE: "aistore/admin"
AISNODE_IMAGE: "aistore/aisnode"
before_script:
- apt-get update -y && apt install -y docker.io build-essential
- |
echo '{"storage-driver": "vfs"}' >> /etc/docker/daemon.json
- nohup dockerd >/dev/null 2>&1 & sleep 10
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
.default_only_template: &default_only_def
only:
- master
- merge_requests
- schedules
build:operator:lint:
stage: build
image: aistore/ci:1.16
timeout: 10m
<<: *default_only_def
script:
- cd operator
- make lint
- make fmt-check
- make spell-check
build:operator:
stage: build
image: aistore/ci:1.16
timeout: 10m
<<: *default_only_def
script:
- make -C operator manager
build:docker:
stage: build
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH == "master"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
script:
- mkdir -p /go/src/github.com/NVIDIA
- pushd /go/src/github.com/NVIDIA
- git clone https://github.com/NVIDIA/aistore.git
- pushd aistore/deploy/prod/k8s/aisadmin_container
- env IMAGE_REPO="${ADMIN_IMAGE}" IMAGE_TAG="nightly" make -e all
- popd
- pushd aistore/deploy/prod/k8s/aisnode_container
- env IMAGE_REPO="${AISNODE_IMAGE}" IMAGE_TAG="nightly" make -e all
- popd
- popd
- mkdir images
- docker save --output="images/nightly.tar" "${ADMIN_IMAGE}:nightly" "${AISNODE_IMAGE}:nightly"
artifacts:
paths:
- images/
expire_in: 1h
operator:minikube:short:
stage: test:short
needs: ["build:operator:lint", "build:operator"]
image: aistore/ci:1.16
<<: *default_only_def
tags:
- ais-k8s
timeout: 18m
script:
- make -C operator test-short
operator:minikube:long:
stage: test:long
needs: ["operator:minikube:short"]
image: aistore/ci:1.16
tags:
- ais-k8s
timeout: 40m
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- operator/*
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
script:
- make -C operator test
operator:minikube:metallb:
stage: test:long
needs: ["operator:minikube:short"]
image: aistore/ci:1.16
variables:
# NOTE: No particular reason why these addresses would be unavailable.
EXTERNAL_ADDRESSES: 172.20.0.100–172.20.0.120
tags:
- ais-k8s
timeout: 20m
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
before_script:
- apt-get install gettext-base
- make -C operator deploy-metallb
script:
- make -C operator test
after_script:
- make -C operator undeploy-metallb
.operator_gcp:
stage: test:long
# If minikube fails - don't bother to try GCP.
needs: ["operator:minikube:short"]
image: aistore/ci:1.16
timeout: 60m
variables:
GOOGLE_APPLICATION_CREDENTIALS: "/tmp/gcs.json"
before_script:
- apt-get update -y && apt install -y build-essential
- make -C terraform ci-prepare
- echo "${GOOGLE_APPLICATION_CREDENTIALS_JSON}" > "${GOOGLE_APPLICATION_CREDENTIALS}"
script:
- make -C terraform ci-deploy-k8s
- make -C operator test
after_script:
- make -C terraform destroy
operator:gcp:
extends: .operator_gcp
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*skip-ci-gcp.*/'
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- operator/*
- terraform/*
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
script:
- make -C terraform ci-deploy-k8s
- make -C operator test
operator:gcp:cilium:
extends: .operator_gcp
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
script:
- make -C terraform ci-deploy-k8s ARGS="cilium"
- make -C operator test
helm:gcp:
stage: test:long
# Run immediately, don't require build:operator.
needs: []
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*skip-ci-gcp.*/'
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- terraform/*
- helm/*
allow_failure: true # TODO: Remove once pipeline is fully stable.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
variables:
GOOGLE_APPLICATION_CREDENTIALS: "/tmp/gcs.json"
before_script:
- apt-get update -y && apt install -y build-essential
- make -C terraform ci-prepare
- echo "${GOOGLE_APPLICATION_CREDENTIALS_JSON}" > "${GOOGLE_APPLICATION_CREDENTIALS}"
script:
- make -C terraform ci-deploy
- make -C terraform ci-test
after_script:
- make -C terraform destroy
push:docker:
stage: push
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true
script:
- docker load --input="images/nightly.tar"
- docker tag "${ADMIN_IMAGE}:nightly" "${ADMIN_IMAGE}:latest"
- docker push "${ADMIN_IMAGE}:latest"
- docker tag "${AISNODE_IMAGE}:nightly" "${AISNODE_IMAGE}:latest"
- docker push "${AISNODE_IMAGE}:latest"