Skip to content

Commit

Permalink
move atomically instead of munge in place because syntax diff bsd vs …
Browse files Browse the repository at this point in the history
…gnu sed
  • Loading branch information
qrkourier committed Sep 6, 2023
1 parent e8f8da3 commit a2d1103
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions quickstart/test/compose-test.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ fi
mv ./simplified-docker-compose.yml ./compose.yml

# learn the expected Go version from the Go mod file so we can pull the correct container image
ZITI_GO_VERSION="$(awk '/^go\s+/ {print $2}' ./go.mod)"
ZITI_GO_VERSION="$(awk '/^go[[:space:]]+/ {print $2}' ./go.mod)"
# make this var available in the Compose project
sed -Ei '' "s/^(#[[:space:]]+)?(ZITI_GO_VERSION)=.*/\2=${ZITI_GO_VERSION}/" ./.env
sed -Ei '' "s/^(#[[:space:]]+)?(ZITI_PWD)=.*/\2=${ZITI_PWD}/" ./.env
sed -Ei '' "s/^(#[[:space:]]+)?(ZITI_INTERFACE)=.*/\2=${ZITI_INTERFACE:-127.0.0.1}/" ./.env
sed -Ee "s/^(#[[:space:]]+)?(ZITI_GO_VERSION)=.*/\2=${ZITI_GO_VERSION}/" \
-e "s/^(#[[:space:]]+)?(ZITI_PWD)=.*/\2=${ZITI_PWD}/" \
-e "s/^(#[[:space:]]+)?(ZITI_INTERFACE)=.*/\2=${ZITI_INTERFACE:-127.0.0.1}/" ./.env > ./.env.tmp
mv ./.env.tmp ./.env

# pull images preemptively that we never build locally because pull=never when using a local quickstart image
for IMAGE in \
Expand All @@ -111,7 +112,8 @@ trap down_project SIGTERM SIGINT EXIT

# if ZITI_QUICK_IMAGE_TAG is set then run the locally-built image
if [[ -n "${ZITI_QUICK_IMAGE_TAG:-}" ]]; then
sed -Ei '' "s/^(#[[:space:]]+)?(ZITI_VERSION)=.*/\2=${ZITI_QUICK_IMAGE_TAG}/" ./.env
sed -Ee "s/^(#[[:space:]]+)?(ZITI_VERSION)=.*/\2=${ZITI_QUICK_IMAGE_TAG}/" ./.env > ./.env.tmp
mv ./.env.tmp ./.env
docker compose up --detach --pull=never &>/dev/null # no pull because local quickstart image
else
echo "ERROR: ZITI_QUICK_IMAGE_TAG is not set" >&2
Expand All @@ -138,7 +140,6 @@ docker compose exec ziti-controller \
source "${ZITI_SCRIPTS}/ziti-cli-functions.sh" >/dev/null;
echo "INFO: waiting for controller";
source /persistent/ziti.env >/dev/null;
set -u;
_wait_for_controller >/dev/null;
echo "INFO: waiting for public router";
source /persistent/ziti.env >/dev/null;
Expand Down

0 comments on commit a2d1103

Please sign in to comment.