-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
63 lines (57 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
variables:
IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
DOCKER_PULL_SECRET: pride-gitlab-docker-secret
#include:
# - template: Container-Scanning.gitlab-ci.yml
# - template: Dependency-Scanning.gitlab-ci.yml
# - template: License-Management.gitlab-ci.yml
docker_build:
variables:
DOCKER_AUTH_CONFIG: $docker_auth_json
image: docker:18.09
stage: build
services:
- docker:18.09-dind
script:
- apk add --update bash gettext tzdata coreutils
- docker info
- docker build -t $IMAGE .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $IMAGE
when: manual
#dev_hh_kube_deploy:
# environment: dev-hh
# variables:
# NAMESPACE: usi-viewer-dev
# extends: .kube_deploy_script
kube_deploy_prod_hh:
environment: prod-hh
variables:
NAMESPACE: usi-viewer
extends: .kube_deploy_script
# only:
# - main
kube_deploy_prod_hx:
environment: prod-hx
variables:
NAMESPACE: usi-viewer
extends: .kube_deploy_script
# only:
# - main
.kube_deploy_script:
variables:
DOCKER_AUTH_CONFIG: $docker_auth_json
stage: deploy
image: dtzar/helm-kubectl
script:
- apk add --update bash gettext tzdata coreutils
- mkdir -p ~/.kube
- echo $KUBE_CONFIG > kubeconfig
- base64 -d kubeconfig > ~/.kube/config
- kubectl config get-contexts
- kubectl create namespace $NAMESPACE || true
- kubectl -n $NAMESPACE delete secret $DOCKER_PULL_SECRET || true
- kubectl -n $NAMESPACE create secret docker-registry $DOCKER_PULL_SECRET --docker-server=$CI_REGISTRY --docker-username=$CI_DEPLOY_USER --docker-password=$CI_DEPLOY_PASSWORD
- envsubst < .kubernetes.yml > kubernetes.yml
- kubectl -n $NAMESPACE apply -f kubernetes.yml
when: manual