salesforce / salesforce/rules_docker_compose_test

Documentation of local_image_targets unclear

Open
#35 2 comments 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

What exactly do we put int local_image_targets?

My file is like this:

fake_cloudflare_api/BUILD

load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_binary")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_docker_compose_test//docker_compose_test:docker_compose_test.bzl", "docker_compose_test")

kt_jvm_library(
    name = "fake_cloudflare_api",
    srcs = ["Main.kt"],
)

java_binary(
    name = "bin",
    main_class = "iursino.ddnsdaemon.bin.testing.fakecloudflareapi.MainKt",
    runtime_deps = [
        ":fake_cloudflare_api"
    ]
)

pkg_tar(
    name = "jar_layer",
    srcs = [":bin_deploy.jar"],
)

oci_image(
    name = "image",
    base = "@distroless_java",
    entrypoint = [
        "java",
        "-jar",
        "/bin_deploy.jar"
    ],
    tars = [
        ":jar_layer"
    ]
)

oci_load(
    name = "load_image",
    image = ":image",
    repo_tags = ["fake_cloudflare_api:latest"]
)

sh_binary(
    name = "docker_image_fixture",
    srcs = [":load_image"],
)

filegroup(
    name = "tarball.tar",
    visibility = ["//src/lib/adapters/cloudflare_client:__subpackages__"],
    srcs = [
            ":load_image",
            ],
    output_group = "tarball"
)

docker_compose_test(
    name = "medium_test",
    docker_compose_file = ":test-docker-compose.yml",
    docker_compose_test_container = "sut_container",
    local_image_targets = "fake_cloudflare_api:load_image",
    data = [":docker_image_fixture"],
)

But I get "no install script present for fake_cloudflare_api/load_image" when I run bazel test //src/bin/testing/fake_cloudflare_api:medium_test

Note if I run bazel cquery --output=files //src/bin/testing/fake_cloudflare_api:docker_image_fixture I get

bazel-out/k8-fastbuild/bin/src/bin/testing/fake_cloudflare_api/load_image.sh
bazel-out/k8-fastbuild/bin/src/bin/testing/fake_cloudflare_api/docker_image_fixture

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 with the BUILD file example and the docker_compose_test rule's handling of local_image_targets. Reproduce the failure with bazel test ...:medium_test and compare it with the bazel cquery --output=files command shown. Done means the documentation clearly states the expected target and the example no longer leads to the reported install-script error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
build-system
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.