Docker runner chroot does not work within gitlab-ci-docker-runner -
i automating process of creating sd-image embedded platform. using gitlab ci in particular docker runner. works on system locally, when runs in gitlab ci, there strange errors.
here process:
- i start docker container, runs
build.sh
. build.sh
chroot
on mounted image , runsprovision.sh
.
details
i first run docker this:
docker run --rm -it --privileged=true -v `pwd`:"/wd" -w="/wd" ubuntu:xenial-20170710 /bin/bash build.sh
the file build.sh
looks this:
apt-get update apt-get install qemu-user-static pixz -y pixz -d ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz ubuntu- 16.04.2-minimal-odroid-xu4-20170516.img md5sum -c ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.md5 limits=$(sfdisk -l --bytes ubuntu-16.04.2-minimal-odroid-xu4-20170516.img | tail -n 1) loopdev=$(losetup -f --show -o $((512 * $(awk '{print $2}' <<< "$limits"))) --sizelimit $(awk '{print $5}' <<< "$limits") ubuntu-16.04.2-minimal-odroid-xu4-20170516.img) mkdir /mnt/rna mount $loopdev /mnt/rna mount -t proc proc /mnt/rna/proc/ mount -t sysfs sys /mnt/rna/sys/ mount -o bind /dev /mnt/rna/dev/ echo 'nameserver 8.8.4.4' >> /mnt/rna/etc/resolv.conf cp $(which qemu-arm-static) /mnt/rna/usr/bin cp provision.sh /mnt/rna/root chroot /mnt/rna qemu-arm-static /bin/bash -l /root/provision.sh mv ubuntu-16.04.2-minimal-odroid-xu4-20170516.img rna.img pixz rna.img rna.img.xz losetup -d $loopdev
in case interested in image, can found here: https://odroid.in/ubuntu_16.04lts/ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz
the provision.sh
following:
pwd env ls -la apt-get update apt-get install tmux -y
problem
locally, works fine , apt-get installs run inside image.
the .gitlab-ci.yml
looks follows:
image: ubuntu:xenial-20170710 build: tags: - privileged artifacts: expire_in: "1h" paths: - rna.img.xz script: - ./build.sh
but when run gitlab ci, following messages (the start md5sum
check inside build.sh
:
ubuntu-16.04.2-minimal-odroid-xu4-20170516.img: ok ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz: ok /root/.profile: line 9: /usr/bin/mesg: no such file or directory / /root/provision.sh: line 2: /usr/bin/env: no such file or directory /root/provision.sh: line 3: /bin/ls: no such file or directory /root/provision.sh: line 5: /usr/bin/apt-get: no such file or directory /root/provision.sh: line 6: /usr/bin/apt-get: no such file or directory
the docker-runner runs in privileged
mode ensure chroot
, mount
working.
i got working now. seems has been caching problem within gitlab-runner.
Comments
Post a Comment