Skip to content

Commit

Permalink
Introducing new parameter that is derived from github variables - ROU…
Browse files Browse the repository at this point in the history
…TE_PREFIX. This var is used when the route gets created. The route need to use domain name that is unique within OpenShift environment. Previously we were using hardcoded value of :chefs" - env.acronym.
  • Loading branch information
evgeny-pluzhnikov committed Jul 27, 2023
1 parent 0049a94 commit 01efe39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/actions/deploy-to-environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
acronym:
description: Application acronym
required: true
route_prefix:
description: Application domain prefix
required: true
environment:
description: Logical Github Environment
required: true
Expand Down Expand Up @@ -81,9 +84,9 @@ runs:
shell: bash
run: |
if [[ "${{ inputs.job_name }}" == pr-* ]]; then
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/app.dc.yaml -p REPO_NAME=${{ inputs.app_name }} -p JOB_NAME=${{ inputs.job_name }} -p NAMESPACE=${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -p APP_NAME=${{ inputs.acronym }} -p IMAGE_TAG=sha-$(git rev-parse --short HEAD) -p ROUTE_HOST=${{ inputs.acronym }}-${{ inputs.namespace_environment }}.apps.silver.devops.gov.bc.ca -p ROUTE_PATH=${{ inputs.route_path }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/app.dc.yaml -p REPO_NAME=${{ inputs.app_name }} -p JOB_NAME=${{ inputs.job_name }} -p NAMESPACE=${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -p APP_NAME=${{ inputs.acronym }} -p IMAGE_TAG=sha-$(git rev-parse --short HEAD) -p ROUTE_HOST=${{ inputs.route_prefix }}-${{ inputs.namespace_environment }}.apps.silver.devops.gov.bc.ca -p ROUTE_PATH=${{ inputs.route_path }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
else
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/app.dc.yaml -p REPO_NAME=${{ inputs.app_name }} -p JOB_NAME=${{ inputs.job_name }} -p NAMESPACE=${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -p APP_NAME=${{ inputs.acronym }} -p IMAGE_TAG=sha-$(git rev-parse --short HEAD) -p ROUTE_HOST=${{ inputs.acronym }}-${{ inputs.namespace_environment }}.apps.silver.devops.gov.bc.ca -p ROUTE_PATH=${{ inputs.route_path }} --param-file=openshift/app.${{ inputs.namespace_environment }}.param -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/app.dc.yaml -p REPO_NAME=${{ inputs.app_name }} -p JOB_NAME=${{ inputs.job_name }} -p NAMESPACE=${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -p APP_NAME=${{ inputs.acronym }} -p IMAGE_TAG=sha-$(git rev-parse --short HEAD) -p ROUTE_HOST=${{ inputs.route_prefix }}-${{ inputs.namespace_environment }}.apps.silver.devops.gov.bc.ca -p ROUTE_PATH=${{ inputs.route_path }} --param-file=openshift/app.${{ inputs.namespace_environment }}.param -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f -
fi
- name: Wait on App
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_pr_opened.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
server_host: ${{ vars.SERVER_HOST }}
route_path: /pr-${{ github.event.number }}
route_prefix: ${{ vars.ROUTE_PREFIX }}
- name: Release Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
if: success()
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
server_host: ${{ vars.SERVER_HOST }}
route_path: /app
route_prefix: ${{ vars.ROUTE_PREFIX }}

deploy-test:
name: Deploy to Test
Expand Down Expand Up @@ -82,6 +83,7 @@ jobs:
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
server_host: ${{ vars.SERVER_HOST }}
route_path: /app
route_prefix: ${{ vars.ROUTE_PREFIX }}

deploy-prod:
name: Deploy to Prod
Expand Down Expand Up @@ -110,3 +112,4 @@ jobs:
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
server_host: ${{ vars.SERVER_HOST }}
route_path: /app
route_prefix: ${{ vars.ROUTE_PREFIX }}

0 comments on commit 01efe39

Please sign in to comment.