-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
62 lines (56 loc) · 2.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
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CI_REGISTRY_IMAGE: registry.gitlab.com/polaris-os-group/polaris-os
DOCKER_TLS_CERTDIR: ""
CI_REGISTRY_IMAGE_DOCKERHUB: mysciencework/polarisos
stages:
- Build
- Deploy
Build and Push image integration and production BBK:
image: docker:18.09.7-dind
stage: Build
services:
- docker:18.09.7-dind
tags:
- gitlab-org-docker
only:
- client/BBK
- INTEGRATION-BBK
script:
- echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin registry.gitlab.com
- docker build -t $CI_REGISTRY_IMAGE:BBK .
- docker push $CI_REGISTRY_IMAGE:BBK
Deploy test infra:
image: docker:18.09.7
stage: Deploy
variables:
GIT_STRATEGY: none
tags:
- docker-test-bbk
only:
- INTEGRATION-BBK
- client/BBK
script:
- 'which ssh-agent || ( apk update && apk add openssh-client )'
- eval $(ssh-agent -s)
- echo "$SSH_BBK_TEST01" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh -o "StrictHostKeyChecking=no" -tt deployuser@${IP_BBK_TEST01} 'docker login registry.gitlab.com && docker pull registry.gitlab.com/polaris-os-group/polaris-os:BBK && docker service update --force --with-registry-auth --image registry.gitlab.com/polaris-os-group/polaris-os:BBK test_app'
#Deploy prod infra:
# image: docker:18.09.7
# stage: Deploy
# variables:
# GIT_STRATEGY: none
# tags:
# - docker-prod-bbk
# only:
# - client/BBK
# script:
# - 'which ssh-agent || ( apk update && apk add openssh-client )'
# - eval $(ssh-agent -s)
# - echo "$SSH_BBK_PROD01" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh
# - chmod 700 ~/.ssh
# - ssh -o "StrictHostKeyChecking=no" -tt deployuser@${IP_BBK_PROD01} 'docker login registry.gitlab.com && docker pull registry.gitlab.com/polaris-os-group/polaris-os:BBK && docker service update --with-registry-auth --image registry.gitlab.com/polaris-os-group/polaris-os:BBK prod_app && docker service update --with-registry-auth --image registry.gitlab.com/polaris-os-group/polaris-os:BBK prod_app-nginx'