Skip to content

Allow to specify the output format of func version via --output#3280

Merged
knative-prow[bot] merged 4 commits intoknative:mainfrom
creydr:add-output-options-to-func-version
Dec 9, 2025
Merged

Allow to specify the output format of func version via --output#3280
knative-prow[bot] merged 4 commits intoknative:mainfrom
creydr:add-output-options-to-func-version

Conversation

@creydr
Copy link
Member

@creydr creydr commented Dec 9, 2025

Changes

  • 🎁 Allow to print the output from func version as json or yaml too (in case of json/yaml, it will always be verbose output)
$ func version   
v0.47.0-68-g05a4aa8b

$ func version -v
Version: v0.47.0-68-g05a4aa8b
Knative: v1.20.0
Commit: 05a4aa8b
SocatImage: ghcr.io/knative/func-utils:v2
TarImage: ghcr.io/knative/func-utils:v2

$ func version -v -o json
{
  "version": "v0.47.0-68-g05a4aa8b",
  "knative": "knative-v1.20.0-68-g05a4aa8b",
  "commit": "05a4aa8b",
  "socatImage": "ghcr.io/knative/func-utils:v2",
  "tarImage": "ghcr.io/knative/func-utils:v2"
}

$ func version -o json   
{
  "version": "v0.47.0-68-g05a4aa8b",
  "knative": "knative-v1.20.0-68-g05a4aa8b",
  "commit": "05a4aa8b",
  "socatImage": "ghcr.io/knative/func-utils:v2",
  "tarImage": "ghcr.io/knative/func-utils:v2"
}

/kind enhancement

This can be useful, when we want to add the latest middleware versions in the output of func version too.

Hint for reviewers:

The main change is in 83c736e (and 4b0265c). d5fd435 was only a refactoring moving the Version struct to the version.go file. Thus the whole PR can be a bit "noisy".

Release Note

Allow to print the output from `func version` as `json` or `yaml` too

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 9, 2025
@creydr
Copy link
Member Author

creydr commented Dec 9, 2025

/cc @lkingland

@knative-prow knative-prow bot requested a review from lkingland December 9, 2025 10:54
@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 67.53247% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.57%. Comparing base (e30bcf9) to head (4b0265c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/version.go 67.53% 23 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3280      +/-   ##
==========================================
+ Coverage   54.56%   54.57%   +0.01%     
==========================================
  Files         167      167              
  Lines       19473    19512      +39     
==========================================
+ Hits        10625    10649      +24     
- Misses       7789     7803      +14     
- Partials     1059     1060       +1     
Flag Coverage Δ
e2e 39.70% <62.90%> (-0.02%) ⬇️
e2e go 35.72% <62.90%> (+0.03%) ⬆️
e2e node 30.95% <62.90%> (+0.02%) ⬆️
e2e python 35.48% <62.90%> (+0.12%) ⬆️
e2e quarkus 31.12% <62.90%> (+0.04%) ⬆️
e2e rust 30.55% <62.90%> (+0.02%) ⬆️
e2e springboot 30.58% <62.90%> (+0.04%) ⬆️
e2e typescript 31.10% <62.90%> (+0.06%) ⬆️
integration 17.62% <0.00%> (-0.07%) ⬇️
unit macos-14 44.46% <62.90%> (-0.02%) ⬇️
unit macos-latest 44.46% <62.90%> (-0.02%) ⬇️
unit ubuntu-24.04-arm 44.67% <64.93%> (+<0.01%) ⬆️
unit ubuntu-latest 45.38% <62.90%> (-0.02%) ⬇️
unit windows-latest 44.48% <62.90%> (-0.02%) ⬇️

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.

@matejvasek
Copy link
Contributor

You may need to adjust tests.

@creydr creydr force-pushed the add-output-options-to-func-version branch from 05a4aa8 to 4b0265c Compare December 9, 2025 11:18
@creydr
Copy link
Member Author

creydr commented Dec 9, 2025

You may need to adjust tests.

Just did it in 4b0265c. Not sure, why it had an empty line at the end before 🤷

@matejvasek
Copy link
Contributor

/approve
/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2025
@knative-prow
Copy link

knative-prow bot commented Dec 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, 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:

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2025
@knative-prow knative-prow bot merged commit c6bac50 into knative:main Dec 9, 2025
42 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. kind/enhancement lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments