-
Notifications
You must be signed in to change notification settings - Fork 142
Automate Operator certification #4288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ciarams87
wants to merge
1
commit into
main
Choose a base branch
from
chore/add-operator-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Operator Bundle PR | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| operator-version: | ||
| description: "Operator version for bundle generation" | ||
| required: true | ||
| default: "0.0.0" | ||
| submit-to-redhat: | ||
| description: "Submit bundle to RedHat certified-operators repo" | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| bundle: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Install operator-sdk | ||
| run: | | ||
| OPERATOR_SDK_VERSION=v1.42.0 # renovate: datasource=github-tags depName=operator-framework/operator-sdk | ||
| curl -sSLo /tmp/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux-amd64 | ||
| chmod +x /tmp/operator-sdk | ||
| sudo mv /tmp/operator-sdk /usr/local/bin/operator-sdk | ||
|
|
||
| - name: Generate Bundle | ||
| working-directory: operators | ||
| run: | | ||
| make bundle-release | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: Generate operator bundle for v${{ inputs.operator-version }} | ||
| title: Operator Bundle v${{ inputs.operator-version }} | ||
| draft: true | ||
| delete-branch: true | ||
| branch: operator/bundle-${{ inputs.operator-version }} | ||
| author: nginx-bot <[email protected]> | ||
| committer: nginx-bot <[email protected]> | ||
| body: | | ||
| This automated PR generates the operator bundle for v${{ inputs.operator-version }}. | ||
|
|
||
| ## What's Changed | ||
| - Updated NGF image versions in sample manifests using image digests | ||
| - Generated bundle manifests and metadata | ||
| - Updated ClusterServiceVersion with proper annotations and descriptors | ||
| - Added OpenShift compatibility annotations | ||
|
|
||
| - name: Checkout certified-operators repo | ||
| if: ${{ inputs.submit-to-redhat }} | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| token: ${{ secrets.NGINX_PAT }} | ||
| repository: nginx-bot/certified-operators | ||
| path: certified-operators | ||
|
|
||
| - name: Update certified-operators repo | ||
| if: ${{ inputs.submit-to-redhat }} | ||
| working-directory: certified-operators/operators/nginx-gateway-fabric-operator | ||
| run: | | ||
| mkdir v${{ inputs.operator-version }} | ||
| cp -R ../../../operators/bundle/manifests v${{ inputs.operator-version }}/ | ||
| cp -R ../../../operators/bundle/metadata v${{ inputs.operator-version }}/ | ||
|
|
||
| - name: Commit and push to certified-operators | ||
| if: ${{ inputs.submit-to-redhat }} | ||
| uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0 | ||
| with: | ||
| commit_message: operator nginx-gateway-fabric-operator (v${{ inputs.operator-version }}) | ||
| commit_author: nginx-bot <[email protected]> | ||
| commit_user_name: nginx-bot | ||
| commit_user_email: [email protected] | ||
| create_branch: true | ||
| branch: update-nginx-gateway-fabric-operator-to-v${{ inputs.operator-version }} | ||
| repository: certified-operators | ||
|
|
||
| - name: Create PR to RedHat certified-operators | ||
| if: ${{ inputs.submit-to-redhat }} | ||
| working-directory: certified-operators | ||
| run: | | ||
| gh pr create --title "operator nginx-gateway-fabric-operator (v${{ inputs.operator-version }})" --body "Update nginx-gateway-fabric-operator to v${{ inputs.operator-version }}" --head nginx-bot:update-nginx-gateway-fabric-operator-to-v${{ inputs.operator-version }} --base main --repo redhat-openshift-ecosystem/certified-operators | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.NGINX_PAT }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: RedHat Certification | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| image: | ||
| description: "Image type to certify (ngf, nginx, operator)" | ||
| required: true | ||
| type: string | ||
| tag: | ||
| description: "Image tag to certify" | ||
| required: true | ||
| type: string | ||
| dry_run: | ||
| description: "Run preflight checks without submitting" | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| certify: | ||
| name: Submit ${{ inputs.image }} image for certification | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Set image reference | ||
| id: image | ||
| run: | | ||
| case "${{ inputs.image }}" in | ||
| ngf) | ||
| echo "ref=ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric:${{ inputs.tag }}-ubi" >> $GITHUB_OUTPUT | ||
| ;; | ||
| nginx) | ||
| echo "ref=ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric/nginx:${{ inputs.tag }}-ubi" >> $GITHUB_OUTPUT | ||
| ;; | ||
| operator) | ||
| echo "ref=ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric/operator:${{ inputs.tag }}" >> $GITHUB_OUTPUT | ||
| ;; | ||
| *) | ||
| echo "Error: Unknown image type: ${{ inputs.image }}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Set component ID environment variable | ||
| run: | | ||
| case "${{ inputs.image }}" in | ||
| ngf) | ||
| echo "COMPONENT_ID=${{ secrets.CERTIFICATION_COMPONENT_ID_NGF }}" >> $GITHUB_ENV | ||
| ;; | ||
| nginx) | ||
| echo "COMPONENT_ID=${{ secrets.CERTIFICATION_COMPONENT_ID_NGINX }}" >> $GITHUB_ENV | ||
| ;; | ||
| operator) | ||
| echo "COMPONENT_ID=${{ secrets.CERTIFICATION_COMPONENT_ID_OPERATOR }}" >> $GITHUB_ENV | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Install preflight | ||
| run: | | ||
| PREFLIGHT_VERSION=1.14.1 # renovate: datasource=github-tags depName=redhat-openshift-ecosystem/openshift-preflight | ||
| curl -sSLo /tmp/preflight https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/${PREFLIGHT_VERSION}/preflight-linux-amd64 | ||
| chmod +x /tmp/preflight | ||
| sudo mv /tmp/preflight /usr/local/bin/preflight | ||
| preflight version | ||
|
|
||
| - name: Run preflight check${{ !inputs.dry_run && ' and submit' || '' }} | ||
| run: | | ||
| preflight check container ${{ steps.image.outputs.ref }} \ | ||
| --pyxis-api-token="${{ secrets.PYXIS_API_TOKEN }}" \ | ||
| --certification-component-id="${COMPONENT_ID}" \ | ||
| ${{ !inputs.dry_run && '--submit' || '' }} |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ COPY LICENSE /licenses/LICENSE | |
| LABEL name="nginx-gateway-fabric-operator" \ | ||
| maintainer="[email protected]" \ | ||
| vendor="F5 NGINX" \ | ||
| version="1.0.0" \ | ||
| version="edge" \ | ||
| release="1" \ | ||
| summary="NGINX Gateway Fabric Operator" \ | ||
| description="Helm-based operator for NGINX Gateway Fabric" | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the root of the directory be used? This relative path seems flimsy.