Skip to content

Uspa changes 2024/sow25 n003 7 #82

Uspa changes 2024/sow25 n003 7

Uspa changes 2024/sow25 n003 7 #82

name: Build and Deploy USP in TEST
on:
pull_request:
branches: [ test ]
types: [ closed ]
jobs:
# Print variables for logging and debugging purposes
checkEnv:
name: Check Env variables
runs-on: ubuntu-latest
steps:
- name: Print Env Vars
run: |
echo Git Base Ref: ${{ github.base_ref }}
echo Git Build ID: ${{ github.event.number }}
echo Git Pull Request Ref: ${{ github.event.pull_request.head.sha }}
echo Git Ref Name: ${{ github.ref_name }}
echo OC CLI Version: $(oc version)
# Build USP
build:
name: Build project
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
BUILD_ID: ${{ github.event.number }}
NAMESPACE: fc0a26-test
BUILD_NAMESPACE: fc0a26-tools
BUILD_REF: ${{ github.base_ref }}
HOST_PREFIX: usp
SOURCE_REPOSITORY_BRANCH: test
steps:
# Checkout the PR branch
- name: Print env
run: |
echo BUILD ID: $BUILD_ID
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BRANCH: $BUILD_REF
- name: Checkout Target Branch
uses: actions/checkout@v4
- name: Install OpenShift CLI
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: latest
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
- name: OC Build from yaml
working-directory: "./openshift"
run: |
make oc-build-web
- name: Finished OC Build from yaml
run: |
echo "FINISHED OC BUILD USP"
echo ++++++++++
# Deploy project
deployTest:
name: Deploy Project to TEST
runs-on: ubuntu-latest
if: github.ref_name == 'test'
needs:
- build
env:
BUILD_ID: ${{ github.event.number }}
NAMESPACE: fc0a26-test
BUILD_NAMESPACE: fc0a26-tools
BUILD_REF: ${{ github.base_ref }}
HOST_PREFIX: usp
SOURCE_REPOSITORY_BRANCH: test
steps:
- name: Print env
run: |
echo BUILD ID: $BUILD_ID
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo NAMESPACE: $NAMESPACE
echo BRANCH: $BUILD_REF
echo HOST_PREFIX: $HOST_PREFIX
echo SOURCE_REPOSITORY_BRANCH: $SOURCE_REPOSITORY_BRANCH
# Checkout the PR branch
- name: Checkout Target Branch
uses: actions/checkout@v4
- name: Install OpenShift CLI
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: latest
# Log in to OpenShift.
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK.
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail.
- name: Log in to OpenShift
run: |
oc login --token=${{ secrets.SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443
# Deploy the USP.
- name: Deploy USP Test
working-directory: "./openshift"
run: |
make oc-deploy-web
- name: Finished OC Deploy from yaml
run: |
echo "FINISHED OC Deploy TEST USP"
echo ++++++++++