Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct update script to support version argument again #2156

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build-automation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
9 changes: 7 additions & 2 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really bad as (ba)sh scripting, so there's probably a better solution to this. It works, tho - both with and without the version arguments


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
Expand Down
4 changes: 2 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ function update_node_version() {
)
}

pids=()

for version in "${versions[@]}"; do
parentpath=$(dirname "${version}")
versionnum=$(basename "${version}")
Expand All @@ -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" &
Expand Down