Skip to content

Commit

Permalink
Move tests that use 'docker' to GCB (#1290)
Browse files Browse the repository at this point in the history
* test

* test

* test

* test RBE test run

* test

* test

* test

* test

* test

* test

* test

* test
  • Loading branch information
alex1545 authored Nov 22, 2019
1 parent 941ac9b commit 0237f78
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 11 deletions.
96 changes: 85 additions & 11 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,48 @@ platforms:
ubuntu1604:
test_targets:
- "--"
- "..."
# Tests that don't use the 'docker' tool.
- "//container/go/pkg/compat:go_default_test"
- "//container/go/pkg/oci:go_default_test"
- "//container:image_test"
- "//docker/util:config_stripper_test"
- "//tests/container:alpine_custom_attr_digest_test"
- "//tests/container:alpine_linux_armv6_tar_test_image_tar"
- "//tests/container:basic_windows_image_test"
- "//tests/container:build_tar_test"
- "//tests/container:distroless_fixed_id_digest_test"
- "//tests/container:distroless_fixed_id_image_digest_test"
- "//tests/container:k8s_pause_arm64_digest_test"
- "//tests/container:new_alpine_linux_armv6_image_tar_digest_test"
- "//tests/container:new_alpine_linux_ppc64le_image_oci_go_join_layers_test"
- "//tests/container:new_distroless_base_oci_test_0_tar_gz"
- "//tests/container:new_distroless_base_oci_test_config"
- "//tests/container:pause_tar_test_0_tar_gz"
- "//tests/container:pause_tar_test_1_tar_gz"
- "//tests/container:pause_tar_test_config"
- "//tests/container:set_cmd_test_host"
- "//tests/container:special_characters_test"
- "//tests/container:test_digest_output1"
- "//tests/container:test_digest_output2"
- "//tests/container:test_push_digest_output"
- "//tests/contrib/automatic_container_release:test_metadata_merge"
- "//tests/contrib/automatic_container_release:test_packages_metadata"
- "//tests/contrib:rename_image_test"
- "//tests/contrib:test_compare_ids_test"
- "//tests/contrib:test_compare_ids_test_diff_ids_fails_no_regex"
- "//tests/contrib:test_id_compare_ids_test"
- "//tests/docker/package_managers:test_download_pkgs_rule"
- "//tests/docker/package_managers:test_install_pkgs_rule"
- "//tests/docker/package_managers:test_download_pkgs_docker_cp"
- "//tests/docker/package_managers:test_download_pkgs_docker_run"
- "//tests/docker/util:test_container_commit_rule"
- "//tests/docker/util:test_container_extract_rule"
- "//tests/docker/util:test_extract_script"

# Disabled tests that do not run in BuildKite CI.
# The targets listed below is not an exhaustive list of disabled targets
# and serves for informational purposes.

- "-//tests/docker/security/..."
# tests/docker/security require gcloud
- "-//tests/contrib:derivative_with_volume_repro_test"
Expand All @@ -28,17 +68,56 @@ platforms:
# Disabled e2e tests that pull from localhost in nested workspace
- "-//testing/new_pusher_tests/..."
# tests/contrib/test_compare_ids_test_* expect 'bazel' on path
# container_test and configs_test targets require 'docker' and are disabled
test_flags:
- "--action_env=PATH"
# For tests/container:set_env_make_vars
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--test_output=errors"
ubuntu1804:
test_targets:
- "--"
- "..."
# Tests that don't use the 'docker' tool.
- "//container/go/pkg/compat:go_default_test"
- "//container/go/pkg/oci:go_default_test"
- "//container:image_test"
- "//docker/util:config_stripper_test"
- "//tests/container:alpine_custom_attr_digest_test"
- "//tests/container:alpine_linux_armv6_tar_test_image_tar"
- "//tests/container:basic_windows_image_test"
- "//tests/container:build_tar_test"
- "//tests/container:distroless_fixed_id_digest_test"
- "//tests/container:distroless_fixed_id_image_digest_test"
- "//tests/container:k8s_pause_arm64_digest_test"
- "//tests/container:new_alpine_linux_armv6_image_tar_digest_test"
- "//tests/container:new_alpine_linux_ppc64le_image_oci_go_join_layers_test"
- "//tests/container:new_distroless_base_oci_test_0_tar_gz"
- "//tests/container:new_distroless_base_oci_test_config"
- "//tests/container:pause_tar_test_0_tar_gz"
- "//tests/container:pause_tar_test_1_tar_gz"
- "//tests/container:pause_tar_test_config"
- "//tests/container:set_cmd_test_host"
- "//tests/container:special_characters_test"
- "//tests/container:test_digest_output1"
- "//tests/container:test_digest_output2"
- "//tests/container:test_push_digest_output"
- "//tests/contrib/automatic_container_release:test_metadata_merge"
- "//tests/contrib/automatic_container_release:test_packages_metadata"
- "//tests/contrib:rename_image_test"
- "//tests/contrib:test_compare_ids_test"
- "//tests/contrib:test_compare_ids_test_diff_ids_fails_no_regex"
- "//tests/contrib:test_id_compare_ids_test"
- "//tests/docker/package_managers:test_download_pkgs_rule"
- "//tests/docker/package_managers:test_install_pkgs_rule"
- "//tests/docker/package_managers:test_download_pkgs_docker_cp"
- "//tests/docker/package_managers:test_download_pkgs_docker_run"
- "//tests/docker/util:test_container_commit_rule"
- "//tests/docker/util:test_container_extract_rule"
- "//tests/docker/util:test_extract_script"


# Disabled tests that do not run in BuildKite CI.
# The targets listed below is not an exhaustive list of disabled targets
# and serves for informational purposes.

- "-//tests/docker/security/..."
# tests/docker/security require gcloud
- "-//tests/contrib:derivative_with_volume_repro_test"
Expand All @@ -54,11 +133,9 @@ platforms:
# Disabled e2e tests that pull from localhost in nested workspace
- "-//testing/new_pusher_tests/..."
# tests/contrib/test_compare_ids_test_* expect 'bazel' on path
# container_test and configs_test targets require 'docker' and are disabled
test_flags:
- "--action_env=PATH"
# For tests/container:set_env_make_vars
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--test_output=errors"
macos:
build_targets:
Expand Down Expand Up @@ -110,9 +187,6 @@ platforms:
- "-//testing/new_pusher_tests/..."
test_flags:
- "--action_env=PATH"
# For tests/container:set_env_make_vars
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--test_output=errors"
# Needed because register_platforms is apparently not respecting order of
# platforms passed:
Expand Down
37 changes: 37 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,40 @@
build --incompatible_use_python_toolchains
test --incompatible_use_python_toolchains

# The flags below enable running tests using Remote Build Execution
# for the provided toolchain.
# Note that your WORKSPACE must contain an rbe_autoconfig target with
# name="buildkite_config" to use these flags as-is.

test:remote --remote_instance_name=projects/asci-toolchain/instances/default_instance

# Depending on how many machines are in the remote execution instance, setting
# this higher can make builds faster by allowing more jobs to run in parallel.
# Setting it too high can result in jobs that timeout, however, while waiting
# for a remote machine to execute them.
test:remote --jobs=50

# Platform flags:
# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms", "host_platform" and "platforms".
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
test:remote --extra_toolchains=@buildkite_config//config:cc-toolchain,//toolchains:rbe_container_cc_toolchain
test:remote --extra_execution_platforms=@buildkite_config//config:platform,//platforms:rbe_container_platform
test:remote --host_platform=@buildkite_config//config:platform
test:remote --platforms=@buildkite_config//config:platform

# Starting with Bazel 0.27.0 strategies do not need to be explicitly
# defined. See https://github.com/bazelbuild/bazel/issues/7480
test:remote --define=EXECUTOR=remote

# Enable remote execution so actions are performed on the remote systems.
test:remote --remote_executor=remotebuildexecution.googleapis.com
test:remote --remote_cache=remotebuildexecution.googleapis.com

# Enable authentication. This will pick up application default credentials by
# default. You can use --google_credentials=some_file.json to use a service
# account credential instead.
test:remote --google_default_credentials=true

test:remote --remote_timeout=3600
test:remote --keep_going
23 changes: 23 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
# Test the case where the test target is located at the root of the
# workspace, which makes the Bazel package empty.
- name: "l.gcr.io/google/bazel"
args:
- "test"
- "--test_output=errors"
- "--verbose_failures"
- "//:structure_test_at_workspace_root"
62 changes: 62 additions & 0 deletions tests/container/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Container and lang_image tests that require the 'docker' tool to be
# available.

steps:
- name: "l.gcr.io/google/bazel"
args:
- "--bazelrc=.bazelrc"
- "test"
- "--define=ENV_KEY=my_key"
- "--define=ENV_VALUE=my_value"
- "--test_output=errors"
- "--verbose_failures"
- "//tests/container:structure_test"
- "//tests/container:deb_image_with_dpkgs_test"
- "//tests/container:set_cmd_test"
- "//tests/container:set_entrypoint_test"
- "//tests/container:set_cmd_and_entrypoint_test"
- "//tests/container:base_with_cmd_and_entrypoint_test"
- "//tests/container:null_cmd_and_entrypoint_none_test"
- "//tests/container:null_cmd_and_entrypoint_empty_str_test"
- "//tests/container:null_cmd_and_entrypoint_empty_list_test"
- "//tests/container:set_cmd_and_entrypoint_null_on_base_test"
- "//tests/container:alpine_amd64_image_test"
- "//tests/container:alpine_arm_image_test"
- "//tests/container:alpine_ppc64le_image_test"
- "//tests/container:set_env_csv_test"
- "//tests/container:set_env_equals_test"
- "//tests/container:set_env_make_vars_test"
- "//tests/container:stripped_directory_name_test"
- "//tests/container:new_alpine_linux_armv6_image_tar_test"
- "//tests/container:new_alpine_linux_armv6_image_oci_tar_test"
- "//tests/container:new_alpine_linux_armv6_image_oci_test"
- "//tests/container:alpine_linux_amd64_image_tar_test"
- "//tests/container:alpine_linux_amd64_image_oci_tar_test"
- "//tests/container:alpine_linux_amd64_image_oci_test"
- "//tests/container:new_alpine_linux_ppc64le_image_tar_test"
- "//tests/container:new_alpine_linux_ppc64le_image_oci_tar_test"
- "//tests/container:new_alpine_linux_ppc64le_image_oci_test"
- "//tests/container/cc:all"
- "//tests/container/go:all"
- "//tests/container/groovy:all"
- "//tests/container/java:all"
- "//tests/container/nodejs:all"
- "//tests/container/python:all"
- "//tests/container/python3:all"
- "//tests/container/rust:all"
- "//tests/container/scala:all"
- "--config=remote"
35 changes: 35 additions & 0 deletions tests/contrib/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Tests under /tests/contrib that require the 'docker' tool to be available.

steps:
- name: "l.gcr.io/google/bazel"
args:
- "--bazelrc=.bazelrc"
- "test"
- "--test_output=errors"
- "--verbose_failures"
- "//tests/contrib:test_dockerfile_image_docker"
- "--config=remote"
# Pull the semantic checker image used by configs_test targets.
- name: "gcr.io/cloud-builders/docker"
args: ["pull", "gcr.io/asci-toolchain/container_release_tools/dependency_update/validators/semantics:latest"]
id: "pull_validator"
- name: "l.gcr.io/google/bazel"
args:
- "test"
- "--test_output=errors"
- "--verbose_failures"
- "//tests/contrib/automatic_container_release:all"
33 changes: 33 additions & 0 deletions tests/docker/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Tests under /tests/docker that require the 'docker' tool to be available.

timeout: "1200s"

steps:
- name: "l.gcr.io/google/bazel"
args:
- "--bazelrc=.bazelrc"
- "test"
- "--test_output=errors"
- "--verbose_failures"
- "//tests/docker/package_managers:download_pkgs_run_test"
- "//tests/docker/package_managers:download_pkgs_with_additional_repos_run_test"
- "//tests/docker/package_managers:gpg_test"
- "//tests/docker/package_managers:install_pkgs_reproducibility_test"
- "//tests/docker/toolchain_container:test-rbe-test-xenial-with-pkgs"
- "//tests/docker/util:test_extracted_file"
- "//tests/docker/util:test_container_commit_metadata"
- "--config=remote"

0 comments on commit 0237f78

Please sign in to comment.