Skip to content

Commit 8e20b56

Browse files
committed
kiwi-related fixes
1 parent 80e5dc7 commit 8e20b56

2 files changed

Lines changed: 48 additions & 11 deletions

File tree

tools/common.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,31 @@ generate-filelist() {
6464
}
6565

6666
latest-build() {
67-
local path=$(printf "s3://resf-empanadas/buildimage-%s-%s/Rocky-%s-Container-%s-%s-%s.%s.%s" $version $arch $major $type $version $date $revision $arch)
68-
local res=$(log-cmd aws --region us-east-2 --profile peridot-prod s3 ls --recursive "$path" | sort | tail -1 | awk '{print $4}' | sed 's,^\(.*\)/.*$,\1,g')
69-
echo "$res"
67+
case $version in
68+
8|9)
69+
local path=$(printf "s3://resf-empanadas/buildimage-%s-%s/Rocky-%s-Container-%s-%s-%s.%s.%s" $version $arch $major $type $version $date $revision $arch)
70+
local res=$(log-cmd aws --region us-east-2 --profile peridot-prod s3 ls --recursive "$path" | sort | tail -1 | awk '{print $4}' | sed 's,^\(.*\)/.*$,\1,g')
71+
echo "$res"
72+
;;
73+
*)
74+
printf "rsync://msync.rockylinux.org/rocky-staging/%s/images/%s/Rocky-%s-Container-%s-%s-%s.%s.%s.oci.tar.xz" $version $arch $major $type $version $date $revision $arch
75+
;;
76+
esac
77+
return 0
78+
}
79+
80+
latest-build-name() {
81+
case $version in
82+
8|9)
83+
printf "Rocky-%s-Container-%s-%s-%s.%s.%s" $major $type $version $date $revision $arch
84+
;;
85+
*)
86+
printf "Rocky-%s-Container-%s-%s-%s.%s.%s.oci.tar.xz" $major $type $version $date $revision $arch
87+
;;
88+
esac
7089
return 0
7190
}
7291

7392
pattern=$(printf "Rocky-%s.%s-%s-%s" "$version" "$date" "$type" "$arch")
74-
manifest_tag="$(printf "localhost/rocky/%s/%s/%s:latest" $version $date $type)"
93+
manifest_tag="$(printf "localhost/rocky/%s/%s/%s:latest" $version $tagdate $type)"
7594
manifest_tag="${manifest_tag,,}" # convert to lowercase

tools/fetch-and-branch.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ type=${2}
55
arch=${3}
66
date=${4:-$(date +%Y%m%d)}
77
revision=${5:-0}
8+
tagdate=${TAGDATE:-date}
89

9-
major=${1:0:1}
10-
minor=${1:2:1}
10+
major=${version%%.*}
11+
rest=${version#*.}
12+
minor=${rest%%.*}
1113
TEMPLATE="library-template"
1214

1315
usage() {
1416
printf "%s: RELEASE TYPE ARCH [DATE]\n\n" $0
1517
log "$1"
1618
}
1719

20+
KIWI=false
21+
1822
# shellcheck disable=SC2046,1091,1090
1923
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
2024

@@ -29,12 +33,14 @@ build-container-manifests() {
2933
build_args="--os linux --arch s390x" ;;
3034
ppc64le)
3135
build_args="--os linux --arch ppc64le" ;;
36+
riscv64)
37+
build_args="--os linux --arch riscv64" ;;
3238
*) echo "invalid arch"; exit;;
3339
esac
3440

35-
if [[ -f kiwi.result.json ]]; then
41+
if [[ -f kiwi.result.json || $KIWI ]]; then
3642
log "found kiwi image"
37-
oci="$(find "$PWD" -maxdepth 1 -type f -name '*.oci')"
43+
oci="$(find "$PWD" -maxdepth 1 -type f -name '*.oci*')"
3844
if [[ ! -f "${oci}" ]]; then
3945
log "could not find OCI image. Aborting"
4046
exit 2
@@ -83,7 +89,7 @@ build-container-manifests() {
8389

8490
manifest-push-commands (){
8591
local destinations=("docker.io/rockylinux/rockylinux" "quay.io/rockylinux/rockylinux")
86-
local tags=("$version" "${version}.${date}")
92+
local tags=("$version" "${version}.${tagdate}")
8793
local final_tags=()
8894
for d in "${destinations[@]}"; do
8995
for t in "${tags[@]}"; do
@@ -122,13 +128,25 @@ check-and-download (){
122128
exit 3
123129
fi
124130

125-
log-cmd aws --region us-east-2 --profile peridot-prod s3 sync "s3://resf-empanadas/$builddir" $PWD
131+
case $version in
132+
8|9)
133+
log-cmd aws --region us-east-2 --profile peridot-prod s3 sync "s3://resf-empanadas/$builddir" $PWD
134+
;;
135+
*)
136+
KIWI=true
137+
until [[ -f "$(latest-build-name)" ]]; do
138+
log-cmd rsync -av "$builddir" .
139+
sleep 1;
140+
done
141+
;;
142+
esac
126143

127144
generate-packagelist
128145
generate-filelist
129146

130147
}
131148

149+
rm ./*.oci*
132150
check-and-download
133151
build-container-manifests
134152

@@ -140,7 +158,7 @@ if [[ ! -f "${tarball}" ]]; then
140158
exit 2
141159
else
142160
mv $tarball layer.tar.xz
143-
rm ./*.oci
161+
rm ./*.oci*
144162
fi
145163

146164
git add .

0 commit comments

Comments
 (0)