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 broken test.sh node image replacement logic #162

Merged
merged 3 commits into from
Jul 24, 2024
Merged
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
21 changes: 14 additions & 7 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bash
source ./support.sh


exit_code=0 # Keep global, so that code below can get return value of this function
run_with_suppressed_output () {
run_with_suppressed_output() {
exit_code=0
logs=$(eval "$1 2>&1") || exit_code=$?
if [ $exit_code -ne 0 ]; then
Expand All @@ -15,9 +14,9 @@ run_with_suppressed_output () {
source ./versions.sh

if [ -n "${CI_VERSION:-}" ]; then
meteor_versions=( "$CI_VERSION" )
meteor_versions=("$CI_VERSION")
elif [[ "${1-x}" != x ]]; then
meteor_versions=( "$1" )
meteor_versions=("$1")
GeoffreyBooth marked this conversation as resolved.
Show resolved Hide resolved
fi

cd example
Expand All @@ -39,7 +38,15 @@ for version in "${meteor_versions[@]}"; do

cp "${dockerfile}" test.dockerfile
do_sed "s|FROM geoffreybooth/meteor-base:.*|FROM geoffreybooth/meteor-base:${version}|" test.dockerfile
do_sed "s|FROM node:.*|FROM node:${node_version}-alpine|" test.dockerfile

if [[ $(get_version_string "${node_version}") -ge $(get_version_string 14.21.4) && $(get_version_string "${node_version}") -lt $(get_version_string 18.0.0) ]]; then
echo 'Using Meteor fork of Node Docker image...'
do_sed "s|FROM node:.*|FROM meteor/node:${node_version}-alpine3.17|" test.dockerfile
else
echo 'Using official Node Docker image...'
do_sed "s|FROM node:.*|FROM node:${node_version}-alpine|" test.dockerfile
fi

do_sed "s|/app|/test-app|g" test.dockerfile

cp docker-compose.yml test.docker-compose.yml
Expand All @@ -53,7 +60,7 @@ for version in "${meteor_versions[@]}"; do

# Poll until docker-compose network ready, timing out after 20 seconds
for i in {1..20}; do
(curl --silent --fail http://localhost/ | grep __meteor_runtime_config__) > /dev/null 2>&1 && break || {
(curl --silent --fail http://localhost/ | grep __meteor_runtime_config__) >/dev/null 2>&1 && break || {
if [ "$i" -lt 21 ]; then
sleep 1
else
Expand Down Expand Up @@ -97,7 +104,7 @@ for version in "${meteor_versions[@]}"; do
fi
done

if $at_least_one_failure ; then
if $at_least_one_failure; then
printf "${RED}FAIL! At least one image failed the test${NC}\n"
exit 1
else
Expand Down
Loading