Skip to content

Commit 0aa4172

Browse files
authored
Merge pull request #5552 from Ocelot-Social-Community/5059-groups/5551-remove-groups-separate-auto-deployment
chore: 🍰 Remove Group Branchs `5059-epic-groups` Separate Auto-Deployment
2 parents ab6a4f4 + ef06f1a commit 0aa4172

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: ocelot.social publish CI
33
on:
44
push:
55
branches:
6-
# - master
7-
- 5059-epic-groups # for testing while developing
6+
- master
7+
# - 5059-epic-groups # for testing while developing
8+
# template branches in repo
9+
# - template--separate-branch-auto-deployment--5059-epic-groups
810

911
jobs:
1012
##############################################################################
@@ -94,16 +96,16 @@ jobs:
9496
##########################################################################
9597
- name: Backend | Build `production` image
9698
run: |
97-
docker build --target base -t "ocelotsocialnetwork/backend-groups:latest-base" -t "ocelotsocialnetwork/backend-groups:${VERSION}-base" -t "ocelotsocialnetwork/backend-groups:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
98-
docker build --target code -t "ocelotsocialnetwork/backend-groups:latest-code" -t "ocelotsocialnetwork/backend-groups:${VERSION}-code" -t "ocelotsocialnetwork/backend-groups:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
99-
docker build --target production -t "ocelotsocialnetwork/backend-groups:latest" -t "ocelotsocialnetwork/backend-groups:${VERSION}" -t "ocelotsocialnetwork/backend-groups:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
99+
docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
100+
docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
101+
docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/
100102
- name: Backend | Save docker image
101-
run: docker save "ocelotsocialnetwork/backend-groups" > /tmp/backend-groups.tar
103+
run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar
102104
- name: Upload Artifact
103105
uses: actions/upload-artifact@v2
104106
with:
105107
name: docker-backend-production
106-
path: /tmp/backend-groups.tar
108+
path: /tmp/backend.tar
107109

108110
##############################################################################
109111
# JOB: DOCKER BUILD PRODUCTION WEBAPP ########################################
@@ -134,16 +136,16 @@ jobs:
134136
##########################################################################
135137
- name: Webapp | Build `production` image
136138
run: |
137-
docker build --target base -t "ocelotsocialnetwork/webapp-groups:latest-base" -t "ocelotsocialnetwork/webapp-groups:${VERSION}-base" -t "ocelotsocialnetwork/webapp-groups:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
138-
docker build --target code -t "ocelotsocialnetwork/webapp-groups:latest-code" -t "ocelotsocialnetwork/webapp-groups:${VERSION}-code" -t "ocelotsocialnetwork/webapp-groups:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
139-
docker build --target production -t "ocelotsocialnetwork/webapp-groups:latest" -t "ocelotsocialnetwork/webapp-groups:${VERSION}" -t "ocelotsocialnetwork/webapp-groups:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
139+
docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
140+
docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
141+
docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/
140142
- name: Webapp | Save docker image
141-
run: docker save "ocelotsocialnetwork/webapp-groups" > /tmp/webapp-groups.tar
143+
run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar
142144
- name: Upload Artifact
143145
uses: actions/upload-artifact@v2
144146
with:
145147
name: docker-webapp-production
146-
path: /tmp/webapp-groups.tar
148+
path: /tmp/webapp.tar
147149

148150
##############################################################################
149151
# JOB: DOCKER BUILD PRODUCTION MAINTENANCE ###################################
@@ -174,16 +176,16 @@ jobs:
174176
##########################################################################
175177
- name: Maintenance | Build `production` image
176178
run: |
177-
docker build --target base -t "ocelotsocialnetwork/maintenance-groups:latest-base" -t "ocelotsocialnetwork/maintenance-groups:${VERSION}-base" -t "ocelotsocialnetwork/maintenance-groups:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
178-
docker build --target code -t "ocelotsocialnetwork/maintenance-groups:latest-code" -t "ocelotsocialnetwork/maintenance-groups:${VERSION}-code" -t "ocelotsocialnetwork/maintenance-groups:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
179-
docker build --target production -t "ocelotsocialnetwork/maintenance-groups:latest" -t "ocelotsocialnetwork/maintenance-groups:${VERSION}" -t "ocelotsocialnetwork/maintenance-groups:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
179+
docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
180+
docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
181+
docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance
180182
- name: Maintenance | Save docker image
181-
run: docker save "ocelotsocialnetwork/maintenance-groups" > /tmp/maintenance-groups.tar
183+
run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar
182184
- name: Upload Artifact
183185
uses: actions/upload-artifact@v2
184186
with:
185187
name: docker-maintenance-production
186-
path: /tmp/maintenance-groups.tar
188+
path: /tmp/maintenance.tar
187189

188190
##############################################################################
189191
# JOB: UPLOAD TO DOCKERHUB ###################################################
@@ -217,21 +219,21 @@ jobs:
217219
name: docker-backend-production
218220
path: /tmp
219221
- name: Load Docker Image
220-
run: docker load < /tmp/backend-groups.tar
222+
run: docker load < /tmp/backend.tar
221223
- name: Download Docker Image (WebApp)
222224
uses: actions/download-artifact@v2
223225
with:
224226
name: docker-webapp-production
225227
path: /tmp
226228
- name: Load Docker Image
227-
run: docker load < /tmp/webapp-groups.tar
229+
run: docker load < /tmp/webapp.tar
228230
- name: Download Docker Image (Maintenance)
229231
uses: actions/download-artifact@v2
230232
with:
231233
name: docker-maintenance-production
232234
path: /tmp
233235
- name: Load Docker Image
234-
run: docker load < /tmp/maintenance-groups.tar
236+
run: docker load < /tmp/maintenance.tar
235237
##########################################################################
236238
# Upload #################################################################
237239
##########################################################################
@@ -240,11 +242,11 @@ jobs:
240242
- name: Push neo4j
241243
run: docker push --all-tags ocelotsocialnetwork/neo4j-community
242244
- name: Push backend
243-
run: docker push --all-tags ocelotsocialnetwork/backend-groups
245+
run: docker push --all-tags ocelotsocialnetwork/backend
244246
- name: Push webapp
245-
run: docker push --all-tags ocelotsocialnetwork/webapp-groups
247+
run: docker push --all-tags ocelotsocialnetwork/webapp
246248
- name: Push maintenance
247-
run: docker push --all-tags ocelotsocialnetwork/maintenance-groups
249+
run: docker push --all-tags ocelotsocialnetwork/maintenance
248250

249251
##############################################################################
250252
# JOB: KUBERNETES DEPLOY ACTUAL/LATEST VERSION ######################################
@@ -292,27 +294,30 @@ jobs:
292294
# kubectl -n default rollout restart deployment/ocelot-neo4j
293295
- name: Deploy actual version '$BUILD_VERSION' to DigitalOcean Kubernetes
294296
run: |
295-
kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp-groups:$BUILD_VERSION
297+
kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:$BUILD_VERSION
296298
kubectl -n default rollout restart deployment/ocelot-webapp
297-
kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend-groups:$BUILD_VERSION
299+
kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:$BUILD_VERSION
298300
kubectl -n default rollout restart deployment/ocelot-backend
299-
kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance-groups:$BUILD_VERSION
301+
kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:$BUILD_VERSION
300302
kubectl -n default rollout restart deployment/ocelot-maintenance
301303
kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION
302304
kubectl -n default rollout restart deployment/ocelot-neo4j
303305
# because this step 'kubectl -n default rollout status deployment/* --timeout=600s' does not work as expected
304306
# and we need the pods to be up again for cleaning and seeding the Neo4j database and the backend.
305307
# !!! this is not a perfect solution !!!
306-
# deployments are regularely up again after 3 minutes and 10 seconds
308+
# deployments are regularly up again after 3 minutes and 10 seconds
307309
- name: Sleep for 4 minutes, means 240 seconds
308310
run: sleep 240s
309311
shell: bash
310-
- name: Verify deployment and wait for the pods of each deplyment to get ready for cleaning and seeding of the database
312+
- name: Verify deployment and wait for the pods of each deployment to get ready for cleaning and seeding of the database
311313
run: |
312314
kubectl -n default rollout status deployment/ocelot-backend --timeout=600s
313315
kubectl -n default rollout status deployment/ocelot-neo4j --timeout=600s
314316
kubectl -n default rollout status deployment/ocelot-maintenance --timeout=600s
315317
kubectl -n default rollout status deployment/ocelot-webapp --timeout=600s
318+
- name: Run migrations for Neo4j database via backend for staging
319+
run: |
320+
kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "yarn prod:migrate up"
316321
- name: Reset and seed Neo4j database via backend for staging
317322
# db cleaning and seeding is only possible in production if env 'PRODUCTION_DB_CLEAN_ALLOW=true' is set in deployment
318323
run: |

0 commit comments

Comments
 (0)