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

dockerTools: normalize arch to GOARCH #106703

Merged
merged 3 commits into from Dec 15, 2020

Conversation

terinjokes
Copy link
Contributor

@terinjokes terinjokes commented Dec 12, 2020

Docker (via containerd) and the the OCI Image Configuration imply and
suggest, respectfully, that the architecture set in images matches those
of GOARCH in the Go Language document.

This changeset updates the implimentation of getArch in dockerTools to
return GOARCH values, to satisfy Docker.

Fixes: #106695

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
    • Tested by loading cross-compiled image on arm64 and verifying execution without warnings
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@terinjokes terinjokes changed the title fix(dockerTools): normalize arch to GOARCH dockerTools: normalize arch to GOARCH Dec 12, 2020
@roberth
Copy link
Member

roberth commented Dec 13, 2020

Tested and improvement suggested here terinjokes#1.

@adisbladis could you have a look and confirm if these changes still work for you?

terinjokes and others added 3 commits December 15, 2020 02:14
Docker (via containerd) and the the OCI Image Configuration imply and
suggest, respectfully, that the architecture set in images matches those
of GOARCH in the Go Language document.

This changeset updates the implimentation of getArch in dockerTools to
return GOARCH values, to satisfy Docker.

Fixes: NixOS#106695
Not everyone has a suitable remote builder set up, so the cross-compilation
tests that _include_ running the result are separate. That way, most people
can run the majority of the test suite without the extra setup.
@roberth
Copy link
Member

roberth commented Dec 15, 2020

@ofborg build nixosTests.docker-tools nixosTests.docker-tools-cross

@roberth
Copy link
Member

roberth commented Dec 15, 2020

Fair enough, ofborg doesn't have remote builders set up, but tests pass locally, ehm remotely.

@roberth roberth merged commit 1b35b3d into NixOS:master Dec 15, 2020
@Ericson2314
Copy link
Member

If GOARCH is taking on a significance beyond Go, we might move to the lib to match the GCC arch and darwin arch, CC @matthewbauer

@roberth
Copy link
Member

roberth commented Dec 24, 2020

If GOARCH is taking on a significance beyond Go, we might move to the lib to match the GCC arch and darwin arch, CC @matthewbauer

It does seems so. Taking it from a package is not a problem here. I'm pretty sure that container stuff is strict in pkgs.go ;). We could extract it as a function or add it directly into cpuTypes. Having all this info in one place seems nice. With cpuTypes we remove the need for an extra function. Which is more like a table really. One big table is probably easier to understand than a join of two.

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

Successfully merging this pull request may close these issues.

dockerTools.buildLayeredImage uses wrong architecture
3 participants