-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (143 loc) · 5.32 KB
/
publish-microservices.yaml
File metadata and controls
165 lines (143 loc) · 5.32 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build microservices
on:
push:
branches: [ "production", "master" ]
jobs:
buildServices1:
name: Build first part of images and push to registry
runs-on: ubuntu-latest
steps:
- name: Set prod environment
if: endsWith(github.ref, '/production')
run: |
echo "DOCKER_URL=${{ secrets.PRODUCTION_DOCKER_URL }}" >> $GITHUB_ENV
- name: Set dev environment
if: endsWith(github.ref, '/master')
run: |
echo "DOCKER_URL=${{ secrets.STAGING_DOCKER_URL }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Login docker dev
if: endsWith(github.ref, '/master')
uses: docker/login-action@v3
with:
username: ${{ secrets.STAGING_DOCKER_USER }}
password: ${{ secrets.STAGING_DOCKER_PASSWORD }}
registry: ${{ secrets.STAGING_DOCKER_URL }}
- name: Login docker prod
if: endsWith(github.ref, '/production')
uses: docker/login-action@v3
with:
username: ${{ secrets.PRODUCTION_DOCKER_USER }}
password: ${{ secrets.PRODUCTION_DOCKER_PASSWORD }}
registry: ${{ secrets.PRODUCTION_DOCKER_URL }}
- name: Build docker image presenation
uses: docker/build-push-action@v6
with:
context: ./cppseminar/presentation
push: true
tags: ${{ env.DOCKER_URL }}/services/presentation:${{ github.sha }}
- name: Build docker image userservice
uses: docker/build-push-action@v6
with:
context: ./cppseminar/userservice
push: true
tags: ${{ env.DOCKER_URL }}/services/userservice:${{ github.sha }}
- name: Build docker image submissions
uses: docker/build-push-action@v6
with:
context: ./cppseminar/submissions
push: true
tags: ${{ env.DOCKER_URL }}/services/submissions:${{ github.sha }}
buildServices2:
name: Build second part of images and push to registry
runs-on: ubuntu-latest
steps:
- name: Set prod environment
if: endsWith(github.ref, '/production')
run: |
echo "DOCKER_URL=${{ secrets.PRODUCTION_DOCKER_URL }}" >> $GITHUB_ENV
- name: Set dev environment
if: endsWith(github.ref, '/master')
run: |
echo "DOCKER_URL=${{ secrets.STAGING_DOCKER_URL }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Login docker dev
if: endsWith(github.ref, '/master')
uses: docker/login-action@v3
with:
username: ${{ secrets.STAGING_DOCKER_USER }}
password: ${{ secrets.STAGING_DOCKER_PASSWORD }}
registry: ${{ secrets.STAGING_DOCKER_URL }}
- name: Login docker prod
if: endsWith(github.ref, '/production')
uses: docker/login-action@v3
with:
username: ${{ secrets.PRODUCTION_DOCKER_USER }}
password: ${{ secrets.PRODUCTION_DOCKER_PASSWORD }}
registry: ${{ secrets.PRODUCTION_DOCKER_URL }}
- name: Build docker image test service
uses: docker/build-push-action@v6
with:
context: ./cppseminar/testservice
push: true
tags: ${{ env.DOCKER_URL }}/services/testservice:${{ github.sha }}
- name: Build docker image vm-test-server
uses: docker/build-push-action@v6
with:
context: ./cppseminar/vm-test-server
push: true
tags: ${{ env.DOCKER_URL }}/services/vm-test-server:${{ github.sha }}
- name: Build docker image vm-test-queue
uses: docker/build-push-action@v6
with:
context: ./cppseminar/vm-test-queue
push: true
tags: ${{ env.DOCKER_URL }}/services/vm-test-queue:${{ github.sha }}
- name: Build docker image mongo-backup
uses: docker/build-push-action@v6
with:
context: ./services/mongo-simple-backup
push: true
tags: ${{ env.DOCKER_URL }}/services/mongo-backup:${{ github.sha }}
upgradeHelm:
name: Send new version to Kubernetes
runs-on: ubuntu-latest
needs: [ "buildServices1", "buildServices2" ]
if: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deliverybot Helm Action dev
if: endsWith(github.ref, '/master')
uses: deliverybot/helm@v1.7.0
with:
release: apcchart
helm: helm3
version: ${{ github.sha }}
# track: stable # Maybe in future change to canary
task: upgrade
namespace: default
values: |
releaseLabel: "${{ github.sha }}"
dockerRepository: ${{ secrets.STAGING_REGISTRY }}
websiteHost: ${{ secrets.STAGING_HOST }}
chart: ./cppseminar/apchelm
env:
KUBECONFIG_FILE: ${{ secrets.STAGING_KUBECONFIG }}
- name: Deliverybot Helm Action prod
if: endsWith(github.ref, '/production')
uses: deliverybot/helm@v1.7.0
with:
release: apcprod
helm: helm3
version: ${{ github.sha }}
task: upgrade
namespace: default
value-files: "./cppseminar/apchelm/values-prod.yaml"
values: |
releaseLabel: "${{ github.sha }}"
chart: ./cppseminar/apchelm
env:
KUBECONFIG_FILE: ${{ secrets.PRODUCTION_KUBECONFIG }}