Skip to content
This repository was archived by the owner on Nov 5, 2026. It is now read-only.

Use new out of gopath codegen - #125

Merged
knative-prow-robot merged 8 commits into
knative-extensions:masterfrom
n3wscott:codegen-ext
Dec 2, 2020
Merged

knative-prow-robot merged 8 commits into
knative-extensions:masterfrom
n3wscott:codegen-ext

Conversation

@n3wscott

Copy link
Copy Markdown

Changes

  • Use new knative.dev/hack go path function to generate client code from anywhere.

@google-cla

google-cla Bot commented Nov 30, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla Bot added the cla: no Indicates the PR's author has not signed the CLA. label Nov 30, 2020
@knative-prow-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: n3wscott

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-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 30, 2020
@codecov

codecov Bot commented Nov 30, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #125 (e91b78d) into master (60e5ba1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #125   +/-   ##
=======================================
  Coverage   89.29%   89.29%           
=======================================
  Files          10       10           
  Lines         271      271           
=======================================
  Hits          242      242           
  Misses         22       22           
  Partials        7        7           

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 60e5ba1...2366c48. Read the comment docs.

@google-cla

google-cla Bot commented Nov 30, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@n3wscott

Copy link
Copy Markdown
Author

@googlebot I fixed it.

@google-cla

google-cla Bot commented Nov 30, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla Bot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Nov 30, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 30, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2020
@vagababov

Copy link
Copy Markdown

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 2, 2020
@n3wscott

n3wscott commented Dec 2, 2020

Copy link
Copy Markdown
Author

/retest


# Setup the env for doing Knative style codegen.

kn_hack_library=${kn_hack_library:-"$(dirname $0)/../vendor/knative.dev/hack/library.sh"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

$(dirname 0) will be ~/go/src/knative/discovery/vendor/knative.dev/hack so this'll resolve to ~/go/src/knative/discovery/vendor/knative.dev/vendor/knative.dev/hack/library.sh which I don't think is what you intend

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think $0 is the file used as the entry point, and this file is intended to be sourced from the current codegen files. Is that not how it works?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This works locally and on github actions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it depends on how the entrypoint is invoked. if it's invoked with a relative path, then it'll be relative. if it's invoked with an absolute path, then it'll be absolute.

BONUS: if it's invoked via a symlink, it can be literally anything you want!
TRIVIA: this is how busybox compresses dozens of commands into a single binary

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The main point is codegen-library.sh is not invoked, it is sourced.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps Cory's point is that you don't know from where 😉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, no. I think his comment is incorrect, but this does highlight another issue, which is that you are assuming the structure of the repo that's including things. 🤷

@n3wscott n3wscott Dec 2, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I am making the assumption that 1- they are using go mod, 2 - they are invoking from a $PROJECT_ROOT/<FOLDER>, and 3- they are vendoring.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

it is not called the hack repo for nothing

@knative-prow-robot knative-prow-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. labels Dec 2, 2020
@knative-prow-robot knative-prow-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 2, 2020
@vagababov

Copy link
Copy Markdown

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 2, 2020
@knative-prow-robot
knative-prow-robot merged commit 0753d2a into knative-extensions:master Dec 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. 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.

5 participants