Skip to content

Commit

Permalink
pipeline-utils: add prep_container_storage()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
miabbott committed Sep 25, 2018
1 parent bf4aa4f commit e32f240
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pipeline-utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"""
}

Expand Down

0 comments on commit e32f240

Please sign in to comment.