diff --git a/build-automation.mjs b/build-automation.mjs index 9a085826b..ba296d1ed 100644 --- a/build-automation.mjs +++ b/build-automation.mjs @@ -87,13 +87,13 @@ export default async function(github) { } else { const newVersions = await checkForMuslVersionsAndSecurityReleases(github, versions); let updatedVersions = []; - for (let version of Object.keys(newVersions)) { - if (newVersions[version].muslBuildExists) { - const { stdout } = await exec(`./update.sh ${newVersions[version].isSecurityRelease ? "-s " : ""}${version}`); + for (const [version, newVersion] of Object.entries(newVersions)) { + if (newVersion.muslBuildExists) { + const { stdout } = await exec(`./update.sh ${newVersion.isSecurityRelease ? "-s " : ""}${version}`); console.log(stdout); - updatedVersions.push(newVersions[version].fullVersion); + updatedVersions.push(newVersion.fullVersion); } else { - console.log(`There's no musl build for version ${newVersions[version].fullVersion} yet.`); + console.log(`There's no musl build for version ${newVersion.fullVersion} yet.`); process.exit(0); } } diff --git a/functions.sh b/functions.sh index bee3dafe0..7c927cc08 100755 --- a/functions.sh +++ b/functions.sh @@ -136,13 +136,18 @@ function get_config() { # Get available versions for a given path # # The result is a list of valid versions. +# shellcheck disable=SC2120 function get_versions() { + shift + local versions=() - local dirs=() + local dirs=("$@") local default_variant default_variant=$(get_config "./" "default_variant") - IFS=' ' read -ra dirs <<< "$(echo "./"*/)" + if [ ${#dirs[@]} -eq 0 ]; then + IFS=' ' read -ra dirs <<< "$(echo "./"*/)" + fi for dir in "${dirs[@]}"; do if [ -a "${dir}/Dockerfile" ] || [ -a "${dir}/${default_variant}/Dockerfile" ]; then diff --git a/update.sh b/update.sh index 0b6aaf69d..cd73b6e22 100755 --- a/update.sh +++ b/update.sh @@ -189,6 +189,8 @@ function update_node_version() { ) } +pids=() + for version in "${versions[@]}"; do parentpath=$(dirname "${version}") versionnum=$(basename "${version}") @@ -201,8 +203,6 @@ for version in "${versions[@]}"; do # See details in function.sh IFS=' ' read -ra variants <<< "$(get_variants "${parentpath}")" - pids=() - if [ -f "${version}/Dockerfile" ]; then if [ "${update_version}" -eq 0 ]; then update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" &