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

Add parametric workflow to generate community bundle #4

Merged

Conversation

clobrano
Copy link
Contributor

What this PR does / why we need it:

Add a reusable github workflow to automatically generate a bundle for RH or K8s Operator Hub and commit it to our Medik8s fork ready to be submitted to the Community project

Currently we have one workflow specific for RH Community, this new workflow reuses most of the same code to conditionally build and commit RH or K8s bundle based on parameters that the Operator's workflow must set in advance.

Test plan

I used https://github.com/nektos/act to reproduce the CI jobs locally

😁

Add new github workflow that generates bundle either for RH or K8s based
on parameters.

Signed-off-by: Carlo Lobrano <[email protected]>
Copy link

openshift-ci bot commented Feb 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clobrano

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

git -C community add operators/${OPERATOR_NAME}/${VERSION}
git -C community switch --create ${BRANCH}
git -C community status
git -C community commit -m "Add ${OPERATOR_NAME}-${VERSION}"
Copy link
Member

Choose a reason for hiding this comment

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

IIRC for k8s-operatorhub the commit should be signed off (append --signoff to the).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, thank you

Copy link
Member

@slintes slintes left a comment

Choose a reason for hiding this comment

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

nice!

2 suggestions inside


- name: Checkout Kubernetes Community Operators Hub
uses: actions/checkout@v3
if: ${{ inputs.community == 'k8s-operatorhub' }}
Copy link
Member

Choose a reason for hiding this comment

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

Nice usage of conditional checkout based on inputs 👍🏼
Maybe use more generic input values though, these look very coupled to the repo name, which would be a pity in case the repo name changes. Maybe just "k8s" and "OKD" is good enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks :)

If the repo name changes we still have to change this workflow, but not the callers, SMGT

description: "The community to release the bundle to (either `k8s-operatorhub` or `redhat-openshift-ecosystem`)"
required: true
type: string
recipe:
Copy link
Member

Choose a reason for hiding this comment

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

I had to look up what recipe means, maybe make_targets would be more obvious?

@clobrano
Copy link
Contributor Author

The following is an example usage of this workflow

https://github.com/clobrano/self-node-remediation/blob/automate-community-bundle-parametric-0/.github/workflows/release.yml

Signed-off-by: Carlo Lobrano <[email protected]>
Avoid binding community input names to repository names, which are
subject to changes.

Using only K8S and OKD for simplicity

Signed-off-by: Carlo Lobrano <[email protected]>
@slintes
Copy link
Member

slintes commented Feb 28, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Feb 28, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 7e40dde into main Feb 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants