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

install_pkgs uses named volumes to work with DIND. #1277

Merged
merged 12 commits into from
Nov 21, 2019

Conversation

ralimi
Copy link
Contributor

@ralimi ralimi commented Nov 16, 2019

Previously, install_pkgs would mount files into
the target image directly (with '-v src:dst').
This unfortunately doesn't work with
docker-in-docker (DIND) setups where the mount
is done from the perspective of the host which
does not share a filesystem with the docker client.

To work with such setups, install_pkgs now creates
a named volume and copies files into the named
volume. The named volume containing the install
script and TAR file is then mounted into the
target container.

Previously, config_stripper would store the full
TAR file and gzipped TAR file in memory to compute
the SHA256 hash.

After this change, the stripped TAR file is stored
in a temporary location on disk and then renamed
into its final location.  Furthermore, the SHA256
hash of the gzipped TAR file is computed
incrementally as the gzipping progresses.
Previously, install_pkgs would mount files into
the target image directly (with '-v src:dst').
This unfortunately doesn't work with
docker-in-docker (DIND) setups where the mount
is done from the perspective of the host which
does not share a filesystem with the docker client.

To work with such setups, install_pkgs now creates
a named volume and copies files into the named
volume.  The named volume containing the install
script and TAR file is then mounted into the
target container.
@ralimi
Copy link
Contributor Author

ralimi commented Nov 16, 2019

/assign @smukherj1

@nlopezgi
Copy link
Contributor

This PR is producing multiple failures on buildkite presubmit. For example:

 ERROR: /workdir/tests/docker/package_managers/BUILD:135:1:
++ /usr/bin/docker create -v a6cd30043e5d12cb39f09df13eddcfe47e92070a8ec1551fa5bff1fa5dba2463:/tmp/pkginstall c0c84a906489f3f241b67702c57a146f0976e3e752600ff58361e81a17215527
Error response from daemon: No command specified

Please check the errors out and make sure you can build all these targets / run these tests locally with your changes.

Not all images have a command, so we need to
specify one.
@ralimi
Copy link
Contributor Author

ralimi commented Nov 19, 2019

Thanks for pointing that out. I've re-run the test under tests/docker/package_managers that showed that problem, and I've adjusted the code to fix that.

There are quite a few tests under this repository that simply fail for me, and they look to be for a number of reasons that are unrelated to this change (insufficient permissions for a project in GCR, join_layers gets killed because it runs out of RAM while loading the image).

@ralimi
Copy link
Contributor Author

ralimi commented Nov 19, 2019

Because of those failures, it's somewhat hard to interpret the results for a run of the full repository. Let me know if I'm missing something?

@nlopezgi
Copy link
Contributor

/gcbrun - buildkite CI is having some infra problems. Running GCB tests anyway to check PR.

@nlopezgi
Copy link
Contributor

/gcbrun

Copy link
Contributor

@nlopezgi nlopezgi left a comment

Choose a reason for hiding this comment

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

looks good overall, a couple of doc nits but this should be good to go after. Buildkite CI failed due to infra issue, should run fine after you have addressed the comments. Thanks for sending this PR.

@@ -3,9 +3,8 @@
# It expects to be volume-mounted inside a docker image, in /tmp along with the
# installables.tar.
set -ex
pushd /tmp
pushd /tmp/pkginstall
Copy link
Contributor

Choose a reason for hiding this comment

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

Update docs above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

mkdir -p $(dirname $tmpdir/%{installables_tar})
cp -L $(pwd)/%{installables_tar} $tmpdir/%{installables_tar}
cp -L $(pwd)/%{installer_script} $tmpdir/installer.sh
# Temporarily create a container sowe can mount the named volume
Copy link
Contributor

Choose a reason for hiding this comment

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

so we

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ralimi
Copy link
Contributor Author

ralimi commented Nov 20, 2019

No problem at all - thanks for the review!

Fixed up the docs.

@nlopezgi
Copy link
Contributor

/gcbrun

@nlopezgi
Copy link
Contributor

/gcbrun

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nlopezgi, ralimi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rbe-toolchains-pr-bot rbe-toolchains-pr-bot merged commit 32f1276 into bazelbuild:master Nov 21, 2019
@ralimi ralimi deleted the dind-vol branch November 22, 2019 03:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants