Skip to content

Deploy Latest Registry Docker Images (3scale-dev) #2

Deploy Latest Registry Docker Images (3scale-dev)

Deploy Latest Registry Docker Images (3scale-dev) #2

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 }}