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

WIP: Introduce Windows Docker images #720

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed the update script not working properly with the -s flag or vari…
…ant filter
  • Loading branch information
LaurentGoderre committed Jun 22, 2018
commit 8bd6d484c2ba8cb63d47e5a42d84fe43e2d78d40
4 changes: 2 additions & 2 deletions functions.sh
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ function get_variants() {
local arch
local availablevariants
local variantsfilter
local variants
local variants=()

arch=$(get_arch)
variantsfilter=("$@")
@@ -143,7 +143,7 @@ function get_versions() {
prefix=${1:-.}
shift

local versions
local versions=()
local dirs=("$@")

local default_variant
37 changes: 32 additions & 5 deletions update.sh
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ while getopts "sh" opt; do
case "${opt}" in
s)
SKIP=true
shift
;;
h)
usage
@@ -46,7 +47,8 @@ done
cd "$(cd "${0%/*}" && pwd -P)"

IFS=' ' read -ra versions <<<"$(get_versions .)"
IFS=' ' read -ra update_versions <<<"$(get_versions . "$@")"
IFS=' ' read -ra update_versions <<<"$(get_versions . "${1-}")"
IFS=' ' read -ra update_variants <<<"$(get_variants . "${2-}")"
if [ ${#versions[@]} -eq 0 ]; then
fatal "No valid versions found!"
fi
@@ -65,6 +67,11 @@ fi
function in_versions_to_update() {
local version=$1

if [ "${#update_versions[@]}" -eq 0 ]; then
echo 0
return
fi

for version_to_update in "${update_versions[@]}"; do
if [ "${version_to_update}" = "${version}" ]; then
echo 0
@@ -75,6 +82,24 @@ function in_versions_to_update() {
echo 1
}

function in_variants_to_update() {
local variant=$1

if [ "${#update_variants[@]}" -eq 0 ]; then
echo 0
return
fi

for variant_to_update in "${update_variants[@]}"; do
if [ "${variant_to_update}" = "${variant}" ]; then
echo 0
return
fi
done

echo 1
}

function update_node_version() {

local baseuri=${1}
@@ -164,9 +189,9 @@ for version in "${versions[@]}"; do
parentpath=$(dirname "${version}")
versionnum=$(basename "${version}")
baseuri=$(get_config "${parentpath}" "baseuri")
update=$(in_versions_to_update "${version}")
update_version=$(in_versions_to_update "${version}")

[ "${update}" -eq 0 ] && info "Updating version ${version}..."
[ "${update_version}" -eq 0 ] && info "Updating version ${version}..."

# Get supported variants according the target architecture
# See details in function.sh
@@ -175,7 +200,7 @@ for version in "${versions[@]}"; do
if [ -f "${version}/Dockerfile" ]; then
add_stage "${baseuri}" "${version}" "default"

if [ "${update}" -eq 0 ]; then
if [ "${update_version}" -eq 0 ]; then
update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" &
fi
fi
@@ -185,7 +210,9 @@ for version in "${versions[@]}"; do
[ -f "${version}/${variant}/Dockerfile" ] || continue
add_stage "${baseuri}" "${version}" "${variant}"

if [ "${update}" -eq 0 ]; then
update_variant=$(in_variants_to_update "${variant}")

if [ "${update_version}" -eq 0 ] && [ "${update_variant}" -eq 0 ]; then
update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile-${variant}.template" "${version}/${variant}/Dockerfile" "${variant}" &
fi
done