Skip to content

Apply konflux configurations #46

Apply konflux configurations

Apply konflux configurations #46

---
name: Apply konflux configurations
on:
schedule:
- cron: "0 4 * * *" # Daily at 06:00.
workflow_dispatch: # Manual workflow trigger
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-matrix:
runs-on: ubuntu-latest
if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- id: set-matrix
run: |
echo "projects=$(go run ./cmd/matrix config/konflux/*)" >> $GITHUB_OUTPUT
outputs:
projects: ${{ steps.set-matrix.outputs.projects }}
apply-project:
needs: build-matrix
if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: ${{ fromJSON(needs.build-matrix.outputs.projects) }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Clone ${{matrix.project}}
uses: actions/checkout@v4
with:
repository: openshift-pipelines/${{matrix.project}}
path: project
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Apply configurations
run: |
kubectl config set-credentials konflux-sa --token "$KONFLUX_TOKEN"
kubectl config set-cluster konflux --server=https://api.stone-prd-rh01.pg1f.p1.openshiftapps.com:6443
kubectl config set-context konflux-sa@konflux --user=konflux-sa --namespace=tekton-ecosystem-tenant --cluster=konflux
kubectl config use-context konflux-sa@konflux
kubectl get pr
go run ./cmd/konflux-apply/ -config config/konflux/${{matrix.project}}.yaml
env:
KONFLUX_TOKEN: ${{ secrets.KONFLUX_SA_TOKEN }}