Skip to content

fix(ci): make git describe robust against shallow checkouts#3922

Open
shreyaabaranwal wants to merge 1 commit into
knative:mainfrom
shreyaabaranwal:fix/funcversion-git-describe-ci
Open

fix(ci): make git describe robust against shallow checkouts#3922
shreyaabaranwal wants to merge 1 commit into
knative:mainfrom
shreyaabaranwal:fix/funcversion-git-describe-ci

Conversation

@shreyaabaranwal

Copy link
Copy Markdown

Changes

  • 🐛 Make git describe resilient to shallow checkouts so the version string is never empty

While working on #3913 I noticed the E2E - Core, Metadata, and Remote check kept failing on a change that was completely unrelated to it (just an extension map iteration cleanup). Digging into the logs of the failing run (job 83049870138), the actual cause turned out to be in CI itself, not the PR.

actions/checkout does a shallow clone by default and doesn't fetch tags. Because of that, git describe --tags --match 'v*' exits with status 128 and the version ends up empty. That empty version flows into the image tags, so the e2e tests later fail looking up an image that was never built under the expected name — which is why TestCore_PythonUserDepsRemote reports "image not found".

This PR fixes the root cause rather than the symptom:

  • Set fetch-depth: 0 on all actions/checkout@v4 steps so tags are actually available when git describe runs.
  • Add a safe fallback in Makefile and hack/release.sh so the version degrades to a commit SHA (or a placeholder) instead of being empty if no matching tag is found.

This should unblock e2e on PRs like #3913 that don't touch CI but were failing because of it.

/kind bug

Relates to #3913

Release Note

NONE

Docs

NONE

actions/checkout defaults to a shallow clone without tags, so
git describe --tags exits 128 and the version ends up empty.
This produces malformed image tags and causes e2e image lookups
(e.g. TestCore_PythonUserDepsRemote) to fail with image not found.

- Set fetch-depth: 0 on all checkout steps so tags are available
- Fall back gracefully in Makefile and hack/release.sh when no
  matching tag is found

Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
@knative-prow knative-prow Bot added the kind/bug Bugs label Jun 25, 2026
@knative-prow

knative-prow Bot commented Jun 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shreyaabaranwal
Once this PR has been reviewed and has the lgtm label, please assign dsimansk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos June 25, 2026 15:38
@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Jun 25, 2026
@knative-prow

knative-prow Bot commented Jun 25, 2026

Copy link
Copy Markdown

Hi @shreyaabaranwal. Thanks for your PR.

I'm waiting for a knative 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.

Regular contributors should join the org to skip this step.

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.

@shreyaabaranwal

Copy link
Copy Markdown
Author

this one fixes a CI issue that's currently failing e2e on unrelated PRs (like #3913). Would a maintainer mind dropping /ok-to-test so the checks can run? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bugs needs-ok-to-test 🤖 Needs an org member to approve testing size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant