Skip to content

Commit

Permalink
update workflow name
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops committed Apr 2, 2024
1 parent 47c9259 commit f72ea0c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 134 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/test-ci-nobuild.yaml

This file was deleted.

52 changes: 16 additions & 36 deletions .github/workflows/test-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
## For each release, the value of workflow name, branches and VERSION need to be adjusted accordingly

name: CTHUB 0.2.0 Test CI

on:
workflow_dispatch:

env:
VERSION: 0.2.0
GIT_URL: https://github.com/bcgov/cthub.git
TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
TEST_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-test


Expand All @@ -19,59 +18,32 @@ concurrency:
jobs:

set-pre-release:
name: Calculate pre-release number
name: Find Dev deployment pre-release number
runs-on: ubuntu-latest

outputs:
output1: ${{ 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 CTHUB
runs-on: ubuntu-latest
needs: set-pre-release
timeout-minutes: 60

env:
PRE_RELEASE: ${{ needs.set-pre-release.outputs.output1 }}

steps:

- name: Check out repository
uses: actions/[email protected]

- 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 }}
namespace: ${{ env.DEV_NAMESPACE }}

- name: Build CTHUB Backend
run: |
cd openshift/templates/backend
oc process -f ./backend-bc.yaml NAME=cthub 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 }}
sleep 5s
oc -n ${{ env.TOOLS_NAMESPACE }} wait --for=condition=Complete --timeout=900s build/cthub-backend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}-1
- name: Build CTHUB Frontend
- id: set-pre-release
run: |
cd openshift/templates/frontend
oc process -f ./frontend-bc-docker.yaml NAME=cthub 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 }}
sleep 5s
oc -n ${{ env.TOOLS_NAMESPACE }} wait --for=condition=Complete --timeout=900s build/cthub-frontend-${{ env.VERSION }}-${{ env.PRE_RELEASE }}-1
echo "PRE_RELEASE=$(oc -n ${{ env.DEV_NAMESPACE }} describe deployment/cthub-dev-frontend | grep Image | awk -F '-' '{print $NF}')" >> $GITHUB_OUTPUT
deploy:

name: Deploy CTHUB on Test
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [set-pre-release, build]
needs: set-pre-release

env:
PRE_RELEASE: ${{ needs.set-pre-release.outputs.output1 }}
Expand All @@ -85,10 +57,18 @@ jobs:
minimum-approvals: 1
issue-title: "CTHUB release-${{ env.VERSION }} Test Deployment"

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

- name: Tag CTHUB images to Test
run: |
oc tag ${{ env.TOOLS_NAMESPACE }}/cthub-backend:${{ env.VERSION }}-$PRE_RELEASE ${{ env.TEST_NAMESPACE }}/cthub-backend:${{ env.VERSION }}-$PRE_RELEASE
oc tag ${{ env.TOOLS_NAMESPACE }}/cthub-frontend:${{ env.VERSION }}-$PRE_RELEASE ${{ env.TEST_NAMESPACE }}/cthub-frontend:${{ env.VERSION }}-$PRE_RELEASE
oc tag ${{ env.DEV_NAMESPACE }}/cthub-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/cthub-backend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
oc tag ${{ env.DEV_NAMESPACE }}/cthub-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }} ${{ env.TEST_NAMESPACE }}/cthub-frontend:${{ env.VERSION }}-${{ env.PRE_RELEASE }}
- name: Checkout Manifest repository
uses: actions/[email protected]
Expand Down

0 comments on commit f72ea0c

Please sign in to comment.