Banner 806 #1963
Workflow file for this run
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
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@v3 | |
- 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@v3 | |
- 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@v3 | |
- 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@v3 | |
- 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 traction_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@v3 | |
- name: Find Comment | |
uses: peter-evans/find-comment@v1 | |
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@v1 | |
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. |