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 module name to k8c.io/kubermatic/v2 #5728

Merged
merged 4 commits into from
Aug 6, 2020

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Aug 4, 2020

What this PR does / why we need it:
Step 3 on our way to use Go Modules as defined in #5439: Change the module name.

Does this PR introduce a user-facing change?:

Changed Go module name to k8c.io/kubermatic/v2

@kubermatic-bot kubermatic-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. team/lifecycle size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 4, 2020
@xrstf
Copy link
Contributor Author

xrstf commented Aug 4, 2020

/retest

@xrstf xrstf changed the title WIP - change module name to k8c.io/kubermatic/v2 Change module name to k8c.io/kubermatic/v2 Aug 4, 2020
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2020
cmd/conformance-tests/run.sh Outdated Show resolved Hide resolved
docs/dev-getting-started.md Outdated Show resolved Hide resolved
docs/dev-getting-started.md Outdated Show resolved Hide resolved
hack/ci/ci-run-offline-test.sh Outdated Show resolved Hide resolved
@kgroschoff
Copy link
Contributor

/approve

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kgroschoff, xrstf

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

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2020
@xrstf
Copy link
Contributor Author

xrstf commented Aug 5, 2020

/retest

# move files into their correct location, generate-groups.sh does not handle
# non-v1 module names very well
cp -r v2/* .
rm -rf v2/
Copy link
Member

Choose a reason for hiding this comment

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

is this still necessary or inclusion of k8c.io/kubermatic/v2 in vanitygen solved the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, now I understand, this is still required. The updated vanity URL has no impact on this particular hack.

Copy link
Member

Choose a reason for hiding this comment

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

If the source code initially placed in $GOPATH/src/k8c.io/kubermatic/v2, then codegen works perfectly well, without need for hacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah but you cannot go-get Kubermatic into a v2 directory. I tried it with a random module:

$ go get -u -v github.com/cespare/xxhash/v2
github.com/cespare/xxhash (download)
package github.com/cespare/xxhash/v2: cannot find package "github.com/cespare/xxhash/v2" in any of:
        /usr/local/go/src/github.com/cespare/xxhash/v2 (from $GOROOT)
        /home/xrstf/gospace/src/github.com/cespare/xxhash/v2 (from $GOPATH)

$ go get -u -v github.com/cespare/xxhash
github.com/cespare/xxhash (download)

I doubt that we would have to clone Kubermatic into a v2 directory.

Copy link
Member

Choose a reason for hiding this comment

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

$ go get -v github.com/cespare/xxhash/v2
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/cespare/xxhash v1.1.0
go: github.com/cespare/xxhash/v2 upgrade => v2.1.1
github.com/cespare/xxhash/v2

Copy link
Member

Choose a reason for hiding this comment

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

I suppose you had GO111MODULE=off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But go get places the module into pkg/, not into src/, so how does it relate?

@xrstf
Copy link
Contributor Author

xrstf commented Aug 5, 2020

/retest

1 similar comment
@xrstf
Copy link
Contributor Author

xrstf commented Aug 5, 2020

/retest

@@ -40,6 +40,7 @@ presubmits:
run_if_changed: "^(cmd|codegen|hack|pkg)/"
decorate: true
clone_uri: "ssh://git@github.com/kubermatic/kubermatic.git"
path_alias: k8c.io/kubermatic
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
path_alias: k8c.io/kubermatic
path_alias: k8c.io/kubermatic/v2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be wrong. The repo is not cloned to /v2. Or is it? I don't have it there, I have it in $GOPATH/src/k8c.io/kubermatic.

Copy link
Member

Choose a reason for hiding this comment

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

I've tried this way (moved my local repo into $GOPATH/src/k8c.io/kubermatic/v2) and codegen was perfect!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forgive my language, but having the entire repo unter v2/ is just .... so ugly that I would backpeddle on the whole proposal and not include the version in the module name at all :-D

Copy link
Member

@kron4eg kron4eg Aug 6, 2020

Choose a reason for hiding this comment

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

The point is that "codegen shell scripts" from k8s.io/code-generator don't care about modules and always treat package names as paths, thus — they will generate to the $GOPATH/src/k8c.io/kubermatic/v2. So in order to have normally working codegen locally one will have to git clone into the $GOPATH/src/k8c.io/kubermatic/v2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or, how about we keep the two lines in the bash script and thereby get the best of both worlds? Working codegen and a sane repository structure, where ../dashboard is actually still the dashboard. Nobody will ever do a git clone https://github.com/kubermatic/kubermatic v2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, sure, on CI nobody cares about the path_alias. But I think it's good to have the script work on CI and locally, so both should use the same filesystem location for the repository.

Copy link
Member

Choose a reason for hiding this comment

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

I want to left a warning for the reference, because it caught me unguarded. With go mods it's now possible to place go sources anywhere, not just in $GOPATH/src/<FDPN>, but codegen doesn't know about this and it will mkdir -p $GOPATH/src/k8c.io/kubermatic/v2 and write files there, no matter where your real kubermatic is in the FS.

@xrstf
Copy link
Contributor Author

xrstf commented Aug 5, 2020

/retest

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2020
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 261c21e9ecf0ea254c7f67025a911ab9459ed745

@xrstf
Copy link
Contributor Author

xrstf commented Aug 6, 2020

/hold

Let's prepare others.

@kubermatic-bot kubermatic-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2020
@kubermatic-bot kubermatic-bot merged commit 821208f into kubermatic:master Aug 6, 2020
@kubermatic-bot kubermatic-bot added this to the v2.15 milestone Aug 6, 2020
@xrstf xrstf deleted the new-module-name branch August 26, 2020 23:09
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. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants