@@ -22,53 +22,6 @@ containsElement () {
2222 return 1
2323}
2424
25- createDockerBuildfileContent () {
26- base_path=" $( git rev-parse --show-toplevel) /integration"
27- packages=" $1 "
28- cat << EOF > "${base_path} /BUILD.bazel"
29- load("@io_bazel_rules_docker//container:container.bzl", "container_image")
30- load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit_layer")
31- load("@io_bazel_rules_docker//docker/package_managers:download_pkgs.bzl", "download_pkgs")
32- load("@io_bazel_rules_docker//docker/package_managers:install_pkgs.bzl", "install_pkgs")
33-
34- # Base docker image for our Scala services
35- download_pkgs(
36- name = "base_packages",
37- image_tar = "@openjdk_11_slim//image",
38- packages = [
39- "${packages} ",
40- ],
41- )
42-
43- install_pkgs(
44- name = "install_base_packages",
45- image_tar = "@openjdk_11_slim//image",
46- installables_tar = ":base_packages.tar",
47- installation_cleanup_commands = "rm -rf /var/lib/apt/lists/*",
48- output_image_name = "install_base_packages",
49- )
50-
51- container_run_and_commit_layer(
52- name = "base_run_commands",
53- commands = [
54- "wget -O /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.6/grpc_health_probe-linux-amd64",
55- "chmod +x /bin/grpc_health_probe",
56- ],
57- image = "install_base_packages.tar",
58- )
59-
60- container_image(
61- name = "scala_base_image",
62- base = "@openjdk_11_slim//image",
63- layers = ["base_run_commands"],
64- symlinks = {
65- "/usr/bin/java": "/usr/local/openjdk-11/bin/java",
66- },
67- visibility = ["//visibility:public"],
68- )
69- EOF
70- }
71-
7225$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json -co $command_options
7326
7427$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path -m $modified_filepaths_output $final_hashes_json -co $command_options
9750 echo " FAILURE: Incorrect impacted targets: ${impacted_targets[@]} "
9851 exit 1
9952fi
100-
101- echo " ==================================="
102- echo " Testing rules_docker config change"
103-
104- docker_modified_filepaths_output=/tmp/docker_modified_filepaths_output.txt
105-
106- createDockerBuildfileContent wget
107-
108- $bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json -co $command_options
109-
110- createDockerBuildfileContent curl
111-
112- echo " BUILD.bazel" >> $docker_modified_filepaths_output
113-
114- $bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path -m $docker_modified_filepaths_output $final_hashes_json -co $command_options
115-
116- $bazel_path run :bazel-diff $shared_flags -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_targets_path -aq " attr('tags', 'manual', //...)" -co $command_options
117-
118- IFS=$' \n ' read -d ' ' -r -a impacted_targets < $impacted_targets_path
119- target1=" //:base_packages"
120- if containsElement $target1 " ${impacted_targets[@]} "
121- then
122- echo " SUCCESS: Correct impacted targets: ${impacted_targets[@]} "
123- else
124- echo " FAILURE: Incorrect impacted targets: ${impacted_targets[@]} "
125- exit 1
126- fi
0 commit comments