Skip to content

🌱 Auto-create git tags for the tools/setup-envtest submodule#3476

Merged
k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
porridge:patch-3
Apr 4, 2026
Merged

🌱 Auto-create git tags for the tools/setup-envtest submodule#3476
k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
porridge:patch-3

Conversation

@porridge

@porridge porridge commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

See slack discussion.

Using the GitHub CLI (gh api) built into GitHub's runners to create the tag, rather than using standard git tag and git push commands because it:

  • does not require configuring a dummy git user/email, and
  • works flawlessly in a shallow checkout.

Tested a copy of this workflow in this run in a clone repo.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 10, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @porridge. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 10, 2026
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 10, 2026
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move the contents of this into a file under ./hack so its easier to run for testing

on:
push:
tags:
- 'v*' # Code below does further filtering.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason to not filter here already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think only basic globbing is available here, not terribly expressive...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It appears to be an odd subset of regex that doesn't support match groups, but should be possible to validate for major/minor/patch here? https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#filter-pattern-cheat-sheet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't able to come up with an expression that accepts v1.2.3-rc1 but rejects v.1.2.3invalid but perhaps it's not a big issue. Let me know if you'd like me to reinstate the regex match in bash.

exit 0
fi

echo "skipped=false" >> $GITHUB_OUTPUT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be unused

NEW_TAG="${PREFIX}${ORIGINAL_TAG}"

echo "Original tag '$ORIGINAL_TAG' matches expression '$REGEX'."
echo "Creating new tag: '$NEW_TAG' at SHA: ${{ github.sha }}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we first check if the tag already exists?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. If it does, should we exit silently right away, or further check whether it's the same commit and vary the exit code based on that?

I'm leaning towards the former, in order to respect any pre-existing tags created out of band.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, just exit silently

@porridge

Copy link
Copy Markdown
Contributor Author

Sorry but I could not find the time for this recently, I will do my best to address the feedback next week.

@porridge

Copy link
Copy Markdown
Contributor Author

Feedback addressed, PTAL @alvaroaleman

Tested here:

@alvaroaleman alvaroaleman added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 4, 2026

@alvaroaleman alvaroaleman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: e9eb1104e448d0373b95c91423a3570e4c0b2d2b

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, porridge

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

The pull request process is described here

Details 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 4, 2026
@k8s-ci-robot k8s-ci-robot merged commit 885e77d into kubernetes-sigs:main Apr 4, 2026
4 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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants