Skip to content

Manual Deployment to PROD From Main. #43

Manual Deployment to PROD From Main.

Manual Deployment to PROD From Main. #43

name: Manual Deployment to PROD From Main.
#This workflow will just tag docker image from test to the tag number and deploy it to PROD.
on:
workflow_dispatch:
inputs:
RELEASE_VERSION:
required: true
description: The Tag release to PROD. #test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
builds:
name: Builds
uses: ./.github/workflows/_build.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, backend/sites, frontend]
include:
- component: backend/applications
triggers: ('backend/applications/')
- component: backend/gateway
triggers: ('backend/gateway/')
- component: backend/legacy
triggers: ('backend/legacy/')
- component: backend/users
triggers: ('backend/users/')
- component: backend/sites
triggers: ('backend/sites/')
- component: frontend
triggers: ('frontend/')
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
component: ${{ matrix.component }}
img_build: ${{ inputs.RELEASE_VERSION }}
img_fallback: "test" # The test image will be tagged with prod release version as in input.
triggers: ${{ matrix.triggers }}
deploys:
name: Deploys
needs:
- builds
# If any of the previous created a build, then deploy
# if: contains(needs.*.outputs.build, 'true')
uses: ./.github/workflows/_deploy.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, backend/sites, database, frontend]
include:
- component: database
overwrite: false
template_file: .github/openshift/deploy.database.yml
template_vars: -p DB_PVC_SIZE=200Mi
- component: backend/applications
overwrite: true
template_file: .github/openshift/deploy.backend-applications.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/applications -p CONTAINER_PORT=4006 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/gateway
overwrite: true
template_file: .github/openshift/deploy.backend-gateway.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/gateway -p CONTAINER_PORT=4010 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/legacy
overwrite: true
template_file: .github/openshift/deploy.backend-legacy.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/legacy -p CONTAINER_PORT=4011 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/users
overwrite: true
template_file: .github/openshift/deploy.backend-users.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/users -p CONTAINER_PORT=4005 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: backend/sites
overwrite: true
template_file: .github/openshift/deploy.backend-sites.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/sites -p CONTAINER_PORT=4006 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
- component: frontend
overwrite: true
template_file: .github/openshift/deploy.frontend.yml
template_vars: -p PROMOTE=${{ github.repository }}/frontend -p CONTAINER_PORT=8080 -p ENV=prod -p IMAGE_TAG=${{ inputs.RELEASE_VERSION }} -p MIN_REPLICAS=3 -p MAX_REPLICAS=6
secrets:
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
with:
environment: prod
component: ${{ matrix.component }}
overwrite: ${{ matrix.overwrite }}
template_file: ${{ matrix.template_file }}
template_vars: ${{ matrix.template_vars }}
tag:
name: Create The Production Release Tag
runs-on: ubuntu-22.04
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: release/${{ inputs.RELEASE_VERSION }}
release_name: Release release/${{ inputs.RELEASE_VERSION }}
body: |
Changes in this Release
- Test release notes
draft: false
prerelease: false
# steps:
# - uses: rickstaa/action-create-tag@v1
# name: Create Release Tag in Git
# with:
# tag: "release/${{ inputs.RELEASE_VERSION }}"
# message: "Release version ${{ inputs.RELEASE_VERSION }}"
forms-flow-root-config-and-microfrontends-bpm-changes:
runs-on: ubuntu-20.04
if: github.repository == 'bcgov/nr-epd-digital-services'
steps:
- uses: actions/checkout@v2
- name: Set ENV variables
id: set-variable
# make sure to update the TOOLS_NAME once all the environment for forms-flow-ai-web is ready
run: |
echo "For ${{ github.ref_name }} branch for PROD"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="prod"" >> $GITHUB_ENV
echo "BRANCH_NAME="main"" >> $GITHUB_ENV
echo "ENV_NAME="prod"" >> $GITHUB_ENV
shell: bash
- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OC_SERVER}} --token=${{secrets.OC_TOKEN}}
- name: Tools project
shell: bash
run: |
oc project ${{ secrets.OC_NAMESPACE_NAMEPLATE }}-tools
- name: Tag Microfrontends from Test
shell: bash
run: |
oc tag forms-flow-nav:test forms-flow-nav:prod
oc tag forms-flow-theme:test forms-flow-theme:prod
oc tag forms-flow-web-ee:test forms-flow-web-ee:prod
oc tag forms-flow-bpm:test forms-flow-bpm:prod
- name: Start Build Openshift
shell: bash
run: |
oc start-build forms-flow-web-root-config-prod-build --wait