Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Support builds/ in workdir being a symlink outside workdir #2774

Merged
merged 1 commit into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,16 @@ EOF
-append "root=/dev/vda console=${DEFAULT_TERMINAL} selinux=1 enforcing=0 autorelabel=1" \
)

# support local dev cases where src/config is a symlink
# support local dev cases where src/config is a symlink. Note if you change or extend to this set,
# you also need to update supermin-init-prelude.sh to mount it inside the VM.
if [ -L "${workdir}/src/config" ]; then
# qemu follows symlinks
base_qemu_args+=("-virtfs" 'local,id=source,path='"${workdir}"'/src/config,security_model=none,mount_tag=source')
fi
# Current RHCOS pipeline makes builds/ a PVC
if [ -L "${workdir}/builds" ]; then
base_qemu_args+=("-virtfs" 'local,id=builds,path='"${workdir}"'/builds,security_model=none,mount_tag=builds')
fi

if [ -z "${RUNVM_SHELL:-}" ]; then
if ! "${kola_args[@]}" -- "${base_qemu_args[@]}" \
Expand Down
5 changes: 5 additions & 0 deletions src/supermin-init-prelude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ umask 002
# https://github.com/coreos/coreos-assembler/issues/2171
mkdir -p "${workdir:?}"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 workdir "${workdir}"
# These two invocations pair with virtfs setups for qemu in cmdlib.sh. Keep them in sync.
if [ -L "${workdir}"/src/config ]; then
mkdir -p "$(readlink "${workdir}"/src/config)"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 source "${workdir}"/src/config
fi
if [ -L "${workdir}"/builds ]; then
mkdir -p "$(readlink "${workdir}"/builds)"
mount -t 9p -o rw,trans=virtio,version=9p2000.L,msize=10485760 builds "${workdir}"/builds
fi
mkdir -p "${workdir}"/cache
cachedev=$(blkid -lt LABEL=cosa-cache -o device || true)
if [ -n "${cachedev}" ]; then
Expand Down