-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 makefile test target for no longer be required manual steps to run the commands #3983
change makefile test target for no longer be required manual steps to run the commands #3983
Conversation
0787bc8
to
c4e3b7b
Compare
Hi @joelanford, Tks for your review the changes are made. 👍 See that it is working:
|
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.
This Makefile addition is unrelated to the manifests plugin, so it doesn't make sense to me to add it here. It should be added directly to the Go Makefile template, and it was in kubernetes-sigs/kubebuilder#1626 for go.kubebuilder.io/v3-alpha
. So the right solution is to support the v3-alpha plugin in the operator-sdk
binary so users can opt-in; this is the solution we discussed during triage.
@estroz Do you think there's a path for us to make the default scaffolding work with the Kubebuilder v2 plugin? I think the problem we'll find with the v3-alpha plugin is that no one will use it until it is the default. |
Yes, since this is a non-breaking change I think kubernetes-sigs/kubebuilder#1626 can be backported to the v2 plugin. @camilamacedo86 can you create a PR for this upstream? |
Hi @estroz, I agree that in this case, we might able to push to v2+ as well. Could you please check the PR: kubernetes-sigs/kubebuilder#1711 for we are able to bump the kb commit here? |
HI @joelanford @estroz, |
@@ -18,12 +18,17 @@ package manifests | |||
import ( |
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.
These changes shouldn't be in the manifests plugin, they should be in their own internal/plugins/envtest
plugin.
can confirm that this works, but I agree with @estroz that it should be in its own file, and then we can just delete it when the upstream fix gets merged |
4488fb4
to
45340d9
Compare
… run the commands
45340d9
to
a2c962b
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.
Some nits, otherwise lgtm
internal/plugins/envtest/init.go
Outdated
// ControllerRuntimeEnvTestVersion version to be used to download the envtest setup script | ||
// todo: update the tag release when the next version of the project be released with this script | ||
const controllerRuntimeEnvTestVersion = "v0.6.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.
// ControllerRuntimeEnvTestVersion version to be used to download the envtest setup script | |
// todo: update the tag release when the next version of the project be released with this script | |
const controllerRuntimeEnvTestVersion = "v0.6.3" | |
// controllerRuntimeVersion version to be used to download the envtest setup script | |
// todo: update the tag release when the next version of the project be released with this script | |
const controllerRuntimeVersion = "v0.6.3" |
internal/plugins/envtest/init.go
Outdated
|
||
makefileBytes = []byte(strings.Replace(string(makefileBytes), | ||
"# Run tests\ntest: generate fmt vet manifests\n\tgo test ./... -coverprofile cover.out", | ||
fmt.Sprintf(makefileTestTarget, controllerRuntimeEnvTestVersion), 1)) |
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.
fmt.Sprintf(makefileTestTarget, controllerRuntimeEnvTestVersion), 1)) | |
fmt.Sprintf(makefileTestTarget, controllerRuntimeVersion), 1)) |
internal/plugins/envtest/init.go
Outdated
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin | ||
test: generate fmt vet manifests | ||
mkdir -p ${ENVTEST_ASSETS_DIR} | ||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/%s/hack/setup-envtest.sh | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out` |
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.
Consistency nit:
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin | |
test: generate fmt vet manifests | |
mkdir -p ${ENVTEST_ASSETS_DIR} | |
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/%s/hack/setup-envtest.sh | |
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out` | |
ENVTEST_ASSETS_DIR = $(shell pwd)/testbin | |
test: generate fmt vet manifests | |
mkdir -p $(ENVTEST_ASSETS_DIR) | |
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/%s/hack/setup-envtest.sh | |
source $(ENVTEST_ASSETS_DIR)/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out` |
internal/plugins/envtest/init.go
Outdated
// ControllerRuntimeEnvTestVersion version to be used to download the envtest setup script | ||
const controllerRuntimeEnvTestVersion = "v0.6.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.
// ControllerRuntimeEnvTestVersion version to be used to download the envtest setup script | |
const controllerRuntimeEnvTestVersion = "v0.6.3" | |
// controllerRuntimeVersion version to be used to download the envtest setup script | |
const controllerRuntimeVersion = "v0.6.3" |
internal/plugins/envtest/init.go
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// TODO: it will no longer required when the default plugin be v3+ |
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.
Isn't this going into v2?
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.
Not decided and merged to v2 yet. We might clarify it.
/lgtm |
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.
A couple of nits.
Change the makefile target test for no longer be required manually changes and | ||
steps to setup the envtest. |
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.
Change the makefile target test for no longer be required manually changes and | |
steps to setup the envtest. | |
In Go projects, resolved an issue that caused failing tests by changing the Makefile's `test` target to automatically download and configure the necessary `envtest` binaries. |
internal/plugins/golang/v2/init.go
Outdated
"github.com/operator-framework/operator-sdk/internal/plugins/envtest" | ||
|
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.
This should be grouped with the other SDK imports.
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
After addressing Eric's filemode suggestion.
New changes are detected. LGTM label has been removed. |
34d586a
to
46197c0
Compare
hack/tests/sanity-check.sh
Outdated
@@ -14,4 +14,4 @@ make install | |||
go run ./hack/generate/samples/generate_all.go | |||
|
|||
# Make sure repo is still in a clean state. | |||
git diff --exit-code | |||
git diff --exit-code -- . ':!testdata/go/memcached-operator/bin/*' |
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.
This can be removed for now. We can address in a follow-up.
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.
OK.
@@ -110,3 +110,7 @@ website/public/ | |||
website/resources/ | |||
website/node_modules/ | |||
website/tech-doc-hugo | |||
|
|||
# samples bin | |||
testdata/go/memcached-operator/bin/* |
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.
This can be removed for now. We can address in a follow-up.
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.
IHMO we should keep in order to ensure that the bin will not be committed never and ever,
The Ansible test is failing. |
The test make target required some preparations,specifically etcd was not found in the expected location. This adds the changes from operator-framework/operator-sdk#3983 to the test target to make it autonomous. Signed-off-by: Michael Adam <obnox@redhat.com>
The test make target required some preparations,specifically etcd was not found in the expected location. This adds the changes from operator-framework/operator-sdk#3983 to the test target to make it autonomous. Signed-off-by: Michael Adam <obnox@redhat.com>
Description of the change:
Update the Makefile test target as discussed in the demo.
Motivation for the change:
Closes: #3692
Checklist
If the pull request includes user-facing changes, extra documentation is required:
changelog/fragments
(seechangelog/fragments/00-template.yaml
)website/content/en/docs
Local Tests
And to check that is running: