From de652f41023684c5b541a8572910f92d286a82c1 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Wed, 1 Mar 2023 21:03:53 +0100 Subject: [PATCH] Test that toolbox(1) can be built without podman(1) and subordinate IDs This is meant to roughly replicate the build environments used by downstream distributors to build toolbox(1). These can be restricted in odd ways compared to a fully featured environment where toolbox(1) is actually going to be used. eg., the inability to use podman(1) in the case of Fedora or not having subordinate user and group ID ranges in the case of openSUSE. It's important to ensure that toolbox(1) can be built by downstream distributors without any unnecessary hassle. https://github.com/containers/podman/issues/17657 https://github.com/containers/toolbox/issues/1246 --- .zuul.yaml | 13 ++++ playbooks/dependencies-fedora-restricted.yaml | 71 +++++++++++++++++++ playbooks/setup-env-restricted.yaml | 25 +++++++ 3 files changed, 109 insertions(+) create mode 100644 playbooks/dependencies-fedora-restricted.yaml create mode 100644 playbooks/setup-env-restricted.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 71d85c3..d2e9909 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -37,6 +37,17 @@ pre-run: playbooks/setup-env-migration-path-for-coreos-toolbox.yaml run: playbooks/unit-test.yaml +- job: + name: unit-test-restricted + description: Run Toolbox's unit tests declared in Meson in a restricted build environment + timeout: 1800 + nodeset: + nodes: + - name: fedora-rawhide + label: cloud-fedora-rawhide + pre-run: playbooks/setup-env-restricted.yaml + run: playbooks/unit-test.yaml + - job: name: system-test-fedora-rawhide description: Run Toolbox's system tests in Fedora Rawhide @@ -80,6 +91,7 @@ jobs: - unit-test - unit-test-migration-path-for-coreos-toolbox + - unit-test-restricted - system-test-fedora-rawhide - system-test-fedora-37 - system-test-fedora-36 @@ -87,6 +99,7 @@ jobs: - unit-test - unit-test-migration-path-for-coreos-toolbox + - unit-test-restricted - system-test-fedora-rawhide - system-test-fedora-37 - system-test-fedora-36 diff --git a/playbooks/dependencies-fedora-restricted.yaml b/playbooks/dependencies-fedora-restricted.yaml new file mode 100644 index 0000000..f8f0cf0 --- /dev/null +++ b/playbooks/dependencies-fedora-restricted.yaml @@ -0,0 +1,71 @@ +# +# Copyright © 2023 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +- name: Ensure that subordinate group ID ranges are absent + become: yes + file: + path: /etc/subgid + state: absent + +- name: Ensure that subordinate user ID ranges are absent + become: yes + file: + path: /etc/subuid + state: absent + +- name: Install RPM packages + become: yes + package: + name: + - ShellCheck + - bash-completion + - codespell + - fish + - flatpak-session-helper + - gcc + - golang + - golang-github-cpuguy83-md2man + - meson + - ninja-build + - shadow-utils-subid-devel + - systemd + - udisks2 + state: present + update_cache: "{{ true if zuul.attempts > 1 else false }}" + +- name: Ensure that podman(1) is absent + become: yes + package: + name: + - podman + state: absent + update_cache: "{{ true if zuul.attempts > 1 else false }}" + +- name: Download Go modules + shell: | + go mod download -x + args: + chdir: '{{ zuul.project.src_dir }}/src' + +- name: Set up Git submodules + shell: | + git submodule init + git submodule update + args: + chdir: '{{ zuul.project.src_dir }}' + +- name: Check versions of crucial packages + command: rpm -qa ShellCheck codespell *kernel* gcc *glibc* shadow-utils-subid-devel golang flatpak-session-helper diff --git a/playbooks/setup-env-restricted.yaml b/playbooks/setup-env-restricted.yaml new file mode 100644 index 0000000..9ab15e1 --- /dev/null +++ b/playbooks/setup-env-restricted.yaml @@ -0,0 +1,25 @@ +# +# Copyright © 2023 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +- hosts: all + tasks: + - include_tasks: dependencies-fedora-restricted.yaml + + - name: Set up build directory + command: meson setup --fatal-meson-warnings builddir + args: + chdir: '{{ zuul.project.src_dir }}'