-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
158 lines (126 loc) · 4.39 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
variables:
DOCKER_REGISTRY: 110450271409.dkr.ecr.eu-west-1.amazonaws.com
PYSDK_BUILDER_IMAGE: $DOCKER_REGISTRY/dev/infra:vastdb-python-sdk-builder-latest
ORION_PREFIX: $DOCKER_REGISTRY/dev/orion
PYSDK_IMAGE_PREFIX: $ORION_PREFIX:vastdb-python-sdk-pipe-$CI_PIPELINE_ID
VASTDB_PYTHON_SDK_REPO: $DOCKER_REGISTRY/dev/vastdb-python-sdk
ORION_BRANCH: BUILD/roman.zeyde/2024-11-21-pysdk-ci # based on TEAM/tabular-5.3
BUILDER_DOCKER_BASE_IMAGE: $VASTDB_PYTHON_SDK_REPO:alonid-rockylinux-rpm-builder-8.6.20227707
pre_build:
stage: .pre
script:
- aws ecr get-login-password | docker login -u AWS --password-stdin https://$DOCKER_REGISTRY
- docker build -f Dockerfile.prebuild -t $PYSDK_BUILDER_IMAGE --build-arg BASE_IMAGE=${BUILDER_DOCKER_BASE_IMAGE} .
- docker push $PYSDK_BUILDER_IMAGE
rules:
- if: $CI_COMMIT_BRANCH =~ /^PREBUILD.*/
tags:
- code-builder-small-shell
build:
stage: build
interruptible: true
image: $PYSDK_BUILDER_IMAGE
tags:
- vast-dev-builder
variables:
VASTDB_APPEND_VERSION_SUFFIX: 'true'
PYSDK_IMAGE: ${PYSDK_IMAGE_PREFIX}-${PYTHON_VERSION}
script:
- echo "Building Docker image $PYSDK_IMAGE..."
- docker build -f Dockerfile --build-arg BASE_IMAGE=${VASTDB_PYTHON_SDK_REPO}:python-${PYTHON_VERSION}-slim -t $PYSDK_IMAGE .
- docker inspect $PYSDK_IMAGE
- echo "Checking Docker image $PYSDK_IMAGE..."
- docker run --rm $PYSDK_IMAGE scripts/check.sh
- echo "Publishing Docker image $PYSDK_IMAGE..."
- docker push $PYSDK_IMAGE
parallel:
matrix:
- PYTHON_VERSION: ['3.9', '3.10', '3.11', '3.12']
test_orion [branch]:
stage: test
trigger:
project: dev/orion
branch: $ORION_BRANCH
strategy: depend
variables:
PYSDK_IMAGE_PREFIX: $ORION_PREFIX:vastdb-python-sdk-pipe-$CI_PIPELINE_ID
RUN_ONLY_ALL: "true"
UPSTREAM_PROJECT: "vastdb_sdk"
upload_to_artifactory:
stage: deploy
interruptible: true
image: $PYSDK_BUILDER_IMAGE
tags:
- vast-dev-builder
variables:
PYSDK_IMAGE: ${PYSDK_IMAGE_PREFIX}-3.12 # use latest Python image for deployment
script:
- echo "Publishing artifacts from $PYSDK_IMAGE..."
- docker run
-e ARTIFACTORY_URL=$ARTIFACTORY_URL
-e ARTIFACTORY_JF_USER=$ARTIFACTORY_JF_USER
-e ARTIFACTORY_JF_PW=$ARTIFACTORY_JF_PW
-e CI_PIPELINE_ID=$CI_PIPELINE_ID
-e CI_PROJECT_NAME=$CI_PROJECT_NAME
$PYSDK_IMAGE scripts/upload.sh
upload_to_pypi:
stage: deploy
interruptible: true
image: $PYSDK_BUILDER_IMAGE
tags:
- vast-dev-builder
variables:
PYSDK_IMAGE: ${PYSDK_IMAGE_PREFIX}-3.12 # use latest Python image for deployment
when: manual
rules:
- if: $CI_COMMIT_TAG
when: manual
script:
- echo "Releasing to PyPI from $PYSDK_IMAGE (tag=$CI_COMMIT_TAG)..."
- docker run
-e TWINE_REPOSITORY_URL=$TWINE_REPOSITORY_URL
-e TWINE_USERNAME=$TWINE_USERNAME
-e TWINE_PASSWORD=$TWINE_PASSWORD
$PYSDK_IMAGE scripts/release.sh
# Keep latest image built from 'dev' branch - to allow smoke testing not-yet-released SDK versions
# '-latest-' is a special substring, that prevents Docker image deletion for 1 year
keep_latest_dev:
stage: deploy
interruptible: true
image: $PYSDK_BUILDER_IMAGE
tags:
- vast-dev-builder
variables:
PYSDK_IMAGE: ${PYSDK_IMAGE_PREFIX}-${PYTHON_VERSION}
TARGET_IMAGE: ${ORION_PREFIX}:vastdb-python-sdk-dev-latest-${PYTHON_VERSION}
rules:
- if: $CI_COMMIT_BRANCH == "dev"
script:
- echo "Keeping PySDK image $PYSDK_IMAGE at $TARGET_IMAGE..."
- docker pull $PYSDK_IMAGE
- docker tag $PYSDK_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
parallel:
matrix:
- PYTHON_VERSION: ['3.9', '3.10', '3.11', '3.12']
# Keep images of released SDK versions available (so we can run them from Orion's CI on demand)
# '-latest-' is a special substring, that prevents Docker image deletion for 1 year
keep_latest_release:
stage: deploy
interruptible: true
image: $PYSDK_BUILDER_IMAGE
tags:
- vast-dev-builder
variables:
PYSDK_IMAGE: ${PYSDK_IMAGE_PREFIX}-${PYTHON_VERSION}
TARGET_IMAGE: ${ORION_PREFIX}:vastdb-python-sdk-${CI_COMMIT_TAG}-latest-${PYTHON_VERSION}
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Keeping PySDK image $PYSDK_IMAGE at $TARGET_IMAGE..."
- docker pull $PYSDK_IMAGE
- docker tag $PYSDK_IMAGE $TARGET_IMAGE
- docker push $TARGET_IMAGE
parallel:
matrix:
- PYTHON_VERSION: ['3.9', '3.10', '3.11', '3.12']