Skip to content

Commit

Permalink
fix validate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood committed Jun 20, 2022
1 parent b1cf5dc commit 6e42260
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions images/kubectl-build-deploy-dind/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,22 @@ if kubectl -n ${NAMESPACE} get configmap docker-compose-yaml &> /dev/null; then
# create it
kubectl -n ${NAMESPACE} create configmap docker-compose-yaml --from-file=pre-deploy=${DOCKER_COMPOSE_YAML}
fi

set +ex
##############################################
### RUN docker compose config check against the provided docker-compose file
### use the `build-validate` built in validater to run over the provided docker-compose file
##############################################
dccOutput=$(bash -c 'build-validate validate docker-compose --docker-compose '${DOCKER_COMPOSE_YAML}' --ignore-non-string-key-errors=false; exit $?' 2>&1)
dccExit=$?
echo "docker-compose validate exit code ${dccExit}: ${dccOutput}"

if [ "${dccExit}" != "0" ]; then
currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")"
patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "dockerComposeValidationError" "Docker Compose Validation Error"
previousStepEnd=${currentStepEnd}
# the warning message is displayed at the end of the build
fi

set -x
set -ex

# validate .lagoon.yml
if ! lagoon-linter; then
Expand Down Expand Up @@ -1625,11 +1626,11 @@ if [ "${dccExit}" != "0" ]; then
Warning!
There are issues with your docker compose file that lagoon uses that should be fixed.
This does not currently prevent builds from proceeding, but future versions of Lagoon *will* be more strict on issues shown here.
You can run `docker compose config` locally to check that your docker-compose file is valid.
You can run docker compose config locally to check that your docker-compose file is valid.
##############################################
"
echo ${dccOutput}
echo "
##############################################"
fi
set -x
set -x

0 comments on commit 6e42260

Please sign in to comment.