Closed lentzi90 closed 2 weeks ago
Maybe also worth mentioning that at least CAPO and CAPA also uses the e2e
build tag in this way to keep the e2e code separated from the rest.
/cc @mquhuy @kashifest I would value your input on this
@lentzi90: GitHub didn't allow me to request PR reviews from the following users: on, would, your, input, I, value, this.
Note that only metal3-io members and repo collaborators can review this PR, and authors cannot review their own PRs.
This would be useful. Thanks for adding it.
One exception is golangci-lint. In order for it to go through all code, we need to include the build tags when running the linters. Developers that want to run golangci-lint will need the libvirt bindings.
Do we need to change something for this? I can see we only run golangci-lint locally, we dont build/tag anything?
/retest
/hold I see I have missed to change the path in some place. Let me fix that.
Do we need to change something for this? I can see we only run golangci-lint locally, we dont build/tag anything?
If we want golangci-lint to check the code that binds to libvirt there is no way around it unfortunately. I'm not sure how golangci-lint works, but in some sense it must be building the code because it sees the same error as go build
does if the libvirt-dev package isn't installed.
We could chose to split the linting so that test/vbmctl
would be a separate target. Then it would be possible to run make lint
without libvirt bindings. However, then there is the risk that we forget to run the separate target. I don't have a strong opinion on what is better.
We could for example have it like this:
make lint
: Only checks code without build tags. Works without libvirt-dev.make lint-e2e
: Only checks code under test
. Requires libvirt-dev./retest
/retest
These fixture test failures are driving me mad... Attempting to fix in https://github.com/metal3-io/baremetal-operator/pull/2043
Do we need to change something for this? I can see we only run golangci-lint locally, we dont build/tag anything?
If we want golangci-lint to check the code that binds to libvirt there is no way around it unfortunately. I'm not sure how golangci-lint works, but in some sense it must be building the code because it sees the same error as
go build
does if the libvirt-dev package isn't installed.We could chose to split the linting so that
test/vbmctl
would be a separate target. Then it would be possible to runmake lint
without libvirt bindings. However, then there is the risk that we forget to run the separate target. I don't have a strong opinion on what is better.We could for example have it like this:
make lint
: Only checks code without build tags. Works without libvirt-dev.make lint-e2e
: Only checks code undertest
. Requires libvirt-dev.
No strong preference from me, but imo it would be good to not have to install libvirt-dev in the lint job.
We could repurpose the current lint workflow to be the lint-e2e, and config it so that it only runs when we edit the code inside the test/vbmctl
directory.
Otherwise, I think this PR is a nice improvement. Not sure if any developer will ever work on this repo without installing libvirt-dev
, but it's nice to at least have options.
/retest
/lgtm
/hold cancel Tests are passing :tada:
I'm still open to discuss how we handle the linters, but if you are happy like this, then lets merge @kashifest
Lets merge it and see if the we need a change in the linter once we hit an issue /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: kashifest
The full list of commands accepted by this bot can be found here.
The pull request process is described here
/test test
/test test
/retest
We seem to be hitting the golanci-lint deadline. Fixing here: https://github.com/metal3-io/baremetal-operator/pull/2046
/cherry-pick release-0.8
@lentzi90: #2042 failed to apply on top of branch "release-0.8":
Applying: E2E: Add build tags
Using index info to reconstruct a base tree...
M .golangci.yaml
M Makefile
M hack/ci-e2e.sh
M test/e2e/basic_ops_test.go
M test/e2e/cert_manager.go
M test/e2e/common.go
M test/e2e/e2e_config.go
M test/e2e/e2e_suite_test.go
M test/e2e/external_inspection_test.go
M test/e2e/inspection_test.go
M test/e2e/live_iso_test.go
M test/e2e/provisioning_and_annotation_test.go
M test/e2e/re_inspection_test.go
M test/e2e/upgrade_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/upgrade_test.go
Auto-merging test/e2e/re_inspection_test.go
Auto-merging test/e2e/provisioning_and_annotation_test.go
Auto-merging test/e2e/live_iso_test.go
Auto-merging test/e2e/inspection_test.go
Auto-merging test/e2e/external_inspection_test.go
Auto-merging test/e2e/e2e_suite_test.go
Auto-merging test/e2e/e2e_config.go
Auto-merging test/e2e/common.go
Auto-merging test/e2e/cert_manager.go
Auto-merging test/e2e/basic_ops_test.go
Auto-merging hack/ci-e2e.sh
CONFLICT (content): Merge conflict in hack/ci-e2e.sh
Auto-merging Makefile
Auto-merging .golangci.yaml
CONFLICT (content): Merge conflict in .golangci.yaml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 E2E: Add build tags
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
This makes use of build tags for the e2e tests and related tools. The goal is to make it easier to compile and develop BMO by relaxing the requirement for libvirt bindings. They are now only needed when working on the relevant code.
One exception is golangci-lint. In order for it to go through all code, we need to include the build tags when running the linters. Developers that want to run golangci-lint will need the libvirt bindings.
What this PR does / why we need it:
Developer doesn't have libvirt-dev installed and runs
make unit
->