Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Fixed broken //tests/docker/util:all tests #1817

Merged
merged 2 commits into from
Apr 25, 2021
Merged

Fixed broken //tests/docker/util:all tests #1817

merged 2 commits into from
Apr 25, 2021

Conversation

UebelAndre
Copy link
Contributor

@UebelAndre UebelAndre commented Apr 24, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

RBE builds are currently failing when testing //tests/docker/util:all with the following error

(20:05:17) ERROR: /workdir/tests/docker/util/BUILD:89:16: ExtractConfig tests/docker/util/test_container_commit_image.test_container_commit.build.config failed: (Exit 1): extract_config failed: error executing command
  (cd /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/io_bazel_rules_docker && \
  exec env - \
  bazel-out/host/bin/container/go/cmd/extract_config/extract_config_/extract_config -imageTar bazel-out/k8-fastbuild/bin/tests/docker/util/test_container_commit.build -outputConfig bazel-out/k8-fastbuild/bin/tests/docker/util/test_container_commit_image.test_container_commit.build.config -outputManifest bazel-out/k8-fastbuild/bin/tests/docker/util/test_container_commit_image.test_container_commit.build.manifest)
Execution platform: @buildkite_config//config:platform
2021/04/24 20:05:17 Unable to load docker image from bazel-out/k8-fastbuild/bin/tests/docker/util/test_container_commit.build: archive/tar: invalid tar header

What is the new behavior?

This PR introduces the fix for this.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@google-cla google-cla bot added the cla: yes label Apr 24, 2021
@UebelAndre UebelAndre changed the title Fix broken //tests/docker/util:all tests (WIP) Fix broken //tests/docker/util:all tests Apr 24, 2021
@UebelAndre UebelAndre changed the title (WIP) Fix broken //tests/docker/util:all tests Fixed broken //tests/docker/util:all tests Apr 24, 2021
@UebelAndre UebelAndre marked this pull request as ready for review April 24, 2021 23:13
@@ -120,8 +120,10 @@ def get_from_target(ctx, name, attr_target, file_target = None):
else:
if not hasattr(attr_target, "files"):
return {}
target = attr_target.files.to_list()[0]
return _extract_layers(ctx, name, target)
tar_files = [file for file in attr_target.files.to_list() if file.extension == "tar"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the bug was the toolchain was giving us more than one file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule_test was providing the files listed in generates. The issue was that this code assumed that there was either one file or that the first file is a tar file. So the fix I went with was to search for tar files and require that only one was found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue originates from

generates = [
"test_container_commit.build",
"test_container_commit_commit.tar",
],

WORKSPACE Outdated Show resolved Hide resolved
@alexeagle
Copy link
Collaborator

Oh so the bug was actually that we sorted that list?

@alexeagle alexeagle merged commit afd5520 into bazelbuild:master Apr 25, 2021
@UebelAndre UebelAndre deleted the header branch April 25, 2021 23:58
martaver pushed a commit to cleric-sh/rules_docker that referenced this pull request May 18, 2021
* Fix broken `//tests/docker/util:all` tests

* just revert the breaking reordering change

Co-authored-by: Alex Eagle <alexeagle@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants