containers-common-0.60.2-11.el10

- Install shortnames from Pyxis and overrides
- Resolves: RHEL-34940

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
This commit is contained in:
Jindrich Novy 2024-10-31 12:51:32 +01:00
parent fa3121e460
commit c2dc7e4b3e
4 changed files with 5464 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
[aliases]
"skopeo" = "registry.access.redhat.com/ubi8/skopeo"
"ubi8/skopeo" = "registry.access.redhat.com/ubi8/skopeo"
"rhel9/skopeo" = "registry.redhat.io/rhel9/skopeo"
"buildah" = "registry.access.redhat.com/ubi8/buildah"
"ubi8/buildah" = "registry.access.redhat.com/ubi8/buildah"
"rhel9/buildah" = "registry.redhat.io/rhel9/buildah"
"podman" = "registry.access.redhat.com/ubi8/podman"
"ubi8/podman" = "registry.access.redhat.com/ubi8/podman"
"rhel9/podman" = "registry.redhat.io/rhel9/podman"

View File

@ -40,7 +40,7 @@ Epoch: 5
# copr and koji builds.
# If you're reading this on dist-git, the version is automatically filled in by Packit.
Version: 0.60.2
Release: 10%{?dist}
Release: 11%{?dist}
License: Apache-2.0
BuildArch: noarch
# for BuildRequires: go-md2man
@ -77,6 +77,8 @@ Source15: REKOR-signing-key
Source16: SIGSTORE-redhat-release3
Source17: registry.access.redhat.com.yaml
Source18: registry.redhat.io.yaml
Source19: 001-rhel-shortnames-pyxis.conf
Source20: 002-rhel-shortnames-overrides.conf
%description
This package contains common configuration files and documentation for container
@ -173,6 +175,8 @@ install -dp -m 700 %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers
touch %{buildroot}%{_prefix}/lib/containers/storage/overlay-layers/layers.lock
install -Dp -m0644 shortnames.conf %{buildroot}%{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
install -m0644 %{SOURCE19} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/001-rhel-shortnames.conf
install -m0644 %{SOURCE20} %{buildroot}%{_sysconfdir}/containers/registries.conf.d/002-rhel-shortnames-overrides.conf
install -Dp -m0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/containers/registries.d/default.yaml
install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/containers/policy.json
install -Dp -m0644 registries.conf %{buildroot}%{_sysconfdir}/containers/registries.conf
@ -223,7 +227,7 @@ ln -s ../../../..%{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/
%config(noreplace) %{_sysconfdir}/containers/policy.json
%config(noreplace) %{_sysconfdir}/containers/registries.conf
%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/000-shortnames.conf
%config(noreplace) %{_sysconfdir}/containers/registries.conf.d/*.conf
%if 0%{?fedora} || 0%{?centos}
%{_sysconfdir}/pki/sigstore/REKOR-signing-key
%{_sysconfdir}/pki/sigstore/SIGSTORE-redhat-release3
@ -251,6 +255,10 @@ ln -s ../../../..%{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/
%files extra
%changelog
* Thu Oct 31 2024 Jindrich Novy <jnovy@redhat.com> - 5:0.60.2-11
- Install shortnames from Pyxis and overrides
- Resolves: RHEL-34940
* Wed Oct 30 2024 Jindrich Novy <jnovy@redhat.com> - 5:0.60.2-10
- don't use registry yaml files from upstream but RHEL10 dedicated ones
- Resolves: RHEL-65203

62
pyxis.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
set -e
rm -f /tmp/pyxis*.json
TOTAL=`curl -s --negotiate -u: -H 'Content-Type: application/json' -H 'Accept: application/json' -X GET "https://pyxis.engineering.redhat.com/v1/repositories?page_size=1" | jq .total`
if [ "$TOTAL" == "null" ]; then
echo "Error comunicating with Pyxis API."
exit 1
fi
PAGES=$(($TOTAL/250))
for P in `seq 0 $PAGES`; do
curl -s --negotiate -u: -H 'Content-Type: application/json' -H 'Accept: application/json' -X GET "https://pyxis.engineering.redhat.com/v1/repositories?page_size=500&page=$P" > /tmp/pyxis$P.json
done
cat /tmp/pyxis*.json > /tmp/pyx.json
rm -f /tmp/pyx_debug
rm -f /tmp/rhel-shortnames.conf
jq '.data[]|.published,.requires_terms,.repository,.registry,.release_categories[0]' < /tmp/pyx.json >/tmp/pyx
readarray -t lines < /tmp/pyx
IDX=0
while [ $IDX -lt ${#lines[@]} ]; do
PUBLISHED=${lines[$IDX]}
REQ_TERMS=${lines[$IDX+1]}
REPOSITORY=`echo ${lines[$IDX+2]} | tr -d '"'`
REGISTRY=`echo ${lines[$IDX+3]} | tr -d '"'`
RELEASE=`echo ${lines[$IDX+4]} | tr -d '"'`
if [ "$PUBLISHED" == "true" ] &&
[ "$RELEASE" == "Generally Available" ] &&
[ ! -z "$REPOSITORY" ] &&
[ "$REPOSITORY" != \"\" ] &&
[[ $REPOSITORY != *[@:]* ]] &&
[[ $REPOSITORY != *[* ]] &&
[[ $REGISTRY == *.* ]] &&
[ "$REGISTRY" != "non_registry" ]; then
if [[ $REGISTRY == *quay.io* ]] ||
[[ $REGISTRY == *redhat.com* ]]; then
if [ "$REQ_TERMS" == "true" ]; then
REGISTRY=registry.redhat.io
fi
fi
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\""
echo $PUBLISHED,$REQ_TERMS,$REPOSITORY,$REGISTRY,$RELEASE >> /tmp/pyx_debug
echo "\"$REPOSITORY\" = \"$REGISTRY/$REPOSITORY\"" >> /tmp/rhel-shortnames.conf
fi
IDX=$(($IDX+5))
done
cp /tmp/rhel-shortnames.conf /tmp/r.conf
for D in `cut -d\ -f1 /tmp/r.conf | sort | uniq -d`; do
echo $D
M=`grep ^$D /tmp/r.conf | grep 'redhat.com' | tail -n1`
[ -z "$M" ] && M=`grep ^$D /tmp/r.conf | tail -n1`
echo $M
if [ ! -z "$M" ]; then
echo "replacing $D with $M"
grep -v "^$D.*" /tmp/r.conf > /tmp/r2.conf
echo "$M" >> /tmp/r2.conf
mv /tmp/r2.conf /tmp/r.conf
fi
done
sed -i '/.*rhel.*-els\/.*$/d' /tmp/r.conf
echo "[aliases]" > 001-rhel-shortnames-pyxis.conf
sort /tmp/r.conf >> 001-rhel-shortnames-pyxis.conf