Skip to content

Update argfiles for PRs for DB name and tails #2665

Update argfiles for PRs for DB name and tails

Update argfiles for PRs for DB name and tails #2665

Workflow file for this run

name: Install/upgrade PR Instance
on:
pull_request:
branches:
- main
paths:
- "plugins/**"
- "services/tenant-ui/**"
- "charts/traction/**"
- "charts/tenant-ui/**"
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
ready:
name: "Install if ready for review"
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.ready_for_review.outputs.true_false }}
build: ${{ steps.ready_for_review.outputs.bcgov_true_false }}
steps:
- id: ready_for_review
run: |
echo "true_false=${{ toJSON(github.event.pull_request.draft != true && github.repository_owner == 'bcgov') }}" >> $GITHUB_OUTPUT
echo "bcgov_true_false=${{ toJSON(github.repository_owner == 'bcgov') }}" >> $GITHUB_OUTPUT
build_ui:
name: "Build Tenant UI"
runs-on: ubuntu-latest
if: ${{ always() && fromJSON(needs.ready.outputs.build) == true }}
needs:
- ready
steps:
- uses: actions/checkout@v4
- name: Build UI
uses: ./.github/actions/build_ui
id: builder
with:
context: "./services/tenant-ui"
image_name: ${{ github.repository_owner}}/traction-tenant-ui
registry: ghcr.io
registry_username: ${{ github.repository_owner}}
registry_password: ${{ secrets.GITHUB_TOKEN }}
outputs:
image_tag: ${{ steps.builder.outputs.image_tag }}
image_version: ${{ steps.builder.outputs.image_version }}
buildtime: ${{ steps.builder.outputs.buildtime }}
build_acapy:
name: "Build Traction Aca-Py"
runs-on: ubuntu-latest
if: ${{ always() && fromJSON(needs.ready.outputs.build) == true }}
needs:
- ready
steps:
- uses: actions/checkout@v4
- name: Build Aca-Py Image
uses: ./.github/actions/build_acapy
id: builder
with:
context: "./plugins"
dockerfile: "./plugins/docker/Dockerfile"
image_name: ${{ github.repository_owner}}/traction-plugins-acapy
registry: ghcr.io
registry_username: ${{ github.repository_owner}}
registry_password: ${{ secrets.GITHUB_TOKEN }}
outputs:
image_tag: ${{ steps.builder.outputs.image_tag }}
build_proxy:
name: "Build Traction Tenant Proxy"
runs-on: ubuntu-latest
if: ${{ always() && fromJSON(needs.ready.outputs.build) == true }}
needs:
- ready
steps:
- uses: actions/checkout@v4
- name: Build Tenant Proxy Image
uses: ./.github/actions/build_acapy
id: builder
with:
context: "./plugins"
dockerfile: "./plugins/docker/Dockerfile.tenant-proxy"
image_name: ${{ github.repository_owner}}/traction-tenant-proxy
registry: ghcr.io
registry_username: ${{ github.repository_owner}}
registry_password: ${{ secrets.GITHUB_TOKEN }}
outputs:
image_tag: ${{ steps.builder.outputs.image_tag }}
deploy:
name: Deploy PR
environment: development
runs-on: ubuntu-latest
needs:
- ready
- build_ui
- build_acapy
- build_proxy
if: ${{ always() && (fromJSON(needs.ready.outputs.deploy) == true) && !(contains(needs.*.result, 'failure')) }}
steps:
- uses: actions/checkout@v4
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4.14"
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
certificate_authority_data: ${{ secrets.OPENSHIFT_CA_CRT }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
- name: Run Traction PR Helm
run: |
helm upgrade --install pr-${{ github.event.number }}-traction -f ./deploy/traction/values-pr.yaml --set acapy.image.tag=pr-${{ github.event.number }} --set tenant_proxy.image.tag=pr-${{ github.event.number }} --set ui.image.tag=pr-${{ github.event.number }} ./charts/traction --wait
- name: Restart Traction PR Pods
run: |
oc rollout restart deployment/pr-${{ github.event.number }}-traction-acapy
oc rollout restart deployment/pr-${{ github.event.number }}-traction-tenant-proxy
oc rollout restart deployment/pr-${{ github.event.number }}-traction-tenant-ui
deploymenturls:
name: Deployment URLs comment
runs-on: ubuntu-latest
needs:
- deploy
if: ${{ (fromJSON(needs.ready.outputs.deploy) == true) && !(contains(needs.*.result, 'failure')) }}
steps:
- uses: actions/checkout@v4
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: "github-actions[bot]"
body-includes: Deployment URLs ready for review.
- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.number }}
body: |
| Deployment | Resource | Location |
| --- | --- | --- |
| Traction | |
| | Tenant UI | https://pr-${{ github.event.number }}-traction-tenant-ui-dev.apps.silver.devops.gov.bc.ca |
| | Innkeeper UI | https://pr-${{ github.event.number }}-traction-tenant-ui-dev.apps.silver.devops.gov.bc.ca/innkeeper |
| Aca-Py | | |
| | Admin Swagger | https://pr-${{ github.event.number }}-traction-acapy-admin-dev.apps.silver.devops.gov.bc.ca/api/doc |
| | Tenant Proxy Swagger | https://pr-${{ github.event.number }}-traction-tenant-proxy-dev.apps.silver.devops.gov.bc.ca/api/doc |
Deployment URLs ready for review.