Skip to content

Commit

Permalink
add env detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadura committed Sep 6, 2024
1 parent efd7c59 commit e3ba124
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/scripts/setup-busola.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@ echo "Create k3d registry..."

echo "Build local image"
docker build -t "${REPO_IMG_DEV}" -f Dockerfile.local.kyma .
echo "Running kyma-dashboard..."
docker run -d --rm --net=host --pid=host --name kyma-dashboard "${REPO_IMG_DEV}"
echo "Running kyma-dashboard... with ${ENV} configuration"
docker run -d --rm --net=host --pid=host --name kyma-dashboard --env ENVIRONMENT="${ENV}" "${REPO_IMG_DEV}"

echo "waiting for server to be up..."
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "http://localhost:3001")" != "200" ]]; do sleep 5; done
sleep 10
sleep 10

ENV_RESPONSE=$(curl "http://localhost:3001/active.env")
echo $ENV_RESPONSE

ACTIVE_ENV=${ENV_RESPONSE/ENVIRONMENT=}
ACTIVE_ENV=$(echo "${ACTIVE_ENV}" | tr -d '\n')
echo "Active env: ${ACTIVE_ENV}"

if [ "$ENV" != "$ACTIVE_ENV" ]; then
echo "Active env: ${ACTIVE_ENV} is not the same as desired: ${ENV}"
exit 1
fi
echo "Active env matches the desired env"

0 comments on commit e3ba124

Please sign in to comment.