-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
118 lines (103 loc) · 3.08 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
default:
image:
name: "tokend/werf:0.0.16"
entrypoint: [""]
services:
- name: docker:20-dind
alias: docker
# in our experience although you'd assume this would be sufficient, this did
# nothing to prevent connection errors without `DOCKER_TLS_CERTDIR` being set
# to an empty string, and I would call that beyond mildly infuriating.
command: ["--tls=false"]
tags:
- "tokend"
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
REGISTRY: registry.gitlab.com/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
IMAGE_NAME: $REGISTRY:pg-$CI_COMMIT_SHA
IMAGE_NAME_TAG: $REGISTRY:$CI_COMMIT_TAG
WERF_LOG_COLOR_MODE: "on"
WERF_IMAGES_REPO: $CI_REGISTRY_IMAGE
WERF_BUILDAH_MODE: auto
WERF_ENABLE_PROCESS_EXTERMINATOR: 1
DH_IMAGE: index.docker.io/tokend/horizon
.before_script_template: &before_script_templ
before_script:
- werf version
- docker version
- echo $CI_REGISTRY
- echo $WERF_IMAGES_REPO
stages:
- build-and-publish
#- deploy
- cleanup
Build and Publish:
stage: build-and-publish
<<: *before_script_templ
script:
- export VERSION=$(echo $CI_COMMIT_TAG)
# login to docker registry
- . $(werf ci-env gitlab --as-file)
- werf export horizonpg --tag $IMAGE_NAME
except: [schedules]
interruptible: true
Build and Publish DH:
stage: build-and-publish
only:
- /^.+\..+\..+$/
script:
- export VERSION=$(test -z $CI_COMMIT_TAG && echo $CI_COMMIT_SHA || echo $CI_COMMIT_TAG)
# login to docker registry
- export RELEASE=$CI_COMMIT_REF_NAME
- . $(werf ci-env gitlab --as-file)
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PWD
- werf export horizonpg --tag $DH_IMAGE:$RELEASE
# Deploy to Staging:
# services:
# - docker:18-dind
# image: dtzar/helm-kubectl:latest
# tags:
# - tokend
# stage: deploy
# script:
# - mkdir ~/.kube/
# - echo ${k8sconfig} | base64 -d > config
# - mv config ~/.kube/
# - helm upgrade -i "webclient" ".helm" --set global.IngressDomain=stage.${DOMAIN} --set "image.repository=${REGISTRY}" --set "image.tag=${CI_COMMIT_SHA}" --create-namespace --namespace $CI_PROJECT_NAME-stage
# interruptible: true
# Deploy to Production:
# services:
# - docker:18-dind
# image: dtzar/helm-kubectl:latest
# tags:
# - tokend
# stage: deploy
# script:
# - mkdir ~/.kube/
# - echo ${k8sconfig} | base64 -d > config
# - mv config ~/.kube/
# - helm upgrade -i "webclient" ".helm" --set global.IngressDomain=${DOMAIN} --set "image.repository=${REGISTRY}" --set "image.tag=${CI_COMMIT_TAG}" --create-namespace --namespace $CI_PROJECT_NAME-prod
# when: manual
# interruptible: true
pages:
stage: build-and-publish
tags:
- tokend
script:
- echo 'Nothing to do...'
artifacts:
paths:
- public
only:
- master
- feature/deferred-payment
Cleanup:
stage: cleanup
<<: *before_script_templ
script:
- . $(werf ci-env gitlab --as-file)
- werf cleanup --repo $REGISTRY
only: [schedules]
interruptible: true