Skip to content

Commit 5c5b112

Browse files
lsm5edsantiago
andcommitted
Packit: New workflow for downstream Fedora and CentOS Stream 10
This commit enables: - upstream copr build jobs on PRs - rpm builds on podman-next copr after every commit to main - Fedora and CentOS Stream 10 downstream update jobs on every upstream release - Fetch RPM-GPG-KEY-redhat-release from https://access.redhat.com/security/data/fd431d51.txt - Config file patching during rpm build is managed via `rpm/update.sh`, modified from the original script at https://gitlab.com/redhat/centos-stream/rpms/containers-common/-/blob/c9s/update.sh and modified to include Fedora and RHEL-10 Co-authored-by: Ed Santiago <santiago@redhat.com> Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
1 parent 4b8372a commit 5c5b112

File tree

7 files changed

+367
-1
lines changed

7 files changed

+367
-1
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
skip = ./vendor,./.git #,bin,vendor,.git,go.sum,changelog.txt,.cirrus.yml,"RELEASE_NOTES.md,*.xz,*.gz,*.tar,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go"
66

77
# Comma separated list of words to be ignored. Words must be lowercased.
8-
ignore-words-list = clos,creat,ro,hastable,shouldnot,mountns
8+
ignore-words-list = clos,creat,ro,hastable,shouldnot,mountns,passt
99

1010
# Custom dictionary file that contains spelling corrections.
1111
# Run with option '--dictionary=-' to include also default dictionary.

.packit.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
# See the documentation for more information:
3+
# https://packit.dev/docs/configuration/
4+
5+
downstream_package_name: containers-common
6+
upstream_tag_template: v{version}
7+
8+
packages:
9+
containers-common-fedora:
10+
pkg_tool: fedpkg
11+
specfile_path: rpm/containers-common.spec
12+
containers-common-centos:
13+
pkg_tool: centpkg
14+
specfile_path: rpm/containers-common.spec
15+
16+
actions:
17+
pre-sync: "bash rpm/update-lib-versions.sh"
18+
19+
jobs:
20+
- job: copr_build
21+
trigger: pull_request
22+
packages: [containers-common-fedora]
23+
notifications: &ephemeral_build_failure_notification
24+
failure_comment:
25+
message: "Ephemeral COPR build failed. @containers/packit-build please check."
26+
enable_net: true
27+
targets:
28+
fedora-development: {}
29+
fedora-latest: {}
30+
fedora-eln:
31+
# Need this to fetch go-md2man which is present in koji envs but not by
32+
# default on copr envs. Also helps to avoid bundling go-md2man in
33+
# c/common.
34+
additional_repos:
35+
- https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/
36+
37+
- job: copr_build
38+
trigger: pull_request
39+
packages: [containers-common-centos]
40+
notifications: *ephemeral_build_failure_notification
41+
enable_net: true
42+
targets:
43+
- epel-9
44+
- centos-stream-10
45+
46+
# Run on commit to main branch
47+
- job: copr_build
48+
trigger: commit
49+
notifications:
50+
failure_comment:
51+
message: "containers-common-next COPR build failed. @containers/packit-build please check."
52+
branch: main
53+
owner: rhcontainerbot
54+
project: containers-common-next
55+
enable_net: true
56+
57+
- job: propose_downstream
58+
trigger: release
59+
update_release: false
60+
packages: [containers-common-fedora]
61+
dist_git_branches:
62+
- fedora-development
63+
- fedora-latest
64+
65+
- job: propose_downstream
66+
trigger: release
67+
update_release: false
68+
packages: [containers-common-centos]
69+
dist_git_branches:
70+
- c10s
71+
72+
- job: koji_build
73+
trigger: commit
74+
packages: [containers-common-fedora]
75+
dist_git_branches:
76+
- fedora-all
77+
78+
- job: bodhi_update
79+
trigger: commit
80+
packages: [containers-common-fedora]
81+
dist_git_branches:
82+
- fedora-branched # rawhide updates are created automatically
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docker:
2+
registry.access.redhat.com:
3+
sigstore: https://access.redhat.com/webassets/docker/content/sigstore
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docker:
2+
registry.redhat.io:
3+
sigstore: https://registry.redhat.io/containers/sigstore

rpm/containers-common.spec

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Below definitions are used to deliver config files from a particular branch
2+
# of c/image, c/storage and c/shortnames vendored in all of Buildah, Podman and Skopeo.
3+
# These vendored components must have the same version. If it is not the case,
4+
# pick the oldest version on c/image, c/storage and c/shortnames vendored in
5+
# Buildah/Podman/Skopeo.
6+
7+
# Packit will automatically update the image and storage versions on Fedora and
8+
# CentOS Stream dist-git PRs.
9+
%global image_branch main
10+
%global storage_branch main
11+
%global shortnames_branch main
12+
13+
%global github_containers https://raw.githubusercontent.com/containers
14+
15+
%if %{defined copr_username}
16+
%define copr_build 1
17+
%endif
18+
19+
Name: containers-common
20+
%if %{defined copr_build}
21+
Epoch: 102
22+
%else
23+
Epoch: 5
24+
%endif
25+
# DO NOT TOUCH the Version string!
26+
# The TRUE source of this specfile is:
27+
# https://github.com/containers/common/blob/main/rpm/containers-common.spec
28+
# If that's what you're reading, Version must be 0, and will be updated by Packit for
29+
# copr and koji builds.
30+
# If you're reading this on dist-git, the version is automatically filled in by Packit.
31+
Version: 0
32+
Release: %autorelease
33+
License: Apache-2.0
34+
BuildArch: noarch
35+
# for BuildRequires: go-md2man
36+
ExclusiveArch: %{golang_arches} noarch
37+
Summary: Common configuration and documentation for containers
38+
BuildRequires: git-core
39+
BuildRequires: go-md2man
40+
Provides: skopeo-containers = %{epoch}:%{version}-%{release}
41+
Requires: (container-selinux >= 2:2.162.1 if selinux-policy)
42+
Suggests: fuse-overlayfs
43+
Source0: %{git0}/archive/v%{version_no_tilde}.tar.gz
44+
Source1: %{github_containers}/image/%{image_branch}/docs/containers-auth.json.5.md
45+
Source2: %{github_containers}/image/%{image_branch}/docs/containers-certs.d.5.md
46+
Source3: %{github_containers}/image/%{image_branch}/docs/containers-policy.json.5.md
47+
Source4: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.5.md
48+
Source5: %{github_containers}/image/%{image_branch}/docs/containers-registries.conf.d.5.md
49+
Source6: %{github_containers}/image/%{image_branch}/docs/containers-registries.d.5.md
50+
Source7: %{github_containers}/image/%{image_branch}/docs/containers-signature.5.md
51+
Source8: %{github_containers}/image/%{image_branch}/docs/containers-transports.5.md
52+
Source9: %{github_containers}/storage/%{storage_branch}/docs/containers-storage.conf.5.md
53+
Source10: %{github_containers}/shortnames/%{shortnames_branch}/shortnames.conf
54+
Source11: %{github_containers}/image/%{image_branch}/default.yaml
55+
Source12: %{github_containers}/image/%{image_branch}/default-policy.json
56+
Source13: %{github_containers}/image/%{image_branch}/registries.conf
57+
Source14: %{github_containers}/storage/%{storage_branch}/storage.conf
58+
# Fetch RPM-GPG-KEY-redhat-release from the authoritative source instead of storing
59+
# a copy in repo or dist-git. Depending on distribution-gpg-keys rpm is also
60+
# not an option because that package doesn't exist on CentOS Stream.
61+
Source15: https://access.redhat.com/security/data/fd431d51.txt
62+
63+
%description
64+
This package contains common configuration files and documentation for container
65+
tools ecosystem, such as Podman, Buildah and Skopeo.
66+
67+
It is required because the most of configuration files and docs come from projects
68+
which are vendored into Podman, Buildah, Skopeo, etc. but they are not packaged
69+
separately.
70+
71+
%package extra
72+
Summary: Extra dependencies for Podman and Buildah
73+
Requires: %{name} = %{epoch}:%{version}-%{release}
74+
Requires: container-network-stack
75+
Requires: oci-runtime
76+
Conflicts: podman < 5:5.0.0~rc4-1
77+
Recommends: composefs
78+
Recommends: crun
79+
Requires: (crun if fedora-release-identity-server)
80+
Requires: netavark >= 1.10.3-1
81+
Suggests: slirp4netns
82+
Requires: passt
83+
Requires: iptables
84+
Requires: nftables
85+
Recommends: qemu-user-static
86+
Requires: (qemu-user-static-aarch64 if fedora-release-identity-server)
87+
Requires: (qemu-user-static-arm if fedora-release-identity-server)
88+
Requires: (qemu-user-static-x86 if fedora-release-identity-server)
89+
90+
%description extra
91+
This subpackage will handle dependencies common to Podman and Buildah which are
92+
not required by Skopeo.
93+
94+
%prep
95+
%autosetup -Sgit %{name}-%{version_no_tilde}
96+
97+
# Fine-grain distro- and release-specific tuning of config files,
98+
# e.g., seccomp, composefs, registries on different RHEL/Fedora versions
99+
bash rpm/update-config-files.sh
100+
101+
%build
102+
mv %{SOURCE1} docs/.
103+
mv %{SOURCE2} docs/.
104+
mv %{SOURCE3} docs/.
105+
mv %{SOURCE4} docs/.
106+
mv %{SOURCE5} docs/.
107+
mv %{SOURCE6} docs/.
108+
mv %{SOURCE7} docs/.
109+
mv %{SOURCE8} docs/.
110+
mv %{SOURCE9} docs/.
111+
112+
mkdir -p man5
113+
for i in docs/*.5.md; do
114+
go-md2man -in $i -out man5/$(basename $i .md)
115+
done
116+
117+
%install
118+
# install config and policy files for registries
119+
install -dp %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d,systemd}
120+
install -dp %{buildroot}%{_sharedstatedir}/containers/sigstore
121+
install -dp %{buildroot}%{_datadir}/containers/systemd
122+
install -dp %{buildroot}%{_prefix}/lib/containers/storage
123+
install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-images
124+
touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-images/images.lock
125+
install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers
126+
touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers/layers.lock
127+
128+
install -Dp -m0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
129+
install -Dp -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
130+
install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/containers/policy.json
131+
install -Dp -m0644 %{SOURCE13} %{buildroot}%{_sysconfdir}/containers/registries.conf
132+
install -Dp -m0644 %{SOURCE14} %{buildroot}%{_datadir}/containers/storage.conf
133+
134+
# RPM-GPG-KEY-redhat-release already exists on rhel envs, install only on
135+
# fedora and centos
136+
%if %{defined fedora} || %{defined centos}
137+
install -Dp -m0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
138+
%endif
139+
140+
install -Dp -m0644 contrib/redhat/registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
141+
install -Dp -m0644 contrib/redhat/registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
142+
143+
# install manpages
144+
install -dp %{buildroot}%{_mandir}/man5
145+
for i in man5/*.5; do
146+
install -Dp -m0644 $i -t %{buildroot}%{_mandir}/man5
147+
done
148+
ln -s containerignore.5 %{buildroot}%{_mandir}/man5/.containerignore.5
149+
150+
# install config files for mounts, containers and seccomp
151+
install -m0644 pkg/subscriptions/mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf
152+
install -m0644 pkg/seccomp/seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json
153+
install -m0644 pkg/config/containers.conf %{buildroot}%{_datadir}/containers/containers.conf
154+
155+
# install secrets patch directory
156+
install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets
157+
# rhbz#1110876 - update symlinks for subscription management
158+
ln -s ../../../..%{_sysconfdir}/pki/entitlement %{buildroot}%{_datadir}/rhel/secrets/etc-pki-entitlement
159+
ln -s ../../../..%{_sysconfdir}/rhsm %{buildroot}%{_datadir}/rhel/secrets/rhsm
160+
ln -s ../../../..%{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/rhel/secrets/redhat.repo
161+
162+
%files
163+
%dir %{_sysconfdir}/containers
164+
%dir %{_sysconfdir}/containers/certs.d
165+
%dir %{_sysconfdir}/containers/oci
166+
%dir %{_sysconfdir}/containers/oci/hooks.d
167+
%dir %{_sysconfdir}/containers/registries.conf.d
168+
%dir %{_sysconfdir}/containers/registries.d
169+
%dir %{_sysconfdir}/containers/systemd
170+
%dir %{_prefix}/lib/containers/storage
171+
%dir %{_prefix}/lib/containers/storage/overlay-images
172+
%dir %{_prefix}/lib/containers/storage/overlay-layers
173+
%{_prefix}/lib/containers/storage/overlay-images/images.lock
174+
%{_prefix}/lib/containers/storage/overlay-layers/layers.lock
175+
176+
%config(noreplace) %{_sysconfdir}/containers/policy.json
177+
%config(noreplace) %{_sysconfdir}/containers/registries.conf
178+
%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
179+
%if 0%{?fedora} || 0%{?centos}
180+
%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
181+
%endif
182+
%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
183+
%{_sysconfdir}/containers/registries.d/registry.redhat.io.yaml
184+
%{_sysconfdir}/containers/registries.d/registry.access.redhat.com.yaml
185+
%ghost %{_sysconfdir}/containers/storage.conf
186+
%ghost %{_sysconfdir}/containers/containers.conf
187+
%dir %{_sharedstatedir}/containers/sigstore
188+
%{_mandir}/man5/Containerfile.5.gz
189+
%{_mandir}/man5/containerignore.5.gz
190+
%{_mandir}/man5/.containerignore.5.gz
191+
%{_mandir}/man5/containers*.5.gz
192+
%dir %{_datadir}/containers
193+
%dir %{_datadir}/containers/systemd
194+
%{_datadir}/containers/storage.conf
195+
%{_datadir}/containers/containers.conf
196+
%{_datadir}/containers/mounts.conf
197+
%{_datadir}/containers/seccomp.json
198+
%dir %{_datadir}/rhel/secrets
199+
%{_datadir}/rhel/secrets/*
200+
201+
%files extra
202+
203+
%changelog
204+
%autochangelog

rpm/update-config-files.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
# This script delivers current documentation/configs and assures it has the intended
3+
# settings for a particular branch/release.
4+
5+
set -exo pipefail
6+
7+
ensure() {
8+
if grep ^$2[[:blank:]].*= $1 > /dev/null
9+
then
10+
sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" $1
11+
else
12+
if grep ^\#.*$2[[:blank:]].*= $1 > /dev/null
13+
then
14+
sed -i "/^#.*$2[[:blank:]].*=/a \
15+
$2 = $3" $1
16+
else
17+
echo "$2 = $3" >> $1
18+
fi
19+
fi
20+
}
21+
22+
# Common options enabled across all fedora, centos, rhel
23+
# TBD: Can these be enabled by default upstream?
24+
ensure registries.conf short-name-mode \"enforcing\"
25+
26+
ensure storage.conf driver \"overlay\"
27+
ensure storage.conf mountopt \"nodev,metacopy=on\"
28+
29+
ensure pkg/config/containers.conf runtime \"crun\"
30+
ensure pkg/config/containers.conf log_driver \"journald\"
31+
ensure pkg/config/containers.conf compression_format \"zstd:chunked\"
32+
33+
# Enable seccomp support keyctl and socketcall
34+
grep -q \"keyctl\", pkg/seccomp/seccomp.json || sed -i '/\"kill\",/i \
35+
"keyctl",' pkg/seccomp/seccomp.json
36+
grep -q \"socket\", pkg/seccomp/seccomp.json || sed -i '/\"socketcall\",/i \
37+
"socket",' pkg/seccomp/seccomp.json
38+
39+
FEDORA=$(rpm --eval '%{?fedora}')
40+
RHEL=$(rpm --eval '%{?rhel}')
41+
COPR=$(rpm --eval '%{?copr_username}')
42+
43+
# Set search registries
44+
if [[ -n "$FEDORA" ]]; then
45+
ensure registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"docker.io\"]
46+
else
47+
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
48+
fi
49+
50+
# Set these on all Fedora and RHEL 10+
51+
if [[ -n "$FEDORA" ]] || [[ "$RHEL" -ge 10 ]]; then
52+
sed -i -e '/^additionalimagestores\ =\ \[/a "\/usr\/lib\/containers\/storage",' storage.conf
53+
fi
54+
55+
# Set these on Fedora Rawhide (41+), RHEL 10+, and on all COPR builds
56+
# regardless of distro
57+
if [[ -n "$COPR" ]] || [[ "$FEDORA" -gt 40 ]] || [[ "$RHEL" -ge 10 ]]; then
58+
ensure storage.conf pull_options \{enable_partial_images\ =\ \"true\",\ use_hard_links\ =\ \"false\",\ ostree_repos=\"\",\ convert_images\ =\ \"false\"\}
59+
# Leave composefs disabled
60+
ensure storage.conf use_composefs \"false\"
61+
fi

rpm/update-lib-versions.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -exo pipefail
4+
5+
SPECFILE=rpm/containers-common.spec
6+
7+
# Fetch versions from go.mod
8+
IMAGE_VERSION=$(awk '/github.com\/containers\/image/ {print $2}' go.mod)
9+
STORAGE_VERSION=$(awk '/github.com\/containers\/storage/ {print $2}' go.mod)
10+
11+
# Update versions in rpm spec
12+
sed -i "s/^%global image_branch main/%global image_branch $IMAGE_VERSION/" $SPECFILE
13+
sed -i "s/^%global storage_branch main/%global storage_branch $STORAGE_VERSION/" $SPECFILE

0 commit comments

Comments
 (0)