Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Oct 2, 2023
1 parent 12a432a commit 79792a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/bazelify_tests/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ def grpc_run_simple_command_test(name, args = [], data = [], size = "medium", ti
_dockerized_sh_test(name = name, srcs = srcs, args = args, data = data, size = size, timeout = timeout, tags = tags, exec_compatible_with = exec_compatible_with, flaky = flaky, docker_image_version = docker_image_version, env = env, docker_run_as_root = False)

def grpc_build_artifact_task(name, timeout = None, artifact_deps = [], tags = [], exec_compatible_with = [], flaky = None, docker_image_version = None, build_script = None):
"""Execute a build artifact task and a corresponding 'build test'
"""Execute a build artifact task and a corresponding 'build test'. The artifact is build by a genrule that always succeeds
(Even if the underlying build fails) and an sh_test (with "_build_test" suffix) that presents the result of the artifact build
in the result UI (by displaying the the build status, the log, and artifacts produced)
Args:
name: The name of the target.
Expand Down Expand Up @@ -289,6 +290,11 @@ def grpc_build_artifact_task(name, timeout = None, artifact_deps = [], tags = []

_dockerized_genrule(name = name, cmd = cmd, outs = genrule_outs, srcs = genrule_srcs, timeout = timeout, tags = tags, exec_compatible_with = exec_compatible_with, flaky = flaky, docker_image_version = docker_image_version, docker_run_as_root = False)

# The genrule above always succeeds (even if the underlying build fails), so that we can create rules that depend
# on multiple artifact builds (of which some can fail). The actual build status (exitcode) and the log of the build
# will be reported by an associated sh_test (that gets displayed in the UI in a much nicer way than a genrule).
# Note that in bazel you cannot declare a test that has declared outputs and you also cannot make other rules
# depend on a test - which is the reason why we need a separate genrule to represent the build itself.
test_name = str(name + "_build_test")
test_srcs = [
"//tools/bazelify_tests:grpc_build_artifact_task_build_test.sh",
Expand Down
1 change: 1 addition & 0 deletions tools/bazelify_tests/grpc_build_artifact_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tar -xopf ${ARCHIVE_WITH_SUBMODULES}
cd grpc

# Extract all input archives with artifacts into input_artifacts directory
# TODO(jtattermusch): Deduplicate the snippet below (it appears in multiple files).
mkdir -p input_artifacts
pushd input_artifacts >/dev/null
# all remaining args are .tar.gz archives with input artifacts
Expand Down
1 change: 1 addition & 0 deletions tools/bazelify_tests/grpc_run_distribtest_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tar -xopf ${ARCHIVE_WITH_SUBMODULES}
cd grpc

# Extract all input archives with artifacts into input_artifacts directory
# TODO(jtattermusch): Deduplicate the snippet below (it appears in multiple files).
mkdir -p input_artifacts
pushd input_artifacts >/dev/null
# all remaining args are .tar.gz archives with input artifacts
Expand Down

0 comments on commit 79792a1

Please sign in to comment.