-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
65 lines (59 loc) · 1.63 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
---
image: docker:18.01.0-ce-git
services:
- docker:18.01.0-ce-dind
stages:
- build
- deploy
variables:
HOMOLOG_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME-$CI_COMMIT_SHORT_SHA
RELEASE_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
KUBECONFIG: /etc/k8s-config
build to homolog:
variables:
GIT_SUBMODULE_STRATEGY: normal
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $HOMOLOG_IMAGE -f licenses/Dockerfile licenses/
- docker push $HOMOLOG_IMAGE
only:
- /master/
environment: homolog
tags:
- docker
deploy to homolog:
stage: deploy
image: hacklab/kubectl:latest
script:
- echo ${kube_config} | base64 -d > ${KUBECONFIG}
- kubectl -n amazonia-minada-site-dev --record deployment.apps/licenses set image deployment.v1.apps/licenses licenses=$HOMOLOG_IMAGE
only:
- /master/
environment: homolog
tags:
- docker
build to production:
stage: build
script:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build -t $RELEASE_IMAGE -f licenses/Dockerfile licenses/
- docker tag $RELEASE_IMAGE "$CI_REGISTRY_IMAGE:latest"
- docker push $RELEASE_IMAGE
- docker push "$CI_REGISTRY_IMAGE:latest"
only:
- tags
environment: production
tags:
- docker
deploy to production:
stage: deploy
image: hacklab/kubectl:latest
script:
- echo ${kube_config} | base64 -d > ${KUBECONFIG}
- kubectl -n amazonia-minada-site-prod --record deployment.apps/licenses set image deployment.apps/licenses licenses=$RELEASE_IMAGE
only:
- tags
environment: production
tags:
- docker