-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ Add plugin for Alpha Update Command #5027
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 plugin for Alpha Update Command #5027
Conversation
[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 |
d0923b6
to
05a090c
Compare
05a090c
to
c59be43
Compare
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> |
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.
@vitorfloriano it would be nice we add an image of the issue here
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.
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.
Did you edit it?
@@ -0,0 +1,66 @@ | |||
name: Alpha Update |
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.
@vitorfloriano here is out final result :-)
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.
We need to fix for Auto Update
doing now
c59be43
to
bfd5dcd
Compare
Run: | ||
|
||
``` | ||
kubebuilder init|edit --plugins="autoupdate.kubebuilder.io/v1-alpha" |
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.
@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?
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.
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
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.
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?
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.
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.
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.
@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
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.
It's much better now.
pkg/plugins/optional/autoupdate/v1alpha/scaffolds/internal/github/auto_update.go
Outdated
Show resolved
Hide resolved
pkg/plugins/optional/autoupdate/v1alpha/scaffolds/internal/github/auto_update.go
Outdated
Show resolved
Hide resolved
pkg/plugins/optional/autoupdate/v1alpha/scaffolds/internal/github/auto_update.go
Show resolved
Hide resolved
# 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 | ||
` |
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.
In the template, it seems that some of the comments were indented using tabs. We should not use tabs, as the YAML specs recommend.
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.
You acctully discover a bug
We have a linter to verify that: #5030
bfd5dcd
to
1c064b2
Compare
62356f1
to
1956885
Compare
Co-authored-by: Vitor Floriano <[email protected]>
1956885
to
2697198
Compare
LGTM. This plugin correctly scaffolds the update workflow when passed to |
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.