-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (86 loc) · 3.48 KB
/
deploy_latest_registry.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
89
90
91
92
93
94
95
96
97
98
name: Deploy Latest Registry Docker Images (3scale-dev)
on:
workflow_dispatch:
workflow_call:
secrets:
ACCESS_TOKEN:
required: true
GOOGLE_CHAT_WEBHOOK:
required: true
jobs:
deploy-latest-registry:
name: Deploy Latest Registry Image
runs-on: ubuntu-latest
if: github.repository_owner == 'apicurio'
env:
API_IMAGE: quay.io/apicurio/apicurio-registry-sql
UI_IMAGE: quay.io/apicurio/apicurio-registry-ui
IMAGE_TAG: latest-snapshot
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get digest (API)
run: |
docker pull ${{ env.API_IMAGE }}:${{ env.IMAGE_TAG }}
docker image inspect ${{ env.API_IMAGE }}:${{ env.IMAGE_TAG }}
REGISTRY_API_DOCKER_IMAGE=$(docker image inspect --format='{{index .RepoDigests 0}}' ${{ env.API_IMAGE }}:${{ env.IMAGE_TAG }})
echo "REGISTRY_API_DOCKER_IMAGE=$REGISTRY_API_DOCKER_IMAGE" >> $GITHUB_ENV
- name: Get digest (UI)
run: |
docker pull quay.io/apicurio/apicurio-registry-ui:latest-snapshot
docker image inspect quay.io/apicurio/apicurio-registry-ui:latest-snapshot
REGISTRY_UI_DOCKER_IMAGE=$(docker image inspect --format='{{index .RepoDigests 0}}' quay.io/apicurio/apicurio-registry-ui:latest-snapshot)
echo "REGISTRY_UI_DOCKER_IMAGE=$REGISTRY_UI_DOCKER_IMAGE" >> $GITHUB_ENV
- name: Echo the Docker Images
run: |
echo "API image: $REGISTRY_API_DOCKER_IMAGE"
echo " UI image: $REGISTRY_UI_DOCKER_IMAGE"
- name: Code Checkout
run: |
mkdir repo
cd repo
git init
git config --global user.name "apicurio-ci"
git config --global user.email "[email protected]"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-3scale-gitops.git"
git fetch
git checkout main
git branch --set-upstream-to=origin/main
git pull
- name: Update API Docker Image
run: |
npm install -g yaml-cli
cd repo/applications/apicurio-registry/
yaml set deployment-api.yaml spec.template.spec.containers.0.image ${{ env.REGISTRY_API_DOCKER_IMAGE }} > deployment-api-NEW.yaml
rm deployment-api.yaml
mv deployment-api-NEW.yaml deployment-api.yaml
- name: Update UI Docker Image
run: |
cd repo/applications/apicurio-registry/
yaml set deployment-ui.yaml spec.template.spec.containers.0.image ${{ env.REGISTRY_UI_DOCKER_IMAGE }} > deployment-ui-NEW.yaml
rm deployment-ui.yaml
mv deployment-ui-NEW.yaml deployment-ui.yaml
- name: Verify Changed Deployment
run: |
cd repo
echo "---"
find . -name 'deployment*.yaml'
echo "---"
cat applications/apicurio-registry/deployment-api.yaml
echo "---"
cat applications/apicurio-registry/deployment-ui.yaml
echo "---"
- name: Commit Changes
run: |
cd repo
git add .
git commit -m 'Automatic upgrade of Registry container images.'
git push origin main
- name: Google Chat Notification
if: always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}