Add Tekton files for globalhub versions: 5.1 5.2 #12079
This file contains hidden or 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: Go | |
| on: | |
| workflow_dispatch: {} | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| jobs: | |
| format: | |
| name: format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 | |
| with: | |
| go-version: '1.26' | |
| cache: false | |
| - name: Setup format tools | |
| run: go install tool | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9 | |
| with: | |
| version: v2.7.2 | |
| install-mode: goinstall | |
| - name: format | |
| run: make strict-fmt | |
| verify-bundle: | |
| name: verify bundle | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: resolve bundle comparison branch | |
| id: bundle-branch | |
| env: | |
| BASE_REF: ${{ github.base_ref }} | |
| HEAD_REF: ${{ github.ref_name }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| if [ "$EVENT_NAME" = "pull_request" ]; then | |
| TARGET="$BASE_REF" | |
| else | |
| TARGET="$HEAD_REF" | |
| fi | |
| echo "target=${TARGET}" >> "$GITHUB_OUTPUT" | |
| case "$TARGET" in | |
| main|release-*) | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| ;; | |
| *) | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| ;; | |
| esac | |
| # Committed operator/bundle on main (and ffwd copies on release-5.0/5.1/5.2) | |
| # is the current product line (RELEASE_LINE default, today 5.0.0-dev). Do not | |
| # pass RELEASE_LINE from the git branch name: that regenerates 5.1/5.2 CSV | |
| # metadata on ffwd branches and fails git diff --exit-code. | |
| # Per-line OLM/CPE metadata stays in Tekton build-args and the operator-bundle repo. | |
| - name: bundle | |
| run: cd operator && make bundle | |
| # main and release-* branches use the in-repo dev bundle (e.g. 5.0.0-dev) while the | |
| # matching release-* branches in multicluster-global-hub-operator-bundle | |
| # carry GA z-stream versions — skip external sync on those branches. | |
| - name: compare bundle with stolostron/multicluster-global-hub-operator-bundle | |
| if: steps.bundle-branch.outputs.skip != 'true' | |
| env: | |
| TARGET: ${{ steps.bundle-branch.outputs.target }} | |
| run: | | |
| # Ensure the committed bundle matches the release branch in the bundle repo. | |
| # ignore createdAt updated in csv by `make bundle` | |
| git checkout . -f | |
| git clone https://github.com/stolostron/multicluster-global-hub-operator-bundle.git \ | |
| -b "$TARGET" | |
| diff -I 'createdAt' -ruN operator/bundle multicluster-global-hub-operator-bundle/bundle | |
| scorecard-test: | |
| name: bundle scorecard test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - name: Create k8s Kind Cluster | |
| uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1 | |
| - name: Download operator-sdk | |
| run: make -C operator operator-sdk | |
| - name: scorecard | |
| run: | | |
| export PATH="${{ github.workspace }}/operator/bin:${PATH}" | |
| cd operator && operator-sdk scorecard ./bundle/ |