-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
89 lines (78 loc) · 1.94 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
stages:
- build
- push
- deploy
variables:
RULES_CHANGES_PATH: "**/*"
DOCKER_DRIVER: overlay2
services:
- docker:dind
- docker:node:16
# Rules
.base-rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
- if: '$CI_PIPELINE_SOURCE == "push"'
when: never
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- $RULES_CHANGES_PATH
- when: manual
allow_failure: true
.service:
extends: .base-rules
variables:
RULES_CHANGES_PATH: "pkg/service/**/*"
.squid:
extends: .base-rules
variables:
RULES_CHANGES_PATH: "pkg/squid/**/*"
# Service
service-push:
stage: push
image: docker
extends: .service
needs: [ ]
script:
- cd pkg/service
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t registry.gitlab.com/gamedao/gamedao-haiku/service:latest .
- docker push registry.gitlab.com/gamedao/gamedao-haiku/service:latest
service-deploy:
stage: deploy
extends: .service
needs: [ "service-push" ]
tags:
- beeblebrox
- development
- shell
script:
- cd /home/ubuntu/squid
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- docker-compose up -d --force-recreate
squid-push:
stage: push
image: docker
extends: .squid
script:
- cd pkg/squid
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t registry.gitlab.com/gamedao/gamedao-haiku/squid:latest .
- docker push registry.gitlab.com/gamedao/gamedao-haiku/squid:latest
squid-deploy:
stage: deploy
extends: .squid
needs: [ "squid-push" ]
tags:
- beeblebrox
- development
- shell
script:
- cd /home/ubuntu/squid
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose pull
- docker-compose up -d --force-recreate