Skip to content

Commit

Permalink
Restructure workflow and call.
Browse files Browse the repository at this point in the history
Signed-off-by: Wade Barnes <[email protected]>
  • Loading branch information
WadeBarnes committed Jul 18, 2023
1 parent 2ece1fb commit 9947adb
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 87 deletions.
149 changes: 68 additions & 81 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Build and Deploy Audit Image
# - Limit workflow runs to the main repo so it does not try to run on someone else's fork.
on:
workflow_dispatch:
pull_request:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -73,86 +73,73 @@ jobs:
needs: build
permissions:
packages: write
runs-on: ubuntu-latest
environment: dev
uses: ./.github/workflows/reusable_deploy.yml
with:
environment: dev
openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
image_digest: ${{ needs.build.outputs.image_digest }}
namespace: ca7f8f-dev
github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
ROCKETCHAT_TOKEN: ${{ secrets.ROCKETCHAT_TOKEN }}

# deploy2test:
# needs: [build, deploy2dev]
# permissions:
# packages: write
# runs-on: ubuntu-latest
# environment: test

# # ToDo:
# # - Define the 'environment' using an environment variable so it can also be used to define the tags.
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: deploy to test
# uses: ./.github/workflows/actions/deploy
# with:
# environment: test
# password: ${{ secrets.GITHUB_TOKEN }}
# openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
# OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
# image_digest: ${{ needs.build.outputs.image_digest }}
# namespace: ca7f8f-test
# ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
# openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit

# deploy2prod:
# needs: [build, deploy2dev, deploy2test]
# permissions:
# packages: write
# runs-on: ubuntu-latest
# environment: prod

# # ToDo:
# # - Define the 'environment' using an environment variable so it can also be used to define the tags.
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: deploy to prod
# uses: ./.github/workflows/actions/deploy
# with:
# environment: prod
# password: ${{ secrets.GITHUB_TOKEN }}
# openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
# OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
# image_digest: ${{ needs.build.outputs.image_digest }}
# namespace: ca7f8f-prod
# ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
# openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit

# ToDo:
# - Define the 'environment' using an environment variable so it can also be used to define the tags.
steps:
- name: Checkout
uses: actions/checkout@v3

- name: deploy to dev
uses: ./.github/workflows/reusable_deploy.yml
with:
environment: dev
openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
# OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
image_digest: ${{ needs.build.outputs.image_digest }}
namespace: ca7f8f-dev
# ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
# ROCKETCHAT_TOKEN: ${{ inputs.ROCKETCHAT_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
ROCKETCHAT_TOKEN: ${{ secrets.ROCKETCHAT_TOKEN }}

deploy2test:
needs: [build, deploy2dev]
permissions:
packages: write
runs-on: ubuntu-latest
environment: test

# ToDo:
# - Define the 'environment' using an environment variable so it can also be used to define the tags.
steps:
- name: Checkout
uses: actions/checkout@v3

- name: deploy to test
uses: ./.github/workflows/actions/deploy
with:
environment: test
password: ${{ secrets.GITHUB_TOKEN }}
openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
image_digest: ${{ needs.build.outputs.image_digest }}
namespace: ca7f8f-test
ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit

deploy2prod:
needs: [build, deploy2dev, deploy2test]
permissions:
packages: write
runs-on: ubuntu-latest
environment: prod

# ToDo:
# - Define the 'environment' using an environment variable so it can also be used to define the tags.
steps:
- name: Checkout
uses: actions/checkout@v3

- name: deploy to prod
uses: ./.github/workflows/actions/deploy
with:
environment: prod
password: ${{ secrets.GITHUB_TOKEN }}
openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
image_digest: ${{ needs.build.outputs.image_digest }}
namespace: ca7f8f-prod
ROCKETCHAT_WEBHOOK: ${{ secrets.ROCKETCHAT_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_image_name: ghcr.io/bcgov/von-bc-registries-audit/audit
openshift_image_name: image-registry.apps.silver.devops.gov.bc.ca/ca7f8f-tools/audit


12 changes: 6 additions & 6 deletions .github/workflows/reusable_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
environment:
description: the environment to deploy to
required: true
openshift_server_url:
openshift_server_url:
description: openshift server url
required: true
image_digest:
Expand All @@ -21,17 +21,17 @@ on:
required: true
openshift_image_name:
description: openshift image name to be created
required: true
required: true
secrets:
ROCKETCHAT_WEBHOOK:
description: defining the rocket chat webhook url
required: true
ROCKETCHAT_TOKEN:
description: defining the rocket chat token
required: true
# GITHUB_TOKEN:
# description: secret token used to webhook github and rocketchat
# required: true
GH_TOKEN:
description: secret token used to webhook github and rocketchat
required: true
OPENSHIFT_TOKEN:
description: openshift server token
required: true
Expand All @@ -46,7 +46,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GH_TOKEN }}

- name: Setup Openshift CLI
uses: redhat-actions/oc-login@v1
Expand Down

0 comments on commit 9947adb

Please sign in to comment.