Skip to content

Commit

Permalink
container names with candigv2_*_1
Browse files Browse the repository at this point in the history
  • Loading branch information
daisieh committed Nov 22, 2024
1 parent 910bea0 commit b8faea0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions post_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,24 @@ ALL_MODULES="${MODULES}"

EXPECTED_CONTAINERS=""
for MODULE in $ALL_MODULES; do
services=$(cat lib/$MODULE/docker-compose.yml | yq -ojson '.services' | jq 'keys' | jq -r @sh | sed s/\'//g)
services=$(cat lib/$MODULE/docker-compose.yml | yq -ojson '.services' | jq 'keys' | jq -r @sh | sed s/^\'/candigv2_/g | sed s/\'$/_1/g | sed "s/\'\ \'/_1\\ candigv2_/g" | sed "s/'\\s'/_1\\ candigv2_/g")
EXPECTED_CONTAINERS=$(echo $EXPECTED_CONTAINERS $services)
sc=$(cat lib/$MODULE/docker-compose.yml | yq -ojson '.services' | jq 'keys' | jq -r @sh | wc -w | tr -d ' ')
done

EXPECTED_COUNT=$(echo $EXPECTED_CONTAINERS | wc -w)

RUNNING_CONTAINERS=$(docker ps --format "{{.Names}}" | sed s/candigv2_//g | sed s/_1//g)
RUNNING_CONTAINERS=$(docker ps --format "{{.Names}}")
RUNNING_COUNT=$(echo $RUNNING_CONTAINERS | wc -w)

# figure out any containers that should've been there but aren't
for i in $EXPECTED_CONTAINERS
do
[[ ! $RUNNING_CONTAINERS =~ $i ]] && MISSING_CONTAINERS="${MISSING_CONTAINERS:+${MISSING_CONTAINERS} }$i"
done

echo expected: $EXPECTED_CONTAINERS
echo running: $RUNNING_CONTAINERS
echo missing: $MISSING_CONTAINERS
if [[ $(echo $MISSING_CONTAINERS | wc -w | tr -d ' ') == "0" ]]
then
for MODULE in $ALL_MODULES; do
Expand Down

0 comments on commit b8faea0

Please sign in to comment.