Skip to content

Commit 1e62679

Browse files
committed
Packit: initial enablement
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 8d56bca commit 1e62679

File tree

4 files changed

+125
-95
lines changed

4 files changed

+125
-95
lines changed

.packit.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
# See the documentation for more information:
3+
# https://packit.dev/docs/configuration/
4+
5+
upstream_tag_template: common/v{version}
6+
7+
packages:
8+
containers-common-fedora:
9+
downstream_package_name: containers-common
10+
pkg_tool: fedpkg
11+
specfile_path: common/rpm/containers-common.spec
12+
containers-common-centos:
13+
downstream_package_name: containers-common
14+
pkg_tool: centpkg
15+
specfile_path: common/rpm/containers-common.spec
16+
containers-common-eln:
17+
downstream_package_name: containers-common
18+
specfile_path: common/rpm/containers-common.spec
19+
20+
jobs:
21+
- job: copr_build
22+
trigger: pull_request
23+
packages: [containers-common-fedora]
24+
notifications: &ephemeral_build_failure_notification
25+
failure_comment:
26+
message: "Packit jobs failed. @containers/packit-build please check."
27+
enable_net: true
28+
targets:
29+
- fedora-all
30+
31+
- job: copr_build
32+
trigger: pull_request
33+
packages: [containers-common-eln]
34+
notifications: *ephemeral_build_failure_notification
35+
enable_net: true
36+
targets:
37+
fedora-eln:
38+
# Need this to fetch go-md2man which is present in koji envs but not by
39+
# default on copr envs. Also helps to avoid bundling go-md2man in
40+
# c/common.
41+
additional_repos:
42+
- https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/
43+
44+
- job: copr_build
45+
trigger: pull_request
46+
packages: [containers-common-centos]
47+
notifications: *ephemeral_build_failure_notification
48+
enable_net: true
49+
targets:
50+
- centos-stream-9
51+
- centos-stream-10
52+
53+
# Run on commit to main branch
54+
- job: copr_build
55+
trigger: ignore
56+
packages: [containers-common-fedora]
57+
notifications:
58+
failure_comment:
59+
message: "podman-next COPR build failed. @containers/packit-build please check."
60+
branch: main
61+
owner: rhcontainerbot
62+
project: podman-next
63+
enable_net: true
64+
65+
- job: propose_downstream
66+
trigger: release
67+
packages: [containers-common-fedora]
68+
dist_git_branches: &fedora_targets
69+
- fedora-all
70+
71+
# Ignore CentOS Stream for now
72+
- job: propose_downstream
73+
trigger: ignore
74+
packages: [containers-common-centos]
75+
dist_git_branches:
76+
- c10s
77+
- c9s
78+
79+
# Fedora Koji build
80+
- job: koji_build
81+
trigger: commit
82+
packages: [containers-common-fedora]
83+
sidetag_group: podman-releases
84+
# Dependencies are not rpm dependencies, but packages that should go in the
85+
# same bodhi update
86+
# Ref: https://packit.dev/docs/fedora-releases-guide/releasing-multiple-packages
87+
dependents:
88+
- podman
89+
dist_git_branches: *fedora_targets

common/rpm/containers-common.spec

Lines changed: 21 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
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-
131
%global project containers
14-
%global repo common
15-
16-
%global raw_github_url https://raw.githubusercontent.com/%{project}
2+
%global repo container-libs
173

184
%if %{defined copr_username}
195
%define copr_build 1
@@ -35,7 +21,7 @@ Epoch: 5
3521
%endif
3622
# DO NOT TOUCH the Version string!
3723
# The TRUE source of this specfile is:
38-
# https://github.com/containers/common/blob/main/rpm/containers-common.spec
24+
# https://github.com/containers/container-libs/blob/main/common/rpm/containers-common.spec
3925
# If that's what you're reading, Version must be 0, and will be updated by Packit for
4026
# copr and koji builds.
4127
# If you're reading this on dist-git, the version is automatically filled in by Packit.
@@ -57,25 +43,12 @@ Requires: (fuse-overlayfs if fedora-release-identity-server)
5743
Suggests: fuse-overlayfs
5844
%endif
5945
URL: https://github.com/%{project}/%{repo}
60-
Source0: %{url}/archive/v%{version_no_tilde}.tar.gz
61-
Source1: %{raw_github_url}/image/%{image_branch}/docs/containers-auth.json.5.md
62-
Source2: %{raw_github_url}/image/%{image_branch}/docs/containers-certs.d.5.md
63-
Source3: %{raw_github_url}/image/%{image_branch}/docs/containers-policy.json.5.md
64-
Source4: %{raw_github_url}/image/%{image_branch}/docs/containers-registries.conf.5.md
65-
Source5: %{raw_github_url}/image/%{image_branch}/docs/containers-registries.conf.d.5.md
66-
Source6: %{raw_github_url}/image/%{image_branch}/docs/containers-registries.d.5.md
67-
Source7: %{raw_github_url}/image/%{image_branch}/docs/containers-signature.5.md
68-
Source8: %{raw_github_url}/image/%{image_branch}/docs/containers-transports.5.md
69-
Source9: %{raw_github_url}/storage/%{storage_branch}/docs/containers-storage.conf.5.md
70-
Source10: %{raw_github_url}/shortnames/%{shortnames_branch}/shortnames.conf
71-
Source11: %{raw_github_url}/image/%{image_branch}/default.yaml
72-
Source12: %{raw_github_url}/image/%{image_branch}/default-policy.json
73-
Source13: %{raw_github_url}/image/%{image_branch}/registries.conf
74-
Source14: %{raw_github_url}/storage/%{storage_branch}/storage.conf
46+
Source0: %{url}/archive/refs/tags/common/v%{version}.tar.gz
47+
Source1: https://raw.githubusercontent.com/containers/shortnames/refs/heads/main/shortnames.conf
7548
# Fetch RPM-GPG-KEY-redhat-release from the authoritative source instead of storing
7649
# a copy in repo or dist-git. Depending on distribution-gpg-keys rpm is also
7750
# not an option because that package doesn't exist on CentOS Stream.
78-
Source15: https://access.redhat.com/security/data/fd431d51.txt
51+
Source2: https://access.redhat.com/security/data/fd431d51.txt
7952

8053
%description
8154
This package contains common configuration files and documentation for container
@@ -109,34 +82,16 @@ This subpackage will handle dependencies common to Podman and Buildah which are
10982
not required by Skopeo.
11083

11184
%prep
112-
%autosetup -Sgit -n %{repo}-%{version_no_tilde}
113-
114-
# Copy manpages to docs subdir in builddir to build before installing.
115-
cp %{SOURCE1} docs/.
116-
cp %{SOURCE2} docs/.
117-
cp %{SOURCE3} docs/.
118-
cp %{SOURCE4} docs/.
119-
cp %{SOURCE5} docs/.
120-
cp %{SOURCE6} docs/.
121-
cp %{SOURCE7} docs/.
122-
cp %{SOURCE8} docs/.
123-
cp %{SOURCE9} docs/.
124-
125-
# Copy config files to builddir to patch them before installing.
126-
# Currently, only registries.conf and storage.conf files are patched before
127-
# installing.
128-
cp %{SOURCE10} shortnames.conf
129-
cp %{SOURCE13} registries.conf
130-
cp %{SOURCE14} storage.conf
85+
%autosetup -Sgit -n %{repo}-common-v%{version}
13186

13287
# Fine-grain distro- and release-specific tuning of config files,
13388
# e.g., seccomp, composefs, registries on different RHEL/Fedora versions
134-
bash rpm/update-config-files.sh
89+
bash common/rpm/update-config-files.sh
13590

13691
%build
13792
mkdir -p man5
138-
for i in docs/*.5.md; do
139-
go-md2man -in $i -out man5/$(basename $i .md)
93+
for i in common/docs/*.5.md image/docs/*.5.md storage/docs/*.5.md; do
94+
go-md2man -in $i -out man5/$(basename $i .md)
14095
done
14196

14297
%install
@@ -150,32 +105,31 @@ touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-images/images.lock
150105
install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers
151106
touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers/layers.lock
152107

153-
install -Dp -m0644 shortnames.conf %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
154-
install -Dp -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
155-
install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/containers/policy.json
156-
install -Dp -m0644 registries.conf %{buildroot}%{_sysconfdir}/containers/registries.conf
157-
install -Dp -m0644 storage.conf %{buildroot}%{_datadir}/containers/storage.conf
108+
install -Dp -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
109+
install -Dp -m0644 image/default.yaml %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
110+
install -Dp -m0644 image/default-policy.json %{buildroot}%{_sysconfdir}/containers/policy.json
111+
install -Dp -m0644 image/registries.conf %{buildroot}%{_sysconfdir}/containers/registries.conf
112+
install -Dp -m0644 storage/storage.conf %{buildroot}%{_datadir}/containers/storage.conf
158113

159114
# RPM-GPG-KEY-redhat-release already exists on rhel envs, install only on
160115
# fedora and centos
161116
%if %{defined fedora} || %{defined centos}
162-
install -Dp -m0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
117+
install -Dp -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
163118
%endif
164119

165-
install -Dp -m0644 contrib/redhat/registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
166-
install -Dp -m0644 contrib/redhat/registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
120+
install -Dp -m0644 common/contrib/redhat/registry.access.redhat.com.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
121+
install -Dp -m0644 common/contrib/redhat/registry.redhat.io.yaml -t %{buildroot}%{_sysconfdir}/containers/registries.d
167122

168123
# install manpages
169-
install -dp %{buildroot}%{_mandir}/man5
170124
for i in man5/*.5; do
171-
install -Dp -m0644 $i -t %{buildroot}%{_mandir}/man5
125+
install -Dp -m0644 $i -t %{buildroot}%{_mandir}/man5
172126
done
173127
ln -s containerignore.5 %{buildroot}%{_mandir}/man5/.containerignore.5
174128

175129
# install config files for mounts, containers and seccomp
176-
install -m0644 pkg/subscriptions/mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf
177-
install -m0644 pkg/seccomp/seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json
178-
install -m0644 pkg/config/containers.conf %{buildroot}%{_datadir}/containers/containers.conf
130+
install -m0644 common/pkg/subscriptions/mounts.conf %{buildroot}%{_datadir}/containers/mounts.conf
131+
install -m0644 common/pkg/seccomp/seccomp.json %{buildroot}%{_datadir}/containers/seccomp.json
132+
install -m0644 common/pkg/config/containers.conf %{buildroot}%{_datadir}/containers/containers.conf
179133

180134
# install secrets patch directory
181135
install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets

common/rpm/update-config-files.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,45 @@
55
set -exo pipefail
66

77
ensure() {
8-
if [[ ! -f $1 ]]; then
9-
echo "File not found:" $1
8+
if [[ ! -f "$1" ]]; then
9+
echo "File not found:" "$1"
1010
exit 1
1111
fi
12-
if grep ^$2[[:blank:]].*= $1 > /dev/null
12+
if grep "^$2[[:blank:]].*=" "$1" > /dev/null
1313
then
14-
sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" $1
14+
sed -i "s;^$2[[:blank:]]=.*;$2 = $3;" "$1"
1515
else
16-
if grep ^\#.*$2[[:blank:]].*= $1 > /dev/null
16+
if grep "^\#.*$2[[:blank:]].*=" "$1" > /dev/null
1717
then
1818
sed -i "/^#.*$2[[:blank:]].*=/a \
19-
$2 = $3" $1
19+
$2 = $3" "$1"
2020
else
21-
echo "$2 = $3" >> $1
21+
echo "$2 = $3" >> "$1"
2222
fi
2323
fi
2424
}
2525

2626
# Common options enabled across all fedora, centos, rhel
2727
# TBD: Can these be enabled by default upstream?
28-
ensure registries.conf short-name-mode \"enforcing\"
28+
ensure image/registries.conf short-name-mode \"enforcing\"
2929

30-
ensure storage.conf driver \"overlay\"
31-
ensure storage.conf mountopt \"nodev,metacopy=on\"
30+
ensure storage/storage.conf driver \"overlay\"
31+
ensure storage/storage.conf mountopt \"nodev,metacopy=on\"
3232

33-
ensure pkg/config/containers.conf runtime \"crun\"
34-
ensure pkg/config/containers.conf log_driver \"journald\"
33+
ensure common/pkg/config/containers.conf runtime \"crun\"
34+
ensure common/pkg/config/containers.conf log_driver \"journald\"
3535

3636
FEDORA=$(rpm --eval '%{?fedora}')
3737
RHEL=$(rpm --eval '%{?rhel}')
3838

3939
# Set search registries
4040
if [[ -n "$FEDORA" ]]; then
41-
ensure registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"docker.io\"]
41+
ensure image/registries.conf unqualified-search-registries [\"registry.fedoraproject.org\",\ \"registry.access.redhat.com\",\ \"docker.io\"]
4242
else
43-
ensure registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
43+
ensure image/registries.conf unqualified-search-registries [\"registry.access.redhat.com\",\ \"registry.redhat.io\",\ \"docker.io\"]
4444
fi
4545

4646
# Set these on all Fedora and RHEL 10+
4747
if [[ -n "$FEDORA" ]] || [[ "$RHEL" -ge 10 ]]; then
48-
sed -i -e '/^additionalimagestores\ =\ \[/a "\/usr\/lib\/containers\/storage",' storage.conf
48+
sed -i -e '/^additionalimagestores\ =\ \[/a "\/usr\/lib\/containers\/storage",' storage/storage.conf
4949
fi

common/rpm/update-lib-versions.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)