From e32f24023753817d20c84c26fac11bcc18e0ac1d Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Thu, 20 Sep 2018 16:11:55 -0400 Subject: [PATCH] pipeline-utils: add prep_container_storage() This re-implements some of what is contained in `scripts/pull-mount-oscontainer` to allow parts of the pipeline to pull container images from inside another container. --- pipeline-utils.groovy | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pipeline-utils.groovy b/pipeline-utils.groovy index 0fefce03..2dabaf39 100644 --- a/pipeline-utils.groovy +++ b/pipeline-utils.groovy @@ -148,16 +148,15 @@ def registry_login(username, password, registry) { // store containers, and bind mounts it to '/var/lib/containers` def prep_container_storage(dirFromHost) { sh """ - container_storage="/var/lib/containers" - dest="${dirFromHost}/containers" - fstype=$(df -P ${dirFromHost} | awk 'END{print $6}' | xargs findmnt -n -o FSTYPE) - if [ "$fstype" == "overlay" ]; then - echo "Must supply non-overlay location" + container_storage=/var/lib/containers + fstype=\$(df -P ${dirFromHost} | awk 'END{print \$6}' | xargs findmnt -n -o FSTYPE) + if [ \$fstype == 'overlay' ]; then + echo 'Must supply non-overlay location' exit 1 fi - rm -rf ${container_storage} && mkdir -p ${container_storage} - rm -rf ${dest} && mkdir -p ${dest} - mount --bind ${dest} ${container_storage} + rm -rf \${container_storage} && mkdir -p \${container_storage} + rm -rf ${dirFromHost} && mkdir -p ${dirFromHost}/containers + mount --bind ${dirFromHost}/containers \${container_storage} """ }