-
Notifications
You must be signed in to change notification settings - Fork 157
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
Use new crd-schema-gen in Makefile #514
Use new crd-schema-gen in Makefile #514
Conversation
Note that this won't work right now because of openshift/api#362 |
4db1e86
to
ba1adbb
Compare
|
It's not about makefiles, but CI infra. Given our tests run as containers, it sounds like you are trying to do nested docker which you can't (easily), it may be possible with podman We'd need to extend the golang image with podman in a step or ask it to be included there (which I am not sure of, but there are already other tools there) I'd like to see the nested podman tested manually first |
5ddf565
to
f5929ed
Compare
bumped this to pull in API fixes and ran the new generator, looks like the missing top-level descriptions are there now but this also seemed to generate validations for ObjectMeta, which was apparently missing before. Does that look right? |
/retest |
/retest |
Makefile
Outdated
@@ -44,8 +44,10 @@ PKG := ${PWD:${GOPATH}/%=%} | |||
update-codegen-crds: | |||
docker run -v ${PWD}:/go/$(PKG):Z -w /go/$(PKG) registry.svc.ci.openshift.org/ocp/4.2:crd-schema-gen --apis-dir vendor/github.com/openshift/api/operator/v1 | |||
update-codegen: update-codegen-crds | |||
|
|||
TMP_GOPATH :=$(shell mktemp -d) |
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.
who deletes it?
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.
systemd
Makefile
Outdated
verify-codegen-crds: | ||
go get github.com/openshift/crd-schema-gen/... && go install github.com/openshift/crd-schema-gen/... | ||
export GOPATH=$(TMP_GOPATH) && export GOBIN=$(TMP_GOPATH)/bin && git clone -b release-4.2 --single-branch --depth 1 https://github.com/openshift/crd-schema-gen.git $(TMP_GOPATH)/src/github.com/openshift/crd-schema-gen && go install $(TMP_GOPATH)/src/github.com/openshift/crd-schema-gen/cmd/crd-schema-gen |
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.
GOPATH=$(TMP_GOPATH) GOBIN=... go install ...
is enough. No need to export. git does not use them.
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.
sure about GOBIN? We have to call it from there as well.
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.
some people like @stlaz have set GOBIN explicitly and without setting it to temp we install it to the global GOBIN instead the one in temporary GOPATH
Makefile
Outdated
verify-codegen-crds: | ||
go run ./vendor/github.com/openshift/library-go/cmd/crd-schema-gen/main.go --domain openshift.io --apis-dir vendor/github.com/openshift/api --verify-only | ||
git clone -b release-4.2 --single-branch --depth 1 https://github.com/openshift/crd-schema-gen.git $(TMP_GOPATH)/src/github.com/openshift/crd-schema-gen |
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.
thanks for the line breaks :)
Makefile
Outdated
@@ -44,8 +44,10 @@ PKG := ${PWD:${GOPATH}/%=%} | |||
update-codegen-crds: | |||
docker run -v ${PWD}:/go/$(PKG):Z -w /go/$(PKG) registry.svc.ci.openshift.org/ocp/4.2:crd-schema-gen --apis-dir vendor/github.com/openshift/api/operator/v1 | |||
update-codegen: update-codegen-crds | |||
|
|||
TMP_GOPATH :=$(shell mktemp -d) |
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.
systemd
Makefile
Outdated
crd-schema-gen: | ||
git clone -b release-4.2 --single-branch --depth 1 https://github.com/openshift/crd-schema-gen.git $(TMP_GOPATH)/src/github.com/openshift/crd-schema-gen | ||
GOPATH=$(TMP_GOPATH) go install $(TMP_GOPATH)/src/github.com/openshift/crd-schema-gen/cmd/crd-schema-gen | ||
crd-schema-gen --apis-dir vendor/github.com/openshift/api/operator/v1 |
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.
by convention we end phony target with `.PHONY: target-name
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 see that was preexisting, so it's up to you to fix it
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.
Is adding it to the .PHONY list at the end good?
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.
it works the same way, our convention is to use it as {}
to scope the target
8b9737e
to
a513b43
Compare
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.
the makefile structure looks good now, thx
@@ -40,11 +40,18 @@ test-e2e: GO_TEST_PACKAGES :=./test/e2e/... | |||
test-e2e: GO_TEST_FLAGS += -v | |||
test-e2e: test-unit | |||
|
|||
update-codegen-crds: | |||
go run ./vendor/github.com/openshift/library-go/cmd/crd-schema-gen/main.go --domain openshift.io --apis-dir vendor/github.com/openshift/api | |||
crd-schema-gen: |
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.
install-crd-schema-gen?
08b71d9
to
d66e166
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damemi, sttts 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 |
/test e2e-aws |
This is an example of how we could use the crd-schema-gen hosted image in our makefiles, and ultimately remove the dependency on the library-go scripts which were based on hacked and patched forks of dependencies. Ideally I think we could just add these commands to library-go's alpha-build-machinery helpers and import from there.