| |
@@ -64,6 +64,7 @@
|
| |
# Need fXX-updates-canddiate to get actual latest nightly
|
| |
#
|
| |
build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Base | awk '{print $1}')
|
| |
+ minimal_build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Minimal-Base | awk '{print $1}')
|
| |
|
| |
if [[ ${1} -eq "$current_stable" ]]; then
|
| |
tagname="latest"
|
| |
@@ -71,6 +72,42 @@
|
| |
if [[ ${1} -eq "$current_rawhide" ]]; then
|
| |
tagname="rawhide"
|
| |
fi
|
| |
+ if [[ -z "$stage" ]]; then
|
| |
+ registries=("registry.fedoraproject.org" "candidate-registry.fedoraproject.org" "quay.io/fedora")
|
| |
+ else
|
| |
+ registries=("registry.stg.fedoraproject.org" "candidate-registry.stg.fedoraproject.org")
|
| |
+ fi
|
| |
+
|
| |
+ # Copy a local image to all necessary remote registries
|
| |
+ copy_image() {
|
| |
+ local src=$1; shift
|
| |
+ local name=$1; shift
|
| |
+ for registry in ${registries[@]}; do
|
| |
+ skopeo copy $src docker://${registry}/${name}
|
| |
+ done
|
| |
+ }
|
| |
+
|
| |
+ # From already uploaded architecture-specific images, generate a manifest listed image
|
| |
+ # on all registries
|
| |
+ generate_manifest_list() {
|
| |
+ local name=$1; shift
|
| |
+ for registry in "${registries[@]}"
|
| |
+ do
|
| |
+ printf "Push manifest to ${registry}\n"
|
| |
+ if [ -n "$tagname" ]
|
| |
+ then
|
| |
+ printf "tag is set: ${tagname}\n"
|
| |
+ buildah rmi "${registry}/${name}:${tagname}" || true
|
| |
+ buildah manifest create "${registry}/${name}:${tagname}" "${ARCHES[@]/#/docker://${registry}/${name}:${1}-}"
|
| |
+ buildah manifest push "${registry}/${name}:${tagname}" "docker://${registry}/${name}:${tagname}" --all
|
| |
+
|
| |
+ fi
|
| |
+ buildah rmi "${registry}/${name}:${1}" || true
|
| |
+ buildah manifest create "${registry}/${name}:${1}" "${ARCHES[@]/#/docker://${registry}/fedora:${1}-}"
|
| |
+ buildah manifest push "${registry}/${name}:${1}" "docker://${registry}/${name}:${1}" --all
|
| |
+ done
|
| |
+ }
|
| |
+
|
| |
#
|
| |
# Version should not be higher than rawhide
|
| |
# Either there is a mistake or script is out of date
|
| |
@@ -80,46 +117,20 @@
|
| |
exit 1
|
| |
fi
|
| |
|
| |
- minimal_build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Minimal-Base | awk '{print $1}')
|
| |
if [[ -n ${build_name} ]]; then
|
| |
# Download the image
|
| |
work_dir=$(mktemp -d)
|
| |
pushd ${work_dir} &> /dev/null
|
| |
koji download-build --type=image ${build_name}
|
| |
# Import the image
|
| |
- for arch in "${ARCHES[@]}"
|
| |
- do
|
| |
+ for arch in "${ARCHES[@]}"; do
|
| |
xz -d ${build_name}.${arch}.tar.xz
|
| |
- # If ${stage} is a non-zero length string, then perform staging
|
| |
- if [[ -z "$stage" ]]; then
|
| |
- registries=("registry.fedoraproject.org" "candidate-registry.fedoraproject.org" "quay.io/fedora")
|
| |
- skopeo copy docker-archive:${build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora:${1}-${arch}
|
| |
- skopeo copy docker-archive:${build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora:${1}-${arch}
|
| |
- skopeo copy docker-archive:${build_name}.${arch}.tar docker://quay.io/fedora/fedora:${1}-${arch}
|
| |
- else
|
| |
- registries=("registry.stg.fedoraproject.org" "candidate-registry.stg.fedoraproject.org")
|
| |
- skopeo copy docker-archive:${build_name}.${arch}.tar docker://registry.stg.fedoraproject.org/fedora:${1}-${arch}
|
| |
- skopeo copy docker-archive:${build_name}.${arch}.tar docker://candidate-registry.stg.fedoraproject.org/fedora:${1}-${arch}
|
| |
- fi
|
| |
+ copy_image docker-archive:${build_name}.${arch}.tar fedora:${1}-${arch}
|
| |
done
|
| |
|
| |
popd &> /dev/null
|
| |
|
| |
- for registry in "${registries[@]}"
|
| |
- do
|
| |
- printf "Push manifest to ${registry}\n"
|
| |
- if [ -n "$tagname" ]
|
| |
- then
|
| |
- printf "tag is set: ${tagname}\n"
|
| |
- buildah rmi "${registry}/fedora:${tagname}" || true
|
| |
- buildah manifest create "${registry}/fedora:${tagname}" "${ARCHES[@]/#/docker://${registry}/fedora:${1}-}"
|
| |
- buildah manifest push "${registry}/fedora:${tagname}" "docker://${registry}/fedora:${tagname}" --all
|
| |
-
|
| |
- fi
|
| |
- buildah rmi "${registry}/fedora:${1}" || true
|
| |
- buildah manifest create "${registry}/fedora:${1}" "${ARCHES[@]/#/docker://${registry}/fedora:${1}-}"
|
| |
- buildah manifest push "${registry}/fedora:${1}" "docker://${registry}/fedora:${1}" --all
|
| |
- done
|
| |
+ generate_manifest_list fedora
|
| |
printf "Removing temporary directory\n"
|
| |
rm -rf $work_dir
|
| |
fi
|
| |
@@ -129,41 +140,14 @@
|
| |
pushd ${work_dir} &> /dev/null
|
| |
koji download-build --type=image ${minimal_build_name}
|
| |
# Import the image
|
| |
- for arch in "${ARCHES[@]}"
|
| |
- do
|
| |
+ for arch in "${ARCHES[@]}"; do
|
| |
xz -d ${minimal_build_name}.${arch}.tar.xz
|
| |
- # If ${stage} is a non-zero length string, then perform staging
|
| |
- if [[ -z "$stage" ]]; then
|
| |
- registries=("registry.fedoraproject.org" "candidate-registry.fedoraproject.org" "quay.io/fedora")
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora-minimal:${1}-${arch}
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora-minimal:${1}-${arch}
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://quay.io/fedora/fedora-minimal:${1}-${arch}
|
| |
-
|
| |
- else
|
| |
- registries=("registry.stg.fedoraproject.org" "candidate-registry.stg.fedoraproject.org")
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://registry.stg.fedoraproject.org/fedora-minimal:${1}-${arch}
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://candidate-registry.stg.fedoraproject.org/fedora-minimal:${1}-${arch}
|
| |
- skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://quay.io/fedora/fedora-minimal:${1}-${arch}
|
| |
- fi
|
| |
- done
|
| |
- popd &> /dev/null
|
| |
-
|
| |
- for registry in "${registries[@]}"
|
| |
- do
|
| |
- printf "Push manifest to ${registry}\n"
|
| |
- if [ -n "$tagname" ]
|
| |
- then
|
| |
- printf "tag is set: ${tagname}\n"
|
| |
- buildah rmi "${registry}/fedora-minimal:${tagname}" || true
|
| |
- buildah manifest create "${registry}/fedora-minimal:${tagname}" "${ARCHES[@]/#/docker://${registry}/fedora-minimal:${1}-}"
|
| |
- buildah manifest push "${registry}/fedora-minimal:${tagname}" "docker://${registry}/fedora-minimal:${tagname}" --all
|
| |
- fi
|
| |
- buildah rmi "${registry}/fedora-minimal:${1}" || true
|
| |
- buildah manifest create "${registry}/fedora-minimal:${1}" "${ARCHES[@]/#/docker://${registry}/fedora-minimal:${1}-}"
|
| |
- buildah manifest push "${registry}/fedora-minimal:${1}" "docker://${registry}/fedora-minimal:${1}" --all
|
| |
- done
|
| |
+ copy_image docker-archive:${minimal_build_name}.${arch}.tar fedora-minimal:${1}-${arch}
|
| |
+ done
|
| |
+ popd &> /dev/null
|
| |
|
| |
- printf "Removing temporary directory\n"
|
| |
- rm -rf $work_dir
|
| |
+ generate_manifest_list fedora-minimal
|
| |
|
| |
+ printf "Removing temporary directory\n"
|
| |
+ rm -rf $work_dir
|
| |
fi
|
| |
scripts/sync-container: Deduplicate assignment of registries
Prep for further work.
Signed-off-by: Colin Walters walters@verbum.org
scripts/sync-container: Consolidate assignments
Having the
minimal_build_name =
right before the comparisonfor
build_name
was just confusing.Signed-off-by: Colin Walters walters@verbum.org
scripts/sync-container: Dedup copy code
Prep for further work
Signed-off-by: Colin Walters walters@verbum.org
scripts/sync-container: Deduplicate manifest list code
Prep for further work.
Signed-off-by: Colin Walters walters@verbum.org