Skip to content

Commit

Permalink
Merge pull request #45 from bcgov/5492-release-process
Browse files Browse the repository at this point in the history
5492 release process
  • Loading branch information
pankaj-cgi authored Feb 9, 2022
2 parents ed5b193 + 06025f7 commit 59d7d8e
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 428 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/DevEnv-backend-BuildImageAndPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: DevEnv-backend-BuildImageAndPush
# Build the image and deploy in OpenShift environment
env:
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
TOOLSNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
DEVNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-dev
IMAGE_REGISTRY_USER: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_USER }}
IMAGE_REGISTRY_PASSWORD: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_TOKEN }}
IMAGE_NAME: mspdirect-backend
Expand Down Expand Up @@ -37,7 +38,7 @@ jobs:
- name: Determine image tags
if: env.IMAGE_TAGS == ''
run: |
echo "IMAGE_TAGS=latest ${GITHUB_SHA::12} mspdirect-dev" | tee -a $GITHUB_ENV
echo "IMAGE_TAGS=${GITHUB_SHA::12}" | tee -a $GITHUB_ENV
# Build from docker file
Expand All @@ -51,13 +52,24 @@ jobs:
dockerfiles: |
./backend/Dockerfile
- name: Push to registry
id: push-image
- name: Push to tools registry
id: push-image-tools
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
registry: ${{ env.TOOLSNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}


- name: Push to dev registry
id: push-image-dev
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.DEVNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

Expand Down Expand Up @@ -85,7 +97,7 @@ jobs:
if: ${{ success() }}
run: |
cd mspdirect-devops/overlays/dev
kustomize edit set image "backend-image=image-registry.openshift-image-registry.svc:5000/c5839f-tools/${{ env.IMAGE_NAME }}@${{ steps.push-image.outputs.digest }}"
kustomize edit set image "backend-image=image-registry.openshift-image-registry.svc:5000/c5839f-dev/${{ env.IMAGE_NAME }}@${{ steps.push-image-dev.outputs.digest }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update Backend API image ID for Dev"
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/DevEnv-frontend-BuildImageAndPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: DevEnv-frontend-BuildImageAndPush
# Build the image and deploy in OpenShift environment
env:
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
DEVNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-dev
TOOLSNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
IMAGE_REGISTRY_USER: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_USER }}
IMAGE_REGISTRY_PASSWORD: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_TOKEN }}
IMAGE_NAME: mspdirect-frontend
IMAGE_TAGS:
IMAGE_TAGS:

on:
# Run the workflow manually, instead of on a push.
Expand Down Expand Up @@ -39,8 +40,7 @@ jobs:
- name: Determine image tags
if: env.IMAGE_TAGS == ''
run: |
echo "IMAGE_TAGS=latest ${GITHUB_SHA::12} mspdirect-dev" | tee -a $GITHUB_ENV
echo "IMAGE_TAGS=${GITHUB_SHA::12}" | tee -a $GITHUB_ENV
# Build from docker file
- name: Build from Dockerfile
Expand All @@ -54,16 +54,27 @@ jobs:
dockerfiles: |
./frontend/Dockerfile
- name: Push to registry
id: push-image
- name: Push to tools registry
id: push-image-tools
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
registry: ${{ env.TOOLSNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}


- name: Push to Dev registry
id: push-image-dev
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.DEVNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

# Update the image ID in the manifest repository used by Argo CD.
# We need to use the SSH deploy key to check out the manifest repo, set up
# Kustomize in the runner, update the image ID, commit the change, and
Expand All @@ -88,7 +99,7 @@ jobs:
if: ${{ success() }}
run: |
cd mspdirect-devops/overlays/dev
kustomize edit set image "frontend-image=image-registry.openshift-image-registry.svc:5000/c5839f-tools/${{ env.IMAGE_NAME }}@${{ steps.push-image.outputs.digest }}"
kustomize edit set image "frontend-image=image-registry.openshift-image-registry.svc:5000/c5839f-dev/${{ env.IMAGE_NAME }}@${{ steps.push-image-dev.outputs.digest }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update frontend API image ID for Dev"
Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/TestEnv-backend-BuildImageAndPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: TestEnv-backend-BuildImageAndPush
# Build the image and deploy in OpenShift environment
env:
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
TOOLSNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
TESTNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-test
IMAGE_REGISTRY_USER: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_USER }}
IMAGE_REGISTRY_PASSWORD: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_TOKEN }}
IMAGE_NAME: mspdirect-backend
Expand All @@ -14,18 +15,18 @@ on:
# API build config.
# --------------------------------------------------------------------------

# workflow_dispatch:
# inputs:
# branch:
# description: 'Enter branch name:'
# required: true
# default: main

push:
branches: [ main ]
paths:
- "backend/**"

workflow_dispatch:
# inputs:
# branch:
# description: 'Enter branch name:'
# required: true
# default: main

jobs:

buildAndPush:
Expand Down Expand Up @@ -57,13 +58,23 @@ jobs:
dockerfiles: |
./backend/Dockerfile
- name: Push to registry
id: push-image
- name: Push to tools registry
id: push-image-tools
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.TOOLSNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

- name: Push to test registry
id: push-image-test
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
registry: ${{ env.TESTNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

Expand Down Expand Up @@ -91,7 +102,7 @@ jobs:
if: ${{ success() }}
run: |
cd mspdirect-devops/overlays/test
kustomize edit set image "backend-image=image-registry.openshift-image-registry.svc:5000/c5839f-tools/${{ env.IMAGE_NAME }}@${{ steps.push-image.outputs.digest }}"
kustomize edit set image "backend-image=image-registry.openshift-image-registry.svc:5000/c5839f-test/${{ env.IMAGE_NAME }}@${{ steps.push-image-test.outputs.digest }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update Backend API image ID for test"
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/TestEnv-frontend-BuildImageAndPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: TestEnv-frontend-BuildImageAndPush
# Build the image and deploy in OpenShift environment
env:
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
TOOLSNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-tools
TESTNS_IMAGE_REGISTRY: image-registry.apps.silver.devops.gov.bc.ca/c5839f-test
IMAGE_REGISTRY_USER: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_USER }}
IMAGE_REGISTRY_PASSWORD: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_TOKEN }}
IMAGE_NAME: mspdirect-frontend
Expand All @@ -13,6 +14,8 @@ on:
branches: [ main ]
paths:
- "frontend/**"

workflow_dispatch:

jobs:

Expand Down Expand Up @@ -46,13 +49,23 @@ jobs:
dockerfiles: |
./frontend/Dockerfile
- name: Push to registry
id: push-image
- name: Push to tools registry
id: push-image-tools
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.TOOLSNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

- name: Push to test registry
id: push-image-test
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-docker.outputs.image }}
tags: ${{ steps.build-docker.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
registry: ${{ env.TESTNS_IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}

Expand Down Expand Up @@ -80,7 +93,7 @@ jobs:
if: ${{ success() }}
run: |
cd mspdirect-devops/overlays/test
kustomize edit set image "frontend-image=image-registry.openshift-image-registry.svc:5000/c5839f-tools/${{ env.IMAGE_NAME }}@${{ steps.push-image.outputs.digest }}"
kustomize edit set image "frontend-image=image-registry.openshift-image-registry.svc:5000/c5839f-test/${{ env.IMAGE_NAME }}@${{ steps.push-image-test.outputs.digest }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update frontend API image ID for Test"
Expand Down
Loading

0 comments on commit 59d7d8e

Please sign in to comment.