Skip to content

Commit

Permalink
Merge pull request #42 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 1, 2022
2 parents d581d58 + 222542d commit 888d4a9
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 1 deletion.
123 changes: 123 additions & 0 deletions .github/workflows/mspdirect-release-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This is a manual workflow that performs following activities:
# 1. Determine the version number tag i.e. Release_1.0_<branch-name>_<build execution>
# 2. Edit .env in frontend with the value
# 3. Creates images for frontend and backend code
# 4. Tags the images with release number
# 5. Tags the images with additional tags if any
# 6. Upload the images in image repository in tools namespace

name: mspdirect-release-draft
# 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
IMAGE_REGISTRY_USER: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_USER }}
IMAGE_REGISTRY_PASSWORD: ${{ secrets.C5839F_OPENSHIFT_GITHUB_ACTIONS_SA_TOKEN }}
IMAGE_NAME_BACKEND: mspdirect-backend
IMAGE_NAME_FRONTEND: mspdirect-frontend
IMAGE_TAGS:


on:
# Run the workflow manually, instead of on a push.
# The user specifies the optional tag
# --------------------------------------------------------------------------

workflow_dispatch:
inputs:
OPTIONAL_TAG:
description: 'Enter any optional tag name, For example Sprint-20'
required: false
default:

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

jobs:

createMSPDirectRelease:
runs-on: ubuntu-latest

steps:
# Check out the code
- name: Check out code
id: checkout
uses: actions/checkout@v2
with:
ref: main

# 1. Determine the version number tag i.e. Release_1.0_<branch-name>_<build execution>
- name: Determine image tags
if: env.IMAGE_TAGS == ''
# Branch name is fixed to 'main' in version identifier
run: |
echo "RELEASE_VERSION= Release_1.0_main_${{github.run_number}} " | tee -a $GITHUB_ENV
echo "IMAGE_TAGS= ${GITHUB_SHA::12} ${{env.RELEASE_VERSION}} ${{ github.event.inputs.OPTIONAL_TAG }} " | tee -a $GITHUB_ENV
echo "Final tags are ${{env.IMAGE_TAGS}}"
echo "Final Release version is ${{env.RELEASE_VERSION}}"
# 2. Edit .env in frontend with the value
- name: Edit env file to add version
#
run: |
echo "Current path is"
pwd
cd ./moh-hnweb/frontend/env_config
sed -i 's/[VER]]/${{env.RELEASE_VERSION}}/' .env.dev
echo "RELEASE_VERSION= Release_1.0_main_${{github.run_number}} " | tee -a $GITHUB_ENV
echo "IMAGE_TAGS= ${GITHUB_SHA::12} ${{env.RELEASE_VERSION}} ${{ github.event.inputs.OPTIONAL_TAG }} " | tee -a $GITHUB_ENV
echo "Final tags are ${{env.IMAGE_TAGS}}"
# # Build from docker file
# - name: Build from Dockerfile
# id: build-docker
# uses: redhat-actions/buildah-build@v2
# with:
# image: ${{ env.IMAGE_NAME }}
# tags: ${{ env.IMAGE_TAGS }}
# context: ./backend
# dockerfiles: |
# ./backend/Dockerfile

# - name: Push to registry
# id: push-image
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-docker.outputs.image }}
# tags: ${{ steps.build-docker.outputs.tags }}
# registry: ${{ env.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
# # push the changes back to the manifest repository.
# # ------------------------------------------------------------------------
# - name: Prepare deploy key
# uses: webfactory/ssh-agent@v0.5.3
# with:
# ssh-private-key: ${{ secrets.GITOPS_C5839F_PRIVATE_KEY }}

# - name: Check out manifest repo
# uses: actions/checkout@v2
# with:
# ssh-key: ${{ secrets.GITOPS_C5839F_PRIVATE_KEY }}
# repository: ${{ secrets.GITOPS_C5839F_REPO }}
# ref: main

# - name: Set up Kustomize
# uses: imranismail/setup-kustomize@v1

# - name: Update image ID and commit change
# 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 }}"
# 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"
# git push origin
2 changes: 1 addition & 1 deletion frontend/env_config/.env.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Environment configurations for OpenShift dev environment
VITE_APP_TITLE=HN Web (Dev)
VITE_APP_TITLE=HN Web (Dev) - [VER]
VITE_KEYCLOAK_URL=https://common-logon-dev.hlth.gov.bc.ca/auth/
VITE_SITEMINDER_LOGOUT=https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://mspdirect-dev.apps.silver.devops.gov.bc.ca
VITE_SERVICE_URL=https://mspdirect-dev-api.apps.silver.devops.gov.bc.ca/

0 comments on commit 888d4a9

Please sign in to comment.