-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
183 lines (153 loc) · 4.38 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
stages:
- build_base
- build
- test
- deploy
image: docker:latest
variables:
DOCKER_REGISTRY: ${AWS_ACCOUNT_ID}.dkr.ecr.eu-west-1.amazonaws.com
IMAGE_NAME: ${AWS_ACCOUNT_ID}.dkr.ecr.eu-west-1.amazonaws.com/dev/vast-csi:${CI_PIPELINE_ID}
BASE_IMAGE_NAME: ${AWS_ACCOUNT_ID}.dkr.ecr.eu-west-1.amazonaws.com/dev/vast-csi-base:2024-09-10
ORION_BRANCH: comet/master
build_csi_base:
stage: build_base
script: |
set -x
LATEST=${DOCKER_REGISTRY}/dev/vast-csi-base:latest
if (docker pull $LATEST) ; then
docker tag $LATEST vast-csi-base:latest # the cache-source for our subsequent build
fi
docker build \
-t vast-csi-base:dev \
--cache-from vast-csi-base:latest \
-f packaging/base_Dockerfile .
docker tag vast-csi-base:dev ${BASE_IMAGE_NAME}
docker tag vast-csi-base:dev ${LATEST}
docker push ${BASE_IMAGE_NAME}
docker push ${LATEST}
echo "pushed ${BASE_IMAGE_NAME}"
when: manual
tags:
- vast-dev-builder
build_csi:
stage: build
script: |
set -x
VERSION=$(cat version.txt)
TAGGED=$(grep 'the version of the Vast CSI driver' charts/vastcsi/values.yaml | awk '{print $2}')
if [[ "$TAGGED" != "$VERSION" ]]; then
echo "version.txt has $VERSION, while our helm chart has $TAGGED (check charts/vastcsi/values.yaml)"
exit 5
fi
LATEST=${DOCKER_REGISTRY}/dev/vast-csi:latest
if (docker pull $LATEST) ; then
docker tag $LATEST vast-csi:latest # the cache-source for our subsequent build
fi
/bin/sh -x packaging/build.sh ${BASE_IMAGE_NAME} # --> vast-csi:dev
docker run vast-csi:dev test # start unit tests
docker tag vast-csi:dev ${IMAGE_NAME}
docker tag vast-csi:dev ${LATEST}
docker push ${IMAGE_NAME}
docker push ${LATEST}
echo "pushed ${IMAGE_NAME}"
tags:
- vast-dev-builder
.common_vars: &common_vars
INSTALL_IMAGE: "prev_version"
VAST_upgrade_to: $INSTALL_IMAGE
VAST_COMET__KWARG: csi_plugin_version=${CI_PIPELINE_ID}
TRIGGER_SOURCE: "vastcsi"
test_csi [latest]: &test_csi
stage: test
when: always
except:
- /v[\d]\.[\d]+/
trigger:
project: dev/orion
branch: $ORION_BRANCH
strategy: depend
allow_failure: true
variables: *common_vars
test_csi_multicluster [latest]:
<<: *test_csi
when: manual
variables:
<<: *common_vars
NUM_SYSTEMS: 2
test_csi:
<<: *test_csi
when: manual
allow_failure: true
except: null
parallel:
matrix:
- INSTALL_IMAGE: "4.5"
- INSTALL_IMAGE: "4.6"
- INSTALL_IMAGE: "4.7"
- INSTALL_IMAGE: "5.0"
- INSTALL_IMAGE: "5.1"
- INSTALL_IMAGE: "prev_version"
- INSTALL_IMAGE: "latest"
update_dockerhub [prod]: &update_dockerhub
stage: deploy
environment: prod
only:
- /v[\d]\.[\d]+/
script: |
set -x
VERSION=$(cat version.txt)
if [[ "$CI_ENVIRONMENT_NAME" != "prod" ]]; then
VERSION=$VERSION-$CI_ENVIRONMENT_NAME-$CI_PIPELINE_ID
fi
RELEASE_NAME=docker.io/vastdataorg/csi:${VERSION}
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} $DOCKER_HUB
/bin/sh -x packaging/push_multi_arch.sh ${BASE_IMAGE_NAME} ${RELEASE_NAME}
after_script:
- docker logout $DOCKER_HUB
when: manual
tags:
- vast-dev-builder
update_dockerhub [beta]:
<<: *update_dockerhub
environment: beta
update_github [prod]: &update_github
image:
name: alpine/git
entrypoint: [""]
stage: deploy
only:
- /^v[\d]\.[\d]+/
script: |
set -x
VERSION=$(cat version.txt)
mkdir ~/.ssh/
cp $GITHUB_KEY ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git config --global user.email "ofer.koren@vastdata.com"
git config --global user.name "Ofer Koren"
git remote -v
git remote add github git@github.com:vast-data/vast-csi.git || true
git fetch github $CI_COMMIT_REF_NAME
git checkout -B $CI_COMMIT_REF_NAME FETCH_HEAD
git checkout $CI_COMMIT_SHA -- .
git commit -am "VAST Data CSI Plugin - $VERSION
(from $CI_COMMIT_SHA)"
git tag -f $VERSION
git push -f --tags github HEAD:$CI_COMMIT_REF_NAME
when: manual
tags:
- vast-dev-builder
update_github [beta]:
<<: *update_github
only:
- /v[\d]\.[\d]+-beta.*/
mark_stable:
image:
name: amazon/aws-cli
entrypoint: [""]
stage: deploy
script: ./scripts/aws_retag_image.sh ${IMAGE_NAME} stable
tags:
- vast-dev-builder
when: manual