update git ref #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## For each release, please update the value of workflow name, branches and PRE_RELEASE | |
## Also update frontend/package.json version | |
name: Emergency Release Build 1.64.1 | |
on: | |
push: | |
branches: [release-1.64.1] | |
workflow_dispatch: | |
workflow_call: | |
env: | |
## The pull request number of the Tracking pull request to merge the release branch to main | |
VERSION: 1.64.1 | |
GIT_URL: https://github.com/bcgov/zeva.git | |
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools | |
TEST_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-test | |
PROD_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-prod | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
install-oc: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-hit: ${{ steps.cache.outputs.cache-hit }} | |
steps: | |
- name: Set up cache for OpenShift CLI | |
id: cache | |
uses: actions/[email protected] | |
with: | |
path: /usr/local/bin/oc # Path where the `oc` binary will be installed | |
key: oc-cli-${{ runner.os }} | |
- name: Install OpenShift CLI (if not cached) | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz | |
tar -xvf openshift-client-linux.tar.gz | |
sudo mv oc /usr/local/bin/ | |
oc version --client | |
- name: Confirm OpenShift CLI is Available | |
run: oc version --client | |
set-pre-release: | |
name: Calculate pre-release number | |
runs-on: ubuntu-latest | |
needs: [install-oc] | |
outputs: | |
PRE_RELEASE: ${{ steps.set-pre-release.outputs.PRE_RELEASE }} | |
steps: | |
- id: set-pre-release | |
run: | | |
echo "PRE_RELEASE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
build: | |
name: Build ZEVA on Openshift | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
needs: [set-pre-release] | |
env: | |
PRE_RELEASE: ${{ needs.set-pre-release.outputs.PRE_RELEASE }} | |
steps: | |
- name: Check out repository | |
uses: actions/[email protected] | |
with: | |
ref: release-${{ ENV.VERSION }} | |
- name: Restore oc command from Cache | |
uses: actions/[email protected] | |
with: | |
path: /usr/local/bin/oc | |
key: oc-cli-${{ runner.os }} | |
- name: Log in to Openshift | |
uses: redhat-actions/[email protected] | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
insecure_skip_tls_verify: true | |
namespace: ${{ env.TOOLS_NAMESPACE }} | |
- name: Build ZEVA Backend | |
run: | | |
cd openshift/templates/backend | |
oc process -f ./backend-bc-docker.yaml NAME=zeva SUFFIX=-${{ env.VERSION }}-${{ env.PRE_RELEASE }} VERSION=${{ env.VERSION }}-${{ env.PRE_RELEASE }} GIT_URL=${{ env.GIT_URL }} GIT_REF=release-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }} | |
oc start-build --wait=true zeva-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} | |
- name: Build ZEVA Frontend | |
run: | | |
cd openshift/templates/frontend | |
oc process -f ./frontend-bc-docker.yaml NAME=zeva SUFFIX=-build-${{ env.PRE_RELEASE }} VERSION=build-${{ env.VERSION }}-${{ env.PRE_RELEASE }} GIT_URL=${{ env.GIT_URL }} GIT_REF=release-${{ env.VERSION }} | oc apply --wait=true -f - -n ${{ env.TOOLS_NAMESPACE }} | |
oc start-build --wait=true zeva-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }} | |
# deploy-on-test: | |
# name: Deploy ZEVA on Test | |
# runs-on: ubuntu-latest | |
# timeout-minutes: 60 | |
# needs: build | |
# steps: | |
# - name: Check out repository | |
# uses: actions/[email protected] | |
# with: | |
# ref: refs/pull/${{ env.PRE_RELEASE }}/head | |
# - name: Log in to Openshift | |
# uses: redhat-actions/[email protected] | |
# with: | |
# openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
# openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
# insecure_skip_tls_verify: true | |
# namespace: ${{ env.TOOLS_NAMESPACE }} | |
# - name: Ask for approval for ZEVA Test deployment | |
# uses: trstringer/[email protected] | |
# with: | |
# secret: ${{ github.TOKEN }} | |
# approvers: AlexZorkin,emi-hi,tim738745,kuanfandevops,prv-proton | |
# minimum-approvals: 1 | |
# issue-title: "ZEVA ${{ env.VERSION }} Test Deployment" | |
# - name: Tag Backend Image from tools to Test | |
# run: | | |
# oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:build-${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/zeva-backend:test-${{ env.VERSION }} | |
# - name: Tag Frontend Image from tools to Test | |
# run: | | |
# oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:build-${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/zeva-frontend:test-${{ env.VERSION }} | |
# # helm status will show an error if the helm release doesn't exist. The error will be ignored. | |
# - name: Deploy zeva-frontend on Test | |
# shell: bash {0} | |
# run: | | |
# cd charts/zeva-apps/charts/zeva-frontend | |
# helm status -n ${{ env.TEST_NAMESPACE }} zeva-frontend-test | |
# if [ $? -eq 0 ]; then | |
# echo "zeva-frontend-test release exists already" | |
# helm upgrade --install --set frontendImageTagname=test-${{ env.VERSION }},openshiftLicensePlate=${{ secrets.OPENSHIFT_NAMESPACE_PLATE }} -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml zeva-frontend-test . | |
# else | |
# echo "zeva-frontend-test release does not exist" | |
# helm install --set frontendImageTagname=test-${{ env.VERSION }},openshiftLicensePlate=${{ secrets.OPENSHIFT_NAMESPACE_PLATE }} -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml zeva-frontend-test . | |
# fi | |
# # helm status will show an error if the helm release doesn't exist. The error will be ignored. | |
# - name: Deply zeva-backend on Test | |
# shell: bash {0} | |
# run: | | |
# cd charts/zeva-apps/charts/zeva-backend | |
# helm status -n ${{ env.TEST_NAMESPACE }} zeva-backend-test | |
# if [ $? -eq 0 ]; then | |
# echo "zeva-backend-test release exists already" | |
# helm upgrade --set backendImageTagname=test-${{ env.VERSION }} -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml zeva-backend-test . | |
# else | |
# echo "zeva-backend-test release does not exist" | |
# helm install --set backendImageTagname=test-${{ env.VERSION }} -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml zeva-backend-test . | |
# fi | |
# deploy-on-prod: | |
# name: Deploy ZEVA on Prod | |
# runs-on: ubuntu-latest | |
# timeout-minutes: 60 | |
# needs: deploy-on-test | |
# steps: | |
# - name: Check out repository | |
# uses: actions/[email protected] | |
# with: | |
# ref: refs/pull/${{ env.PRE_RELEASE }}/head | |
# - name: Log in to Openshift | |
# uses: redhat-actions/[email protected] | |
# with: | |
# openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
# openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
# insecure_skip_tls_verify: true | |
# namespace: ${{ env.TOOLS_NAMESPACE }} | |
# - name: Ask for approval for ZEVA Prod deployment | |
# uses: trstringer/[email protected] | |
# with: | |
# secret: ${{ github.TOKEN }} | |
# approvers: AlexZorkin,kuanfandevops,tim738745,emi-hi | |
# minimum-approvals: 1 | |
# issue-title: "ZEVA ${{ env.VERSION }} Prod Deployment" | |
# - name: Tag Frontend Image from tools to Prod | |
# run: | | |
# oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-frontend:build-${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.PROD_NAMESPACE }}/zeva-frontend:prod-${{ env.VERSION }} | |
# - name: Tag Backend Image from tools to Prod | |
# run: | | |
# oc tag ${{ env.TOOLS_NAMESPACE }}/zeva-backend:build-${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.PROD_NAMESPACE }}/zeva-backend:prod-${{ env.VERSION }} | |
# - name: Deply zeva-frontend on Prod | |
# shell: bash {0} | |
# run: | | |
# cd charts/zeva-apps/charts/zeva-frontend | |
# helm status -n ${{ env.PROD_NAMESPACE }} zeva-frontend-prod | |
# if [ $? -eq 0 ]; then | |
# echo "zeva-frontend-prod release exists already" | |
# helm upgrade --set frontendImageTagname=prod-${{ env.VERSION }},openshiftLicensePlate=${{ secrets.OPENSHIFT_NAMESPACE_PLATE }} -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml zeva-frontend-prod . | |
# else | |
# echo "zeva-frontend-prod release does not exist" | |
# helm install --set frontendImageTagname=prod-${{ env.VERSION }},openshiftLicensePlate=${{ secrets.OPENSHIFT_NAMESPACE_PLATE }} -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml zeva-frontend-prod . | |
# fi | |
# - name: Deply zeva-backend on Prod | |
# shell: bash {0} | |
# run: | | |
# cd charts/zeva-apps/charts/zeva-backend | |
# helm status -n ${{ env.PROD_NAMESPACE }} zeva-backend-prod | |
# if [ $? -eq 0 ]; then | |
# echo "zeva-backend-prod release exists already" | |
# helm upgrade --set backendImageTagname=prod-${{ env.VERSION }} -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml zeva-backend-prod . | |
# else | |
# echo "zeva-backend-prod release does not exist" | |
# helm install --set backendImageTagname=prod-${{ env.VERSION }} -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml zeva-backend-prod . | |
# fi |