-
Notifications
You must be signed in to change notification settings - Fork 164
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
full module path for api #3079
full module path for api #3079
Conversation
I do have a third alternative, which would eliminate Have
Is this better? I still lean towards separate PRs, maybe even separate repos, as these are separate things. But I can see the "these are close together" arguments (although an independent API repo would encourage other implementations). If we want both of those, we can go down that path. |
@deitch Without the replace directives, if we still have make proto-vendor, shouldn't it work the same as today? If this works then I have one more RFE which is to have make proto-vendor handle not only pillar but also newlog and edgeview. |
Sounds fine, but let's do that in two PRs? One that changes current functionality, another that expands that functionality. |
You mean the structure in this PR? No, it wouldn't, because we just do If we take the alternative, wherein Well, we could use I could be convinced of any of the above:
|
I think the minimum requirement is to 1) get rid of the replace directive and 2) preserve or fully provide a new developer workflow for EVE API updates. I don't think in #2 we should require two separate commits. Today for pillar the current working workflow is:
For newlogd and edgeview step 3 is different; it could be that (cd pkg/foo; go mod vendor) works but I haven't checked. Does that make sense? |
I understand it. I do not fully agree that two separate commits is wrong. I think it would be very healthy for the eve API to be a standalone resources, one that is thought about and built and, yes, committed, without a stitch of code using it. But I also understand the alternate perspective and can work with it. If we really do not want two separate commits, then I think a make target that either copies them in or does As for the others:
I can try and make a separate commit showing the "copy it in" approach. Then we can pick one commit and delete the other. |
OK, copy will not work, nor will just generating. We build the protobufs with a specific path in hand, e.g.: package org.lfedge.eve.attest;
option go_package = "github.com/lf-edge/eve/api/go/attest";
option java_package = "org.lfedge.eve.attest"; That means the go path must be that, and copying it into I do not have a better answer right now. |
It's vendored, not copied to a different path. Why doesn't that work? |
I think we are talking about different things. This PR is fixing an issue due to the replace directives. |
OK. Something for the future.
I don't know of a way to do it at this point. Because go-compiled protobufs include the module path in them, they have to be at I am at a bit of a loss now. There doesn't appear to be a way to do it. @eriknordmark unless you see some other way, I am going to close this one out, and we will live with this not nice |
Not in pkg/pillar/api but in pkg/pillar/vendor/github.com/lf-edge/eve/api. |
No, certainly not saying that; it would indeed defeat the purpose of vendoring. I am saying that what is in |
Got it. |
Yep. And hack |
No, don't need that. Once the PR with all the pieces is pushed to master things are sane; a go mod vendor will not change anything. By all the pieces I mean
|
Basically with this Makefile hack (which should be commented) the existing workflow works: index ed2661135..463ca2f90 100644
--- a/Makefile
+++ b/Makefile
@@ -696,6 +696,11 @@ cache-export-docker-load-all: $(LINUXKIT) $(addsuffix -cache-export-docker-load,
proto-vendor:
@$(DOCKER_GO) "cd pkg/pillar ; go mod vendor" $(CURDIR) proto
+ @$(DOCKER_GO) "cp -rp api/go pkg/pillar/vendor/github.com/lf-edge/eve/api/" $(CURDIR) proto
+ @$(DOCKER_GO) "cd pkg/newlog ; go mod vendor" $(CURDIR) proto
+ @$(DOCKER_GO) "cp -rp api/go pkg/newlog/vendor/github.com/lf-edge/eve/api/" $(CURDIR) proto
+ @$(DOCKER_GO) "cd pkg/edgeview ; go mod vendor" $(CURDIR) proto
+ @$(DOCKER_GO) "cp -rp api/go pkg/edgeview/vendor/github.com/lf-edge/eve/api/" $(CURDIR) proto
proto-diagram: $(GOBUILDER)
@$(DOCKER_GO) "/usr/local/bin/protodot -inc /usr/include -src ./api/proto/config/devconfig.proto -output devconfig && cp ~/protodot/generated/devconfig.* ./api/images && dot ./api/images/devconfig.dot -Tpng -o ./api/images/devconfig.png && echo generated ./api/images/devconfig.*" $(CURDIR) api @naiming-zededa when I try this I see that go mod vendor does not update the vendor directory in pkg/edgeview; same if I do go mod vendor manually in pkg/edgeview. Is there something different between it and newlog? |
@eriknordmark not sure. will this be related to 'go.mod' name resolvable in the other PR? |
@eriknordmark do you mind fixing the triple-backticks on your makefile? It is difficult to read. |
What are you proposing? That we run The reason it concerns me is that standard commands, like |
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.
How about you
- Remove the now useless/confusing proto-vendor taget from the Makefile
- Document the new workflow which is to first commit to api, then to vendor in the new API, then to use it in a separate commit
- Document a way for a developer to test compiling using the new API (which is basically cp -rp api/go/* pkg/$PKG/vendor/github.com/lf-edge/eve/api/go/)
- Send a heads up to the lf-edge EVE list about this.
Then we can proceed with this PR.
Is it useless? It calls
Adding. |
Added those docs. Take a look now @eriknordmark |
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'm trying to understand the intended sequence of changes for both api and libs which minimizes intermediate approaches for the EVE developes. What I undderstand is:
- Request creation of github.com/lf-edge/eve-{api,libs}
- Communicate on EVE mailing list(s) and slack the upcoming change to developer flow
- Some set of PRs, including this one.
- Copying the content/history from eve/libs to eve-libs and from eve/api to eve-api
- Changing all users of eve/libs and eve/api to use the new import paths (including controllers). That will mean at least one PR for EVE, plus adam/eden.
- Send out a message to EVE mailing lists and slack indicating that the new workflow is in place.
- Delete the content (and history?) from eve/libs and eve/api.
Anything I'm missing? Any additional EVE changes we need in step 3?
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'm trying to understand the intended sequence of changes for both api and libs which minimizes intermediate approaches for the EVE developes. What I undderstand is:
- Request creation of github.com/lf-edge/eve-{api,libs}
- Communicate on EVE mailing list(s) and slack the upcoming change to developer flow
- Some set of PRs, including this one.
- Copying the content/history from eve/libs to eve-libs and from eve/api to eve-api
- Changing all users of eve/libs and eve/api to use the new import paths (including controllers). That will mean at least one PR for EVE, plus adam/eden.
- Send out a message to EVE mailing lists and slack indicating that the new workflow is in place.
- Delete the content (and history?) from eve/libs and eve/api.
Anything I'm missing? Any additional EVE changes we need in step 3?
Signed-off-by: Avi Deitcher <avi@deitcher.net>
Overall, I think you are correct. I would not delete the history, just the content. I want to get this PR in first, i.e. doing it locally, and then one each for eve-api and eve-libs. Cleaner separation. Is there anything else we need for this PR on its own? |
I'd like to see the heads up email and slack message being sent before we merge this PR. |
Sure thing. |
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 but we need a heads up message to the EVE developers on email and slack.
Email and slack out. |
This PR removes any relative
replace
paths forapi/go
, e.g. this one:This has some benefits and a drawbacks.
On the benefits side, it eliminates more
replace
clauses, which are unfriendly to many things, including using things in libraries and usinggo install
. More importantly., it eliminates the last vestiges of relative paths inpillar
and a few other places, so the compiled binaries include explicit modules.The drawback is that it requires an additional step to make api changes. @eriknordmark pointed this out with the following example.
Current process to make api changes:
make proto
- buildsapi/go
,api/python
, etc. from the updated proto files3.
make proto-vendor
- updatespkg/pillar/vendor
with the latest version from the relative path*.go
filesmake pkg/foo
- e.g.pkg/pillar
If this PR goes through, we have something a little bit longer
make proto
- buildsapi/go
,api/python
, etc. from the updated proto filespillar
, dogo get github.com/lf-edge/eve/api/go@master && go mod tidy && go mod vendor
- these replacemake porto-vendor
, but we easily could just havemake proto-vendor
do all of this for us.*.go
filesmake pkg/foo
- e.g.pkg/pillar
The key here is that
api/go
starts being treated as a standalone upstream dependency of pillar and other packages, like any other; controllers (e.g. Zedcloud or Adam) have to function that way already.The reverse argument is that eve's API is, well, for eve. Maybe it should be tied tightly together with eve itself.
It is my opinion that this does not go far enough, that api should be its own repo, with a smaller and lighter CI, that need only test for the ability to compile the protobufs , and some tests for backwards compatibility.
The dev process might still include temporary
replace
lines ingo.mod
, just like any other upstream dependency which is not in the same repository.I am opening this PR to prompt the discussion.