GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add revision label to function images and show in describe by creydr · Pull Request #3629 · knative/func

Conversation

@creydr

@creydr creydr commented Apr 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Changes

  • 🎁 Add a org.opencontainers.image.revision image label containing the short git commit SHA of the function source directory at build time, with a -dirty suffix when the working tree has uncommitted changes
  • 🎁 Show the revision label in func describe output (JSON/YAML)
$ func describe my-func -o yaml
...
revision: 0cf9be2-dirty

/kind enhancement

Release Note

Function images now include a `commit` label with the short git commit SHA of the function source at build time. The commit is also shown in `func describe` JSON/YAML output.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
creydr added 2 commits April 22, 2026 15:00
@creydr
feat: add commit label to function images
36792f7
Detect the git commit SHA of the function source directory
using go-git and add it as a "commit" OCI image label.
The short SHA is suffixed with "-dirty" if the working tree
has uncommitted changes. If the function is not in a git
repo, the label is omitted.

Integrated into all three builders (pack, s2i, oci) and
the func-util scaffold/s2i-generate pipeline.
@creydr
feat: show commit label in func describe
1e010b0
Add ImageCommit() to read the commit label from a deployed
function image. Integrate into all three describers (knative,
k8s, keda) and expose via the Instance struct so it appears
in JSON/YAML output of func describe.
@knative-prow knative-prow Bot added the kind/enhancement Feature additions or improvements to existing label Apr 22, 2026
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos April 22, 2026 13:48
@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label Apr 22, 2026
@codecov

codecov Bot commented Apr 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.78873% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.40%. Comparing base (7247657) to head (7afd4f2).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/functions/git_commit.go 48.00% 9 Missing and 4 partials ⚠️
pkg/functions/function_labels.go 33.33% 8 Missing and 4 partials ⚠️
pkg/oci/builder.go 21.42% 8 Missing and 3 partials ⚠️
pkg/k8s/describer.go 73.33% 3 Missing and 1 partial ⚠️
pkg/keda/describer.go 73.33% 3 Missing and 1 partial ⚠️
pkg/buildpacks/builder.go 76.92% 2 Missing and 1 partial ⚠️
pkg/s2i/builder.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3629      +/-   ##
==========================================
+ Coverage   56.33%   56.40%   +0.06%     
==========================================
  Files         180      181       +1     
  Lines       20571    20669      +98     
==========================================
+ Hits        11589    11658      +69     
- Misses       7780     7797      +17     
- Partials     1202     1214      +12     
Flag Coverage Δ
e2e 36.27% <56.33%> (+0.06%) ⬆️
e2e go 32.99% <56.41%> (+0.13%) ⬆️
e2e node 28.76% <53.84%> (+0.14%) ⬆️
e2e python 33.36% <56.41%> (+0.13%) ⬆️
e2e quarkus 28.90% <53.84%> (+0.13%) ⬆️
e2e rust 28.30% <48.71%> (+0.11%) ⬆️
e2e springboot 26.76% <51.28%> (+0.11%) ⬆️
e2e typescript 28.86% <53.84%> (+0.13%) ⬆️
e2e-config-ci 18.12% <29.91%> (+0.06%) ⬆️
integration 17.44% <20.51%> (-0.15%) ⬇️
unit macos-14 43.47% <27.35%> (+0.16%) ⬆️
unit macos-latest 43.47% <27.35%> (+0.16%) ⬆️
unit ubuntu-24.04-arm 43.67% <27.46%> (+0.16%) ⬆️
unit ubuntu-latest 44.34% <27.35%> (+0.15%) ⬆️
unit windows-latest 43.50% <27.35%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@creydr

creydr commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

/cc @lkingland @gauron99

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow
knative-prow Bot requested review from gauron99 and lkingland April 22, 2026 18:48
matejvasek
matejvasek reviewed Apr 24, 2026
View reviewed changes
Comment thread pkg/functions/function_labels.go Outdated

const (
MiddlewareVersionLabelKey = "middleware-version"
CommitLabelKey = "commit"

@matejvasek matejvasek Apr 24, 2026

Copy link
Copy Markdown
Contributor

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 name this revision to be more VCS agnostic. Or even org.opencontainers.image.revision.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

creydr reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@creydr creydr Apr 24, 2026

Copy link
Copy Markdown
Member Author

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.

Good point. Let me update it

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@creydr creydr Apr 27, 2026

Copy link
Copy Markdown
Member Author

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 updated the label key to org.opencontainers.image.revision and the key for the "func describe" output to revision

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
matejvasek
matejvasek reviewed Apr 24, 2026
View reviewed changes
Comment thread pkg/pipelines/tekton/templates.go
TlsVerify string

// Git commit SHA of the function source
Commit string

@matejvasek matejvasek Apr 24, 2026

Copy link
Copy Markdown
Contributor

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.

Why we need to parameterize? Cannot the task read current commit on its own?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@matejvasek matejvasek Apr 24, 2026

Copy link
Copy Markdown
Contributor

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 think we upload source as is including .git so the task could read it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@creydr creydr Apr 24, 2026

Copy link
Copy Markdown
Member Author

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 had it initially in the task itself, but I wasn't able to get the commit hash there. This would also have involved to write it to a file and then read it during the prepare step. So I thought it'd be cleaner to have it simply as a parameter for the task.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
matejvasek
matejvasek reviewed Apr 24, 2026
View reviewed changes
Comment thread pkg/functions/image_commit.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

creydr added 2 commits April 24, 2026 14:21
@creydr
refactor: use ImageInspector with custom transport for image label fe…
9d879cf
…tching
@creydr
fix: update NewDescriber calls in integration tests
bf1ec95
lkingland
lkingland approved these changes Apr 27, 2026
View reviewed changes

@lkingland lkingland left a comment

Copy link
Copy Markdown
Member

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.

/lgtm
/hold for the good suggestions from others

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkg/functions/image_inspector.go Outdated
"github.com/google/go-containerregistry/pkg/v1/remote"
)

type ImageInspector struct {

@lkingland lkingland Apr 27, 2026

Copy link
Copy Markdown
Member

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.

This could use a comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@creydr creydr Apr 27, 2026

Copy link
Copy Markdown
Member Author

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.

Removed the struct as part of the refactoring

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkg/functions/image_inspector.go Outdated
transport http.RoundTripper
}

func NewImageInspector(transport http.RoundTripper) *ImageInspector {

@lkingland lkingland Apr 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

This is just a nit, but I'm not seeing any reason this needs to be a pointer, and nils as args begs the question.

Is that just to enable the nil in method signatures, like NewDeployer(x, nil)? This could be accomplished with an fn.ImageInspector interface (which is perhaps a good idea for other reasons too). The simplest option to get rid of the ponters/nils would then be to have a singleton fn.DefaultImageInspector which is a noop and can be passed in place of the nil.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@creydr creydr Apr 27, 2026

Copy link
Copy Markdown
Member Author

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.

The struct got removed during the refactoring. I am using the http.transport directly now (passed via our Options pattern)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@knative-prow knative-prow Bot added the do-not-merge/hold 🤖 PR should not merge because someone has issued a /hold command. label Apr 27, 2026
@knative-prow knative-prow Bot assigned lkingland Apr 27, 2026
@knative-prow knative-prow Bot added lgtm 🤖 PR is ready to be merged. approved 🤖 PR has been approved by an approver from all required OWNERS files. labels Apr 27, 2026
lkingland
lkingland reviewed Apr 27, 2026
View reviewed changes
Comment thread cmd/client.go Outdated
c = newCredentialsProvider(config.Dir(), t, "") // for accessing registries
d = newKnativeDeployer(cfg.Verbose) // default deployer (can be overridden via options)
pp = newTektonPipelinesProvider(c, cfg.Verbose)
ii = fn.NewImageInspector(t)

@lkingland lkingland Apr 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Is the transport the reason for having the ImageInspector exposed outside the core into the cli (or anyone using the core api)? If so, it might be possible to just pass the transport to the describers/pipeline provider. Then they can use that internally to inspect using a helper method.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@creydr creydr Apr 27, 2026

Copy link
Copy Markdown
Member Author

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.

Good point. I updated it. I am passing the http.Transport now to the describers only (via a WithDescriberTransport(t) option func). I hope this makes sense :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@creydr
refactor: pass transport to describers via functional options
2e8f9af
Replace ImageInspector struct with ImageLabels helper in function_labels.go.
Describers now accept transport via WithDescriberTransport option,
keeping the transport internal and removing nil arguments from callers.
@creydr creydr changed the title Add commit label to function images and show in describe [WIP] Add commit label to function images and show in describe Apr 27, 2026
@knative-prow knative-prow Bot added do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. and removed lgtm 🤖 PR is ready to be merged. labels Apr 27, 2026
creydr added 2 commits April 27, 2026 10:05
@creydr
feat: use OCI standard label org.opencontainers.image.revision for co…
c9961b4
…mmit
@creydr
refactor: rename Instance.Commit to Instance.Revision in describe output
7afd4f2
@creydr creydr changed the title [WIP] Add commit label to function images and show in describe Add revision label to function images and show in describe Apr 27, 2026
@knative-prow knative-prow Bot removed the do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. label Apr 27, 2026
@creydr
creydr requested a review from matejvasek April 27, 2026 08:56
@creydr
creydr requested a review from lkingland April 27, 2026 08:56
@matejvasek

matejvasek commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

/approve
/lgtm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot assigned matejvasek Apr 27, 2026
@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Apr 27, 2026
@knative-prow

knative-prow Bot commented Apr 27, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, lkingland, matejvasek

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:
  • OWNERS [lkingland,matejvasek]

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@creydr

creydr commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

/unhold

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot removed the do-not-merge/hold 🤖 PR should not merge because someone has issued a /hold command. label Apr 27, 2026
@knative-prow
knative-prow Bot merged commit 77707d1 into knative:main Apr 27, 2026
41 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@dsimansk dsimansk Awaiting requested review from dsimansk
@jrangelramos jrangelramos Awaiting requested review from jrangelramos
@gauron99 gauron99 Awaiting requested review from gauron99
@matejvasek matejvasek Awaiting requested review from matejvasek
@lkingland lkingland Awaiting requested review from lkingland

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@matejvasek matejvasek

@lkingland lkingland

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. kind/enhancement Feature additions or improvements to existing lgtm 🤖 PR is ready to be merged. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@creydr @matejvasek @lkingland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.