salesforce / salesforce/rules_docker_compose_test

multiarch to build a linux/x86_64 go_test() on a Darwin/arm64 host ?

Open
#32 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Starlark
Stars
7
Forks
5
Avg merge
18h 49m
Merged PRs (30d)
3

Description

hey.

Would you be accepting of a PR that allows the user to run go_docker_compose_test() on an platform_host not matching the container arch?

ie:

go_docker_compose_test(
    name = "go-test-image-test",
    docker_compose_file = ":docker-compose.yml",
    docker_compose_test_container = "test_container",
+ platforms =  platforms = [ ":linux_arm64", ":linux_amd64" ],  # Mac and linux both run GOOS==linux
    test_srcs = glob(["**/*_test.go"]),
    test_deps = [],
    test_image_base = "@ubuntu",
)

...to allow building a multi-arch OCI (index + 2 images), even on a Mac? User-story here would be a Mac user testing linux OCI images locally and wanting to compile that unittest with the proper linux GOOS so that the test-runner runs in the container arch/os.

Alternatively, plumbing through GOOS might suffice, but GOARCH may still depend on the host.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the go_docker_compose_test rule and trace how platform_host, GOOS/GOARCH, and the test container image are currently selected. Determine whether the requested platforms can produce a multi-architecture OCI image index and run tests for the container architecture; done means a Darwin/arm64 host can test the corresponding linux image without mismatched binaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
build-system, devops, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.