Skip to content

Commit df80e2a

Browse files
committed
update-template-*.sh: Remove the overriding parameter from *_cache_key_for_image_kernel functions
The cache should operate on the original location in template. Signed-off-by: Norio Nomura <[email protected]>
1 parent f04c0f5 commit df80e2a

6 files changed

+17
-17
lines changed

hack/update-template-almalinux.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ function almalinux_latest_image_entry_for_url_spec() {
130130
}
131131
132132
function almalinux_cache_key_for_image_kernel() {
133-
local location=$1 overriding=${3:-"{}"} url_spec
134-
url_spec=$(almalinux_url_spec_from_location "${location}" | jq -r ". + ${overriding}")
133+
local location=$1 url_spec
134+
url_spec=$(almalinux_url_spec_from_location "${location}")
135135
jq -r '["almalinux", .major_minor_version // .major_version, .target_vendor,
136136
if .date then "timestamped" else "latest" end,
137137
.arch, .file_extension] | join(":")' <<<"${url_spec}"
@@ -254,7 +254,7 @@ for template in "${templates[@]}"; do
254254
set +e # Disable 'set -e' to avoid exiting on error for the next assignment.
255255
cache_key=$(
256256
set -e # Enable 'set -e' for the next command.
257-
almalinux_cache_key_for_image_kernel "${location}" "${kernel_location}" "${overriding}"
257+
almalinux_cache_key_for_image_kernel "${location}" "${kernel_location}"
258258
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
259259
# shellcheck disable=2181
260260
[[ $? -eq 0 ]] || continue

hack/update-template-archlinux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ for template in "${templates[@]}"; do
261261
set +e # Disable 'set -e' to avoid exiting on error for the next assignment.
262262
cache_key=$(
263263
set -e # Enable 'set -e' for the next command.
264-
archlinux_cache_key_for_image_kernel "${location}" "${kernel_location}" "${overriding}"
264+
archlinux_cache_key_for_image_kernel "${location}" "${kernel_location}"
265265
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
266266
# shellcheck disable=2181
267267
[[ $? -eq 0 ]] || continue

hack/update-template-centos-stream.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Description:
2020
This script updates the CentOS Stream image location in the specified templates.
2121
If the image location in the template contains a release date in the URL, the script replaces it with the latest available date.
2222
23-
Image location basename format: CentOS[Stream-GenericCloud-<version>-[latest|<date>.0].<arch>.qcow2
23+
Image location basename format: CentOS-Stream-GenericCloud-<version>-[latest|<date>.0].<arch>.qcow2
2424
2525
Published CentOS Stream image information is fetched from the following URLs:
2626
@@ -121,8 +121,8 @@ function centos_latest_image_entry_for_url_spec() {
121121
}
122122
123123
function centos_cache_key_for_image_kernel() {
124-
local location=$1 overriding=${3:-"{}"} url_spec
125-
url_spec=$(centos_url_spec_from_location "${location}" | jq -r ". + ${overriding}")
124+
local location=$1 url_spec
125+
url_spec=$(centos_url_spec_from_location "${location}")
126126
jq -r '["centos", .version, .target_vendor,
127127
if .date_and_ci_job_id then "timestamped" else "latest" end,
128128
.arch, .file_extension] | join(":")' <<<"${url_spec}"
@@ -241,7 +241,7 @@ for template in "${templates[@]}"; do
241241
set +e # Disable 'set -e' to avoid exiting on error for the next assignment.
242242
cache_key=$(
243243
set -e # Enable 'set -e' for the next command.
244-
centos_cache_key_for_image_kernel "${location}" "${kernel_location}" "${overriding}"
244+
centos_cache_key_for_image_kernel "${location}" "${kernel_location}"
245245
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
246246
# shellcheck disable=2181
247247
[[ $? -eq 0 ]] || continue

hack/update-template-debian.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ function debian_location_from_url_spec() {
285285
# debian_release_24.04-server-amd64-.img
286286
# ```
287287
function debian_cache_key_for_image_kernel_overriding() {
288-
local location=$1 kernel_location=${2:-null} overriding=${3:-"{}"} url_spec with_kernel='' version backports arch daily timestamped file_extension
289-
url_spec=$(debian_url_spec_from_location "${location}" | jq -r ". + ${overriding}")
288+
local location=$1 kernel_location=${2:-null} url_spec with_kernel='' version backports arch daily timestamped file_extension
289+
url_spec=$(debian_url_spec_from_location "${location}")
290290
[[ ${kernel_location} != "null" ]] && with_kernel=_with_kernel
291291
version=$(jq -r '.version|if . then "-\(.)" else empty end' <<<"${url_spec}")
292292
backports=$(jq -r 'if .backports then "-backports" else empty end' <<<"${url_spec}")
@@ -407,7 +407,7 @@ for template in "${templates[@]}"; do
407407
set +e # Disable 'set -e' to avoid exiting on error for the next assignment.
408408
cache_key=$(
409409
set -e # Enable 'set -e' for the next command.
410-
debian_cache_key_for_image_kernel_overriding "${location}" "${kernel_location}" "${overriding}"
410+
debian_cache_key_for_image_kernel_overriding "${location}" "${kernel_location}"
411411
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
412412
# shellcheck disable=2181
413413
[[ $? -eq 0 ]] || continue

hack/update-template-rocky.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ function rocky_latest_image_entry_for_url_spec() {
145145
}
146146
147147
function rocky_cache_key_for_image_kernel() {
148-
local location=$1 overriding=${3:-"{}"} url_spec
149-
url_spec=$(rocky_url_spec_from_location "${location}" | jq -r ". + ${overriding}")
148+
local location=$1 url_spec
149+
url_spec=$(rocky_url_spec_from_location "${location}")
150150
jq -r '["rocky", .major_minor_version // .major_version, .target_vendor,
151151
if .date_and_ci_job_id then "timestamped" else "latest" end,
152152
.arch, .file_extension] | join(":")' <<<"${url_spec}"
@@ -269,7 +269,7 @@ for template in "${templates[@]}"; do
269269
set +e # Disable 'set -e' to avoid exiting on error for the next assignment.
270270
cache_key=$(
271271
set -e # Enable 'set -e' for the next command.
272-
rocky_cache_key_for_image_kernel "${location}" "${kernel_location}" "${overriding}"
272+
rocky_cache_key_for_image_kernel "${location}" "${kernel_location}"
273273
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
274274
# shellcheck disable=2181
275275
[[ $? -eq 0 ]] || continue

hack/update-template-ubuntu.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ function ubuntu_cache_key_for_image_kernel_flavor_version() {
302302
local location=$1 kernel_location=${2:-null} url_spec with_kernel='' flavor version arch path_suffix
303303
url_spec=$(ubuntu_location_url_spec "${location}")
304304
[[ ${kernel_location} != "null" ]] && with_kernel=_with_kernel
305-
flavor=${3:-$(ubuntu_flavor_from_location_basename "${location}")}
306-
version=${4:-$(ubuntu_version_from_location_basename "${location}")}
305+
flavor=$(ubuntu_flavor_from_location_basename "${location}")
306+
version=$(ubuntu_version_from_location_basename "${location}")
307307
arch=$(ubuntu_arch_from_location_basename "${location}")
308308
path_suffix=$(ubuntu_path_suffix_from_location_basename "${location}")
309309
echo "ubuntu_${url_spec}${with_kernel}_${version}-${flavor}-${arch}-${path_suffix}"
@@ -425,7 +425,7 @@ for template in "${templates[@]}"; do
425425
[[ $? -eq 0 ]] || continue
426426
cache_key=$(
427427
set -e # Enable 'set -e' for the next command.
428-
ubuntu_cache_key_for_image_kernel_flavor_version "${location}" "${kernel_location}" "${overriding_flavor}" "${overriding_version}"
428+
ubuntu_cache_key_for_image_kernel_flavor_version "${location}" "${kernel_location}"
429429
) # Check exit status separately to prevent disabling 'set -e' by using the function call in the condition.
430430
# shellcheck disable=2181
431431
[[ $? -eq 0 ]] || continue

0 commit comments

Comments
 (0)