-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
75 lines (66 loc) · 1.75 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
image: docker
stages:
- deploy
- cleanup
variables:
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: recursive
CI_SOURCE_IMAGE_WITH_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
GITLAB_NAMESPACE: $CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG
REVIEW_HOST: "mm.${DOMAIN}"
.swarm_variables: &swarm_variables
DOCKER_HOST: tcp://$MANAGER_HOST:2376
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "/certs"
.setup:
variables:
<<: *swarm_variables
before_script:
- mkdir -p $DOCKER_CERT_PATH
- echo "$TLSCACERT" > $DOCKER_CERT_PATH/ca.pem
- echo "$TLSCERT" > $DOCKER_CERT_PATH/cert.pem
- echo "$TLSKEY" > $DOCKER_CERT_PATH/key.pem
- echo -n $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
after_script:
- rm -rf $DOCKER_CERT_PATH
tags: [docker]
deploy:
extends: .setup
stage: deploy
image:
name: git.rubium.ru:4567/rubium/docker-sdp:latest
entrypoint: [""]
script:
- |
cat > secret_values.yaml << EOF
registry_http_secret: ""
core_secret: "${REVIEW_HOST}"
gitlab_namespace: "${GITLAB_NAMESPACE}"
EOF
- echo "exec nothelm run deploy --project-dir ./chart -f secret_values.yaml" -f ./chart/values.yaml > setup.sh
# - docker stack deploy -c docker-compose.swarm.yml mattermost --with-registry-auth --resolve-image=always --prune
- bash setup.sh
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://${REVIEW_HOST}
on_stop: stop
when: manual
only:
- master
tags:
- docker
stop:
extends: .setup
stage: cleanup
dependencies:
- deploy
script:
- docker stack rm mattermost
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
only:
- master
tags:
- docker