Skip to content

csmock works with systemd-nspawn only on RHEL-9 and newer #142

Open
@kdudka

Description

csmock does not work well with systemd-nspawn on RHEL-8 because systemd-239-78.e8 does not include a systemd hack which mock uses internally and which csmock relies on. If the environment variable is ignored by systemd-nspawn, /tmp is over-mounted by a fresh tmpfs file system on each invocation of mock --chroot or mock --shell, and whatever we put into /tmp is missing in the next steps. For example:

>>> 2023-11-30 14:42:13 "tar -cP '/usr/share/csmock/scripts' '/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1.src.rpm' '/tmp/csmockpvtw2ssw/gitleaks' | '/usr/bin/mock' '-r' 'rhel-8.7.0.z-x86_64' '--plugin-option=tmpfs:keep_mounted=True' '--config-opts=print_main_output=True' '--quiet' '--shell' 'tar -xC/'"
tar: Removing leading `/' from member names

>>> 2023-11-30 14:42:15 "/usr/bin/mock" "-r" "rhel-8.7.0.z-x86_64" "--plugin-option=tmpfs:keep_mounted=True" "--config-opts=print_main_output=True" "--quiet" "--chroot" "rpm -Uvh --nodeps '/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1.src.rpm'"
error: open of /tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1.src.rpm failed: No such file or directory

[...]

>>> 2023-11-30 14:42:30 "/usr/bin/mock" "-r" "rhel-8.7.0.z-x86_64" "--plugin-option=tmpfs:keep_mounted=True" "--config-opts=print_main_output=True" "--quiet" "--chroot" "/tmp/csmockpvtw2ssw/gitleaks detect --no-git cmd --source=/builddir/build/BUILD --report-path=/builddir/gitleaks-capture.sarif --report-format=sarif 2>/builddir/gitleaks-capture.log"

>>> 2023-11-30 14:42:32 "'/usr/bin/mock' '-r' 'rhel-8.7.0.z-x86_64' '--plugin-option=tmpfs:keep_mounted=True' '--config-opts=print_main_output=True' '--quiet' '--shell' 'tar -c --remove-files '/builddir/gitleaks-capture.sarif' '/builddir/gitleaks-capture.log'' | tar -xC '/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1/debug/raw-results'"
tar: Removing leading `/' from member names
tar: /builddir/gitleaks-capture.sarif: Cannot stat: No such file or directory
tar: Removing leading `/' from hard link targets
tar: Exiting with failure status due to previous errors

>>> 2023-11-30 14:42:34 "csgrep '/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1/debug/raw-results/builddir/gitleaks-capture.sarif' --mode=json --warning-rate-limit=1024 --limit-msg-len=512 > '/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1/debug/uni-results/gitleaks-capture.js'"
/tmp/csmockpvtw2ssw/cloud-init-21.1-15.el8_6.1/debug/raw-results/builddir/gitleaks-capture.sarif: failed to open input file

!!! 2023-11-30 14:42:34 error: post-process hook failed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions