Skip to content
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

ci(rh-shield-operator): enhance operator release pipeline #2068

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aroberts87
Copy link
Collaborator

What this PR does / why we need it:

The old pipeline would simply build and push the operator and bundle images. This was a start, but left numerous manual steps to get the Operator itself certified. The changes in this PR add the following enhancements to the pipeline.

  • Generate the Bundle content in the pipeline
    • Run make bundle in the pipeline as opposed to requiring it be run beforehand.
    • Since the pipeline guarantees the operator image itself will be built and pushed before the bundle is generated, we can set USE_IMAGE_DIGESTS=true when running make bundle to include the image checksums in the bundle. This is a requirement for certification.
    • The newly generated bundle content will be 'massaged' to include the annotations required for certification that are not created by operator-sdk.
  1. Trigger preflight certification
  2. Decouple the various builds and certification steps that aren't related

Checklist

  • Title of the PR starts with type and scope, (e.g. feat(agent,node-analyzer,sysdig-deploy):)

@aroberts87 aroberts87 self-assigned this Dec 4, 2024
The old pipeline would simply build and push the operator and bundle
images. This was a start, but left numerous manual steps to get the
Operator itself certified. The changes in this PR add the following
enhancements to the pipeline.

1. Generate the Bundle content in the pipeline
  a. Run the 'make bundle' command in the pipeline as opposed to
     requiring it be run beforehand.
  b. Since the pipeline guarantees the operator image itself will be
     built and pushed before the bundle is generated, we can set
     USE_IMAGE_DIGESTS=true when running 'make bundle' to include
     the image checksums in the bundle. This is a requirement for
     certification.
  c. The newly generated bundle content will be 'massaged' to
     include the annotations required for certification that are not
     created by the operator-sdk.
2. Trigger preflight certification
2. Decouple the various builds and certification steps that aren't related
@aroberts87 aroberts87 force-pushed the aroberts/feat/extend-operator-pipeline-to-certify-as-well branch from 14a837b to 88562ce Compare December 4, 2024 21:34
Comment on lines 100 to 115
echo "Waiting for PR ${{ steps.open-pr.outputs.pull-request-url }} to be merged..."

PR_STATUS=$(gh pr view ${{ steps.open-pr.outputs.pull-request-number }} --json state -q .state)

timeout 2h bash -c 'until [[ "$PR_STATUS" == "MERGED" ]]; do
echo "PR not merged yet, waiting 10s..."
sleep 10
PR_STATUS="$(gh pr view ${{ steps.open-pr.outputs.pull-request-number }} --json state -q .state)"
done'

if [[ "$PR_STATUS" != "MERGED" ]]; then
echo "PR was not merged in time. Check ${{ steps.open-pr.outputs.pull-request-url }} for more information."
exit 1
else
echo "PR was merged!"
fi
Copy link
Contributor

@mavimo mavimo Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using:

gh pr checks --watch  --json state ${{ steps.open-pr.outputs.pull-request-url }}
sleep 10
PR_STATUS="$(gh pr view ${{ steps.open-pr.outputs.pull-request-number }} --json state -q .state)"
echo "pr_status=$PR_STATUS" >> "$GITHUB_OUTPUT"

and then use other if condition in other steps to decide what is expected to happne?

steps:
    - name: validate PR
      id: validate-pr
      # ...
    - name: Build and Push Bundle Image
      if: ${{ contains(steps.validate-pr.outputs.pr_status, 'MERGED') }}
      # ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm not understanding correctly (😅), but the gh pr checks command seems to return as soon as the PR checks have completed and not when the PR is merged. The need here is to wait until the merge has been completed so we do not build and push a bundle image that is based on content that hasn't actually been committed yet.

* migrate custom script to use Wandalen/wretry.action action
* correct pathing in the yq step for the bundle
* remove the requirement to specify the operator version
@aroberts87 aroberts87 marked this pull request as ready for review December 11, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants