Skip to content

Commit d59d5dd

Browse files
committed
IMT-184: Add gitlab stage for prod deploments.
1 parent 38853f9 commit d59d5dd

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

.gitlab-ci.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tag:
4242
stage: tag
4343
extends: .tag_image
4444

45-
deploy:
45+
qa_deploy:
4646
variables:
4747
IMAGE: $HARBOR/tulibraries/isilon-tracker
4848
RANCHER: np-rancher
@@ -54,4 +54,39 @@ deploy:
5454
script:
5555
- *export_variables
5656
- helm pull oci://$HARBOR/tulibraries/charts/isilon-tracker --untar
57-
- helm upgrade isilon-tracker oci://$HARBOR/tulibraries/charts/isilon-tracker --history-max=5 --namespace=isilon-tracker --values isilon-tracker/values.yaml --set image.repository=$IMAGE:$VERSION
57+
- helm upgrade isilon-tracker oci://$HARBOR/tulibraries/charts/isilon-tracker --history-max=5 --namespace=isilon-tracker-qa --values isilon-tracker/values.yaml --set image.repository=$IMAGE:$VERSION
58+
59+
tag_prod_chart:
60+
stage: tag
61+
extends: .tag_image
62+
# Helm charts live in Harbor as OCI artifacts; add/update a "prod" tag so we
63+
# can easily find the chart version that is currently deployed in production.
64+
variables:
65+
HARBOR_PROJECT: "tulibraries"
66+
HARBOR_CHART_REPOSITORY: "charts%2Fisilon-tracker"
67+
only:
68+
- tags
69+
script:
70+
- |
71+
API_BASE="https://${HARBOR}/api/v2.0/projects/${HARBOR_PROJECT}/repositories/${HARBOR_CHART_REPOSITORY}"
72+
curl --silent --show-error -u "${HARBOR_USERNAME}:${HARBOR_TOKEN}" \
73+
-X DELETE "${API_BASE}/artifacts/prod/tags/prod" || echo "prod tag not present yet"
74+
- |
75+
curl --silent --show-error --fail \
76+
-u "${HARBOR_USERNAME}:${HARBOR_TOKEN}" \
77+
-H "Content-Type: application/json" \
78+
-d "{\"name\":\"prod\"}" \
79+
-X POST "${API_BASE}/artifacts/${HELM_VERSION_PROD}/tags"
80+
81+
prod_deploy:
82+
variables:
83+
IMAGE: harbor.k8s.temple.edu/tulibraries/isilon-tracker
84+
RANCHER: prod-rancher
85+
CLUSTER: $PROD_CLUSTER
86+
stage: deploy
87+
extends: .helm_setup
88+
only:
89+
- tags
90+
script:
91+
- helm pull oci://$HARBOR/tulibraries/charts/isilon-tracker --version $HELM_VERSION_PROD --untar
92+
- helm upgrade isilon-tracker oci://$HARBOR/tulibraries/charts/isilon-tracker --version $HELM_VERSION_PROD --history-max=5 --namespace=isilon-tracker-prod --values isilon-tracker/values-prod.yaml --set image.repository=$IMAGE:$CI_COMMIT_TAG

0 commit comments

Comments
 (0)