Skip to content

chore: try out matrix with outputs #262

chore: try out matrix with outputs

chore: try out matrix with outputs #262

Workflow file for this run

name: PR
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
repo_builds: bcgov/quickstart-openshift
jobs:
deployments:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
backend_triggered: ${{ steps.is_triggered.outputs.backend_triggered }}
frontend_triggered: ${{ steps.is_triggered.outputs.frontend_triggered }}
database_triggered: ${{ steps.is_triggered.outputs.database_triggered }}
strategy:
matrix:
name: [ database, backend, frontend ]
include:
- name: database
file: templates/database.yml
overwrite: false
- name: backend
file: templates/backend.yml
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
penetration_test: false
verification_path: /api
- name: frontend
file: templates/frontend.yml
oc_version: 4.13
overwrite: true
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2
penetration_test: false
post_rollout: |
oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob
steps:
- uses: actions/checkout@v4
- name: Deploys
id: deploys
uses: ./
with:
file: ${{ matrix.file }}
name: ${{ matrix.name }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
oc_version: ${{ matrix.oc_version }}
overwrite: ${{ matrix.overwrite }}
parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
${{ matrix.parameters }}
penetration_test: ${{ matrix.penetration_test }}
post_rollout: ${{ matrix.post_rollout }}
verification_path: ${{ matrix.verification_path }}
- name: Triggered
id: is_triggered
run: |
echo "${{ matrix.name }}_triggered=${{ steps.deploys.outputs.triggered }}" >> $GITHUB_OUTPUT
results:
runs-on: ubuntu-latest
needs: [deployments]
steps:
- uses: actions/checkout@v4
- name: Results
run: |
echo results: ${{ toJson(needs.deployments) }}
echo "Database triggered: ${{needs.deployments.outputs.database_triggered}}"
echo "Backend triggered: ${{needs.deployments.outputs.backend_triggered}}"
echo "Frontend triggered: ${{needs.deployments.outputs.frontend_triggered}}"