Skip to content

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Aug 20, 2025

Adds an optional plugin that scaffolds a GitHub Actions workflow to keep projects aligned with the latest Kubebuilder scaffold. The workflow runs kubebuilder alpha update (3-way merge), pushes an update branch, and opens a GitHub Issue with a compare link so maintainers can open a PR and review safely.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 20, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 20, 2025
@camilamacedo86 camilamacedo86 changed the title ✨ Add plugin for Alpha Update WIP (missing doc)✨ Add plugin for Alpha Update Aug 20, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 20, 2025
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 20, 2025
@camilamacedo86 camilamacedo86 changed the title WIP (missing doc)✨ Add plugin for Alpha Update ✨ Add plugin for Alpha Update Aug 20, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 20, 2025
Then, whenever a new Kubebuilder release is available, it will open an Issue with a
Pull Request compare link so you can create the PR and review it, such as:

<TODO ISSUE ADD IMAGE>
Copy link
Member Author

Choose a reason for hiding this comment

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

@vitorfloriano it would be nice we add an image of the issue here

Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot 2025-08-21 at 12 01 07

i could test it out and mock for what we want to show :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you edit it?

@@ -0,0 +1,66 @@
name: Alpha Update
Copy link
Member Author

Choose a reason for hiding this comment

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

@vitorfloriano here is out final result :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to fix for Auto Update
doing now

Run:

```
kubebuilder init|edit --plugins="autoupdate.kubebuilder.io/v1-alpha"
Copy link
Contributor

Choose a reason for hiding this comment

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

@camilamacedo86 I noticed that passing a value to --plugins when initiating the project overrides the other plugins. Should we add a note about that or should we change the behavior to be additive?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because the plugins behvaiour is the same for all plugins
So, we do not need to doc how plugins chain work here.
Otherwise, we would replicate this info in each plugin doc
How plugin work is doc already: https://book.kubebuilder.io/plugins/plugins

Copy link
Contributor

Choose a reason for hiding this comment

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

Then maybe we could add this link to the docs somewhere in this section, just so users can learn more about how to work with plugins in Kubebuilder. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would advocate for we do not because it is something that is == with all cases
I would prefer change the example
add one with init and go/v4 and other with edit
I will do it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vitorfloriano see now if it address your concerns
I think now is much more clear.

If all is OK for you let us know by LGTM so we can get this one merged

Copy link
Contributor

Choose a reason for hiding this comment

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

It's much better now.

Comment on lines 69 to 109
# Step 1: Checkout the repository.
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: {{ "${{ secrets.GITHUB_TOKEN }}" }}
fetch-depth: 0
# Step 2: Configure Git to create commits with the GitHub Actions bot.
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Step 3: Set up Go environment.
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# Step 4: Install Kubebuilder.
- name: Install Kubebuilder
run: |
curl -L -o kubebuilder "https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH)"
chmod +x kubebuilder
sudo mv kubebuilder /usr/local/bin/
kubebuilder version
# Step 5: Run the Kubebuilder alpha update command.
# More info: https://kubebuilder.io/reference/commands/alpha_update
- name: Run kubebuilder alpha update
run: |
# Executes the update command with specified flags.
# --force: Completes the merge even if conflicts occur, leaving conflict markers.
# --push: Automatically pushes the resulting output branch to the 'origin' remote.
# --restore-path: Preserves specified paths (e.g., CI workflow files) when squashing.
# --open-gh-issue: Creates a GitHub issue with a link to the generated PR for review.
kubebuilder alpha update \
--force \
--push \
--restore-path .github/workflows \
--open-gh-issue
`
Copy link
Contributor

Choose a reason for hiding this comment

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

In the template, it seems that some of the comments were indented using tabs. We should not use tabs, as the YAML specs recommend.

Copy link
Member Author

Choose a reason for hiding this comment

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

You acctully discover a bug
We have a linter to verify that: #5030

@camilamacedo86 camilamacedo86 changed the title ✨ Add plugin for Alpha Update ✨ Add plugin for Alpha Update Command Aug 21, 2025
@camilamacedo86 camilamacedo86 force-pushed the docs-alpha-update branch 4 times, most recently from 62356f1 to 1956885 Compare August 21, 2025 11:52
@vitorfloriano
Copy link
Contributor

LGTM.

This plugin correctly scaffolds the update workflow when passed to --plugins in init and edit routines.

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 21, 2025
@k8s-ci-robot k8s-ci-robot merged commit 9b9b397 into kubernetes-sigs:master Aug 21, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants