diff --git a/bazel/container_structure_test.bzl b/bazel/container_structure_test.bzl index 9a01e233..e59d183d 100644 --- a/bazel/container_structure_test.bzl +++ b/bazel/container_structure_test.bzl @@ -15,6 +15,10 @@ _attrs = { values = ["docker", "tar", "host"], doc = "See https://github.com/GoogleContainerTools/container-structure-test#running-file-tests-without-docker", ), + "platform": attr.string( + default = "linux/amd64", + doc = "Set platform if host is multi-platform capable (default \"linux/amd64\")", + ), "_runfiles": attr.label(default = "@bazel_tools//tools/bash/runfiles"), "_windows_constraint": attr.label(default = "@platforms//os:windows"), } @@ -58,6 +62,9 @@ def _structure_test_impl(ctx): for arg in ctx.files.configs: fixed_args.extend(["--config", "$(rlocation %s)" % to_rlocation_path(ctx, arg)]) + if ctx.attr.platform: + fixed_args.extend(["--platform", ctx.attr.platform]) + bash_launcher = ctx.actions.declare_file("%s.sh" % ctx.label.name) ctx.actions.write( bash_launcher,