Skip to content

bazel toolchain is failing in downstream projects #376

Closed

Description

@meteorcloudy

https://buildkite.com/bazel/bazel-with-downstream-projects-bazel/builds/573#844c6a1a-3981-4b9d-b7e1-d5bc3ea71fd4

ERROR: /var/lib/buildkite-agent/builds/bk-worker-ubuntu1604-java8-vnf4/bazel-downstream-projects/bazel-toolchains/container/ubuntu16_04/layers/bazel/BUILD:38:2: Couldn't build file container/ubuntu16_04/layers/bazel/bazel_0.18.0_installer_image-download_pkgs_output_tar.tar: SkylarkAction container/ubuntu16_04/layers/bazel/bazel_0.18.0_installer_image-download_pkgs_output_tar.tar failed (Exit 127): bazel_0.18.0_installer_image-download_pkgs_output_script.sh failed: error executing command
--
  | (cd /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/1aba2282ace41a6e60b11b2b4e877ce9/execroot/bazel_toolchains && \
  | exec env - \
  | bazel-out/k8-fastbuild/bin/container/ubuntu16_04/layers/bazel/bazel_0.18.0_installer_image-download_pkgs_output_script.sh)
  | Execution platform: @bazel_toolchains//configs/ubuntu16_04_clang/1.1:rbe_ubuntu1604_r342117_jdk8
  | ++ python external/io_bazel_rules_docker/contrib/extract_image_id.py bazel-out/k8-fastbuild/bin/external/ubuntu16_04/image/image.tar
  | + image_id=37b1fb5420cd7e5b800874fe7039cc06ae34e22ebaee4b9a9379c91634801dc2
  | + docker load -i bazel-out/k8-fastbuild/bin/external/ubuntu16_04/image/image.tar
  | bazel-out/k8-fastbuild/bin/container/ubuntu16_04/layers/bazel/bazel_0.18.0_installer_image-download_pkgs_output_script.sh: line 6: docker: command not found

Looks like we don't have docker installed on our Ubuntu machines?
@philwo @xingao267

Activity

  1. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    @philwo and I had the discussion yesterday about removing docker in Buildkite machines to increase security. I thought we should be fine without docker in the host machine. But it's strange that bazelbuild/bazel-toolchains#234 presubmit is fine. Maybe @philwo only removed docker in some of the machines for testing?

  2. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    But I did try several remote builds in a docker container without docker installed and they succeeded.

  3. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    Oh, it looks the wrong execution platform is selected.

    Execution platform: @bazel_toolchains//configs/ubuntu16_04_clang/1.1:rbe_ubuntu1604_r342117_jdk8

      | ++ python external/io_bazel_rules_docker/contrib/extract_image_id.py bazel-out/k8-fastbuild/bin/external/ubuntu16_04/image/image.tar
      | + image_id=37b1fb5420cd7e5b800874fe7039cc06ae34e22ebaee4b9a9379c91634801dc2
      | + docker load -i bazel-out/k8-fastbuild/bin/external/ubuntu16_04/image/image.tar
      | bazel-out/k8-fastbuild/bin/container/ubuntu16_04/layers/bazel/bazel_0.18.0_installer_image-download_pkgs_output_script.sh: line 6: docker: command not found

    That remote container does not have container installed.

  4. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor
  5. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    It's likely due to bazelbuild/bazel@3c7c273 @katre. Now multiple execution platforms can be specified using --extra_execution_platform. We should let it select the container that has docker installed.

  6. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    I'm gonna add a new constraint for support_docker.

  7. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    Rerun the tests and still failing. Looks like it's still selecting the default pair of toolchain and the platform as they are ahead in the list.

  8. xingao267 commented on Nov 8, 2018

    @xingao267
    Contributor

    With the current Buildkite setup that the default flags are appended first (https://github.com/bazelbuild/continuous-integration/blob/master/buildkite/bazelci.py#L876), I'm not sure how we can actually override default platforms in this case. Maybe we should support some kind of priority in platform selection instead of selecting the first one? or for custom extra platform and toolchains flags set in .bazelci/presubmit.yml should go first? @katre @philwo

  9. katre commented on Nov 9, 2018

    @katre
    Contributor

    I would ideally like to keep the platform ordering logic simple. Fixing the CI to allow it to set the flags in the correct order seems best. @philwo, is this hard to do?

  10. meteorcloudy commented on Nov 12, 2018

    @meteorcloudy
    MemberAuthor

    @xingao267 Thanks for investigating on this!
    I filed #378

  11. meteorcloudy commented on Nov 12, 2018

    @meteorcloudy
    MemberAuthor

    @xingao267
    https://buildkite.com/bazel/bazel-with-downstream-projects-bazel/builds/579#bc7c1894-0f02-4d9a-b4a2-e06a1d04f246

    exec ${PAGER:-/usr/bin/less} "$0" || exit 1
    Executing tests from //container/experimental/rbe-debian9:toolchain-test
    -----------------------------------------------------------------------------
    + docker load -i container/experimental/rbe-debian9/intermediate_bundle_toolchain-test.tar
    /b/f/w/bazel-out/k8-fastbuild/bin/container/experimental/rbe-debian9/toolchain-test.runfiles/bazel_toolchains/container/experimental/rbe-debian9/toolchain-test: line 5: docker: command not found
    

    Now we got a similar error, but it happens inside //container/experimental/rbe-debian9:toolchain-test

  12. xingao267 commented on Nov 12, 2018

    @xingao267
    Contributor

    I was able to reproduce it locally. Step to reproduce:

    1. build bazel from head
    2. clone bazel-toolchains repo at head and cd into it.
    3. run this command with proper auth and remote instance that you have access to:
    /path/to/bazel test \
        --test_output=errors \
        --verbose_failures \
        --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/latest:toolchain_docker \
        --extra_execution_platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:nosla_xenial_docker \
        --host_platform=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:nosla_xenial_docker \
        --platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:nosla_xenial_docker \
        --show_progress_rate_limit=5 \
        --curses=yes \
        --color=yes \
        --jobs=75 \
        --sandbox_tmpfs_path=/tmp \
        --experimental_multi_threaded_digest \
        --flaky_test_attempts=3 \
        --build_tests_only \
        --local_test_jobs=75 \
        --remote_executor=remotebuildexecution.googleapis.com \
        --remote_timeout=3600 \
        --spawn_strategy=remote \
        --strategy=Javac=remote \
        --strategy=Closure=remote \
        --genrule_strategy=remote \
        --experimental_strict_action_env \
        --tls_enabled=true \
        --google_default_credentials \
        --bes_backend=buildeventservice.googleapis.com \
        --bes_timeout=360s \
        --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/latest:javabase \
        --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/latest:javabase \
        --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 \
        --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 \
        --crosstool_top=@bazel_toolchains//configs/ubuntu16_04_clang/latest:crosstool_top_default \
        --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \
        --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/latest:toolchain_default \
        --extra_execution_platforms=@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform \
        --host_platform=@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform \
        --platforms=@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform \
        --toolchain_resolution_debug \
        <add remote instance and project id flags here>
        //container/ubuntu14_04/builders/bazel:bazel_0.18.0-test
    

    @katre From the toolchain resolution debug messages, it looks like the right pair of toolchain and platform is selected:

    INFO: ToolchainResolver: Selected execution platform @bazel_toolchains//configs/ubuntu16_04_clang/1.1:nosla_xenial_docker, type @io_bazel_rules_docker//toolchains/docker:toolchain_type -> toolchain @io_bazel_rules_docker//toolchains
    
    INFO: ToolchainResolver: Selected execution platform @bazel_toolchains//configs/ubuntu16_04_clang/1.1:nosla_xenial_docker, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @bazel_toolchains//configs/ubuntu16_04_clang/1.1/bazel_0.19.0/default:cc-compiler-k8
    

    But from error message, it shows the wrong execution platform is used. With @meteorcloudy 's change in Buildkite config, it seems the situation is mitigated. Some actions or tests uses the right platform, but not all. (before all tests were using the wrong platform)

    ERROR: /var/lib/buildkite-agent/builds/bk-worker-ubuntu1604-java8-vnf4/bazel-downstream-projects/bazel-toolchains/container/debian8/layers/bazel/BUILD:52:2: Couldn't build file container/debian8/layers/bazel/bazel_0.18.0_tar/bazel.tar: SkylarkAction container/debian8/layers/bazel/bazel_0.18.0_tar/bazel.tar failed (Exit 127): bazel_0.18.0_tar.build failed: error executing command
      | (cd /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/1aba2282ace41a6e60b11b2b4e877ce9/execroot/bazel_toolchains && \
      | exec env - \
      | bazel-out/k8-fastbuild/bin/container/debian8/layers/bazel/bazel_0.18.0_tar.build)
      | Execution platform: @bazel_toolchains//configs/ubuntu16_04_clang/1.1:rbe_ubuntu1604_r342117_jdk8
      | ++ python external/io_bazel_rules_docker/contrib/extract_image_id.py bazel-out/k8-fastbuild/bin/container/debian8/layers/bazel/bazel_0.18.0_installer_image.tar
      | + image_id=75de7ea1446c27995ba16a3d6da4e2d3bfa68de207dc5bc65d28c6215cda89e5
      | + docker load -i bazel-out/k8-fastbuild/bin/container/debian8/layers/bazel/bazel_0.18.0_installer_image.tar
      | bazel-out/k8-fastbuild/bin/container/debian8/layers/bazel/bazel_0.18.0_tar.build: line 7: docker: command not found
    

    @katre any ideas in this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions