forked from mozilla-services/tokenserver
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
63 lines (59 loc) · 1.73 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
---
stages:
- prepare
- build-and-push-image
- helm
get-image-tag:
stage: prepare
image:
name: bitnami/git
entrypoint: ["bash"]
artifacts:
paths:
- tag
script:
- |
(git describe --tags --always HEAD | sed -n -E 's/^([0-9\.]+)(-([0-9]+.*))?/\1-enote-\3/p') > tag
build-and-push-image:
stage: build-and-push-image
dependencies:
- get-image-tag
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- |
set -e
TAG=$(cat tag)
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile Dockerfile --destination $CI_REGISTRY_IMAGE:$TAG
.update-helm-charts-template:
stage: helm
dependencies:
- get-image-tag
image:
name: bitnami/git
entrypoint: ["bash"]
script:
- |
set -e
apt-get update
apt-get install gettext-base
git clone https://$GITHUB_PERSONAL_TOKEN@github.com/eNote-GmbH/helm-charts.git /tmp/helm-charts
export TAG=$(cat tag)
cd /tmp/helm-charts
git config credential.helper 'cache --timeout=120'
git config user.email "ci-cd@enote.com"
git config user.name "enotecicd"
envsubst '$TAG' < "$ENV/tokenserver/values-template.yaml" > "$ENV/tokenserver/values.yaml"
git add .
git commit -m "[gitlab] Update image tag to $TAG for tokenserver"
git push -q https://$GITHUB_PERSONAL_TOKEN@github.com/eNote-GmbH/helm-charts.git master
update-helm-charts-dev:
extends: .update-helm-charts-template
variables:
ENV: dev
only:
variables:
- $CI_COMMIT_REF_NAME == "enote"