-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47c9259
commit f72ea0c
Showing
2 changed files
with
16 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 | ||
|
||
|
||
|
@@ -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 }} | ||
|
@@ -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] | ||
|