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

Incompatibility with rules_docker and current rules_go #943

Closed
chrislovecnm opened this issue Jun 28, 2019 · 11 comments
Closed

Incompatibility with rules_docker and current rules_go #943

chrislovecnm opened this issue Jun 28, 2019 · 11 comments

Comments

@chrislovecnm
Copy link

chrislovecnm commented Jun 28, 2019

bazel version:

$ bazel version
Build label: 0.26.1-homebrew

Note: I am using rules_go https://github.com/bazelbuild/rules_go/tree/8ea79bbd5e6ea09dc611c245d1dc09ef7ab7118a because I am trying to get cross compilation working again.

I am noticing an issue was introduced with the current 0.8.1 release. When using 0.8.1 and https://github.com/bazelbuild/rules_go/tree/8ea79bbd5e6ea09dc611c245d1dc09ef7ab7118a from rules_go I am getting the error:

ERROR: While resolving toolchains for target //:external_dns_image: no matching toolchains found for types @io_bazel_rules_docker//toolchains/docker:toolchain_type
ERROR: Analysis of target '//:external_dns_image' failed; build aborted: no matching toolchains found for types @io_bazel_rules_docker//toolchains/docker:toolchain_type

With rules_docker 0.8.0 I do not get this error when I am not cross compiling. When I use --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64, 0.8.0 does not work as well.

I have tried to add the docker_toolchain_configure calls and also the calls to register the tool chains. Using the docker_toolchain_configure does not help. Using the register_toolchains call just give me a weird error that @gzip does not exist.

The repo that I am working out of is located here: https://github.com/chrislovecnm/external-dns/tree/work-on-bazel

@chrislovecnm
Copy link
Author

chrislovecnm commented Jun 28, 2019

Actually I am also getting the following error as well with 0.8.0:

 $ bazel build //...
INFO: Build option --platforms has changed, discarding analysis cache.
ERROR: While resolving toolchains for target //:external_dns_image: no matching toolchains found for types @io_bazel_rules_docker//toolchains/docker:toolchain_type
ERROR: Analysis of target '//:external_dns_image' failed; build aborted: no matching toolchains found for types @io_bazel_rules_docker//toolchains/docker:toolchain_type
INFO: Elapsed time: 0.220s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 143 targets configured)

When I am using the cross compilation flag: build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

@chrislovecnm chrislovecnm changed the title Incompatibility introduced in release v0.8.1 and current rules_go Incompatibility with rules_docker and current rules_go Jun 28, 2019
@chrislovecnm
Copy link
Author

Let me add a bit of clarity.

rules_docker 0.8.0 works sorta when I do not specify build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64. Which of course is not gonna build a proper container because I am then compiling a darwiin binary, and creating a linux container. As soon as I use build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 I am getting the above error.

rules_docker 0.8.1 does not work at all ...

@chrislovecnm
Copy link
Author

cc @nlopezgi

@chrislovecnm
Copy link
Author

chrislovecnm commented Jun 28, 2019

Here is the weird @gzip error I am getting as well:

$ bazel build //:external_dns_image
ERROR: /Users/chlove/Workspace/src/github.com/kubernetes-incubator/external-dns/BUILD.bazel:37:1: every rule of type _app_layer implicitly depends upon the target '@gzip//:gzip', but this target could not be found because of: no such package '@gzip//': The repository '@gzip' could not be resolved
ERROR: Analysis of target '//:external_dns_image' failed; build aborted: no such package '@gzip//': The repository '@gzip' could not be resolved

@nlopezgi
Copy link
Contributor

Hey @chrislovecnm ,
I don't think we made any changes to toolchains between 0.8.0 and 0.8.1.
The only thing we did change is how go dependencies are created (https://github.com/bazelbuild/rules_docker/pull/936/files). Can you bring your go imports + go toolchains declarations to the top of your WORKSPACE file to see if those changes somehow are affecting you? If so, I'll try to find a way to fix.

@chrislovecnm
Copy link
Author

Both 0.8.0 and 0.8.1 do not work. So the changes are in the rules_go, or in rules_docker after rules docker 0.7.x. Also we have all the new challenges will how bazel loads the C++ toolchains as well.

@chrislovecnm
Copy link
Author

It is not the bazel version. Just went back to 0.23.1 and had the same problem.

@chrislovecnm
Copy link
Author

This seems to be an issue with the new rules_go, because I went back to 0.7 rules_docker.

@nlopezgi
Copy link
Contributor

nlopezgi commented Jul 2, 2019

responded on the rules_go issue.
For now, I'm going to close this with the statement, running go_image from a mac is not supported. If rules_go works on explicitly supporting (and testing) this then we can change the position from the rules_docker side.

@jschaf
Copy link

jschaf commented Dec 7, 2020

It appears that the upstream rules_go bug is fixed: bazel-contrib/rules_go#2089.

@psigen
Copy link
Contributor

psigen commented Feb 1, 2021

@nlopezgi now that the upstream issue is resolved, what would be needed to retest this?

It would be great to be able to remove this scary-looking blurb from the README.md:
https://github.com/bazelbuild/rules_docker/blame/master/README.md#L48-L52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants