Skip to content

Commit 1354df7

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

File tree

4 files changed

+45
-105
lines changed

4 files changed

+45
-105
lines changed

common/.packit.yaml renamed to .packit.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
# See the documentation for more information:
33
# https://packit.dev/docs/configuration/
44

5-
upstream_tag_template: v{version}
5+
upstream_tag_template: common/v{version}
66

77
packages:
88
containers-common-fedora:
99
downstream_package_name: containers-common
1010
pkg_tool: fedpkg
11-
specfile_path: rpm/containers-common.spec
11+
specfile_path: common/rpm/containers-common.spec
1212
containers-common-centos:
1313
downstream_package_name: containers-common
1414
pkg_tool: centpkg
15-
specfile_path: rpm/containers-common.spec
15+
specfile_path: common/rpm/containers-common.spec
1616
containers-common-eln:
1717
downstream_package_name: containers-common
18-
specfile_path: rpm/containers-common.spec
19-
20-
actions:
21-
pre-sync: "bash rpm/update-lib-versions.sh"
18+
specfile_path: common/rpm/containers-common.spec
2219

2320
jobs:
2421
- job: copr_build
2522
trigger: pull_request
2623
packages: [containers-common-fedora]
2724
notifications: &ephemeral_build_failure_notification
2825
failure_comment:
29-
message: "Ephemeral COPR build failed. @containers/packit-build please check."
26+
message: "Packit jobs failed. @containers/packit-build please check."
3027
enable_net: true
3128
targets:
3229
- fedora-all
@@ -55,7 +52,7 @@ jobs:
5552

5653
# Run on commit to main branch
5754
- job: copr_build
58-
trigger: commit
55+
trigger: ignore
5956
packages: [containers-common-fedora]
6057
notifications:
6158
failure_comment:
@@ -71,11 +68,13 @@ jobs:
7168
dist_git_branches: &fedora_targets
7269
- fedora-all
7370

71+
# Ignore CentOS Stream for now
7472
- job: propose_downstream
75-
trigger: release
73+
trigger: ignore
7674
packages: [containers-common-centos]
7775
dist_git_branches:
7876
- c10s
77+
- c9s
7978

8079
# Fedora Koji build
8180
- job: koji_build

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)