Skip to content
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

change display versions #1601

Merged
merged 1 commit into from
Mar 1, 2022
Merged

Conversation

kobayashi
Copy link
Contributor

Description

Change display versions for Serving and Eventing for major/minor updates.

$ TAG=v1.2.0 hack/build.sh
🚒 Update
=== Update Deps for Golang
--- Go mod tidy and vendor
--- Removing unwanted vendor files
--- Updating licenses
--- Removing broken symlinks
🔍 Lint
 ️ License
📖 Docs
🚧 Compile
 Test
────────────────────────────────────────────
Version:      v1.2.0
Build Date:   2022-02-05 04:06:08
Git Revision: 6690a20e
Suppored APIs:
* Serving
  - serving.knative.dev/v1 (knative-serving v1.2.0)
* Eventing
  - sources.knative.dev/v1 (knative-eventing v1.2.0)
  - eventing.knative.dev/v1 (knative-eventing v1.2.0)

Changes

  • Add conditional statement in hack/build-flags.sh to check patch number to Serving and Eventing versions
  • Displayed versions are depends on client's patch version

Reference

Fixes #1542

@knative-prow-robot
Copy link
Contributor

Welcome @kobayashi! It looks like this is your first PR to knative/client 🎉

@knative-prow-robot
Copy link
Contributor

Hi @kobayashi. 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.

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/test-infra repository.

@knative-prow-robot knative-prow-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 5, 2022
@rhuss
Copy link
Contributor

rhuss commented Feb 7, 2022

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 7, 2022
version_eventing=$(grep "knative.dev/eventing " "${base}/go.mod" \
| sed -s 's/.* \(v.[\.0-9]*\).*/\1/')

if [[ "${patch}" -ne 0 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic below would imply that for a version 1.2.0 you get a serving and eventing version 0.29.0, while for 1.2.1 you get 1.2.1 for eventing and serving (regardless of what the actual versions of eventing and serving are). This is not as it should work.

Instead, the algorithm should work like this:

  • $version is ${TAG}
  • For the serving version:
    • Take major.minor from ${version} (via e.g. cut -f1-2 -d.)
    • Take patch from the serving dependency in go.mod (e.g. echo $version_serving | cut -f3 -d. with $version_serving being the full version extracted from go.mod ad it is now)
    • Combine all of them to calculate the serving version (major.minor from ${version} + .patch from the go.mod dependency.

Same for eventing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I'd prefer the logic to be executed withing version cmd. Keep providing go module version and transform it into 1.y.z.

https://github.com/knative/client/blob/main/pkg/kn/commands/version/version.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @rhuss @dsimansk ,
I misunderstood the logic. I have updated my implementation in the shell script. Should I do it in version.go?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the update. IMO it's fine to keep it in the script for now, given it's already very close to done.

@rhuss can you pls check the changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kobayashi sorry for the delay. I have tested the changes locally and it produces desired results imo. Thanks for the fix!

@rhuss
Copy link
Contributor

rhuss commented Feb 7, 2022

Thanks for the PR ! I added some comment about the algorithm, I think it currently does not work as expected.

@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #1601 (2ffeba4) into main (6690a20) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1601   +/-   ##
=======================================
  Coverage   79.79%   79.79%           
=======================================
  Files         163      163           
  Lines        8820     8820           
=======================================
  Hits         7038     7038           
  Misses       1089     1089           
  Partials      693      693           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6690a20...2ffeba4. Read the comment docs.

@dsimansk
Copy link
Contributor

dsimansk commented Mar 1, 2022

/approve
/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 1, 2022
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dsimansk, kobayashi

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 1, 2022
@knative-prow-robot knative-prow-robot merged commit 587a4a8 into knative:main Mar 1, 2022
dsimansk pushed a commit to dsimansk/client that referenced this pull request Mar 3, 2022
openshift-merge-robot pushed a commit to openshift/knative-client that referenced this pull request Mar 3, 2022
dsimansk added a commit to openshift/knative-client that referenced this pull request Mar 29, 2022
Fix for file not found error message discrepancy in windows (knative#1575) (#967)

Co-authored-by: Gunjan Vyas <[email protected]>

change display versions (knative#1601) (#985)

Co-authored-by: kobayashi <[email protected]>
dsimansk pushed a commit to openshift/knative-client that referenced this pull request May 12, 2022
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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change version display for Serving and Eventing to 1.x scheme
4 participants