Skip to content

Commit

Permalink
Nightly to use default OpenAPI document if cannot be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Ngai committed Sep 27, 2023
1 parent 5c1f9d1 commit 086b7da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deploy/nightly/deploy-nightly-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ echo "Generating nightly build for $TIMESTAMP"
mkdir $NIGHTLYDIR && cd $NIGHTLYDIR

echo "Cloning Git repository"
git clone $MSC_PYGEOAPI_GITREPO . -b master --depth=1
git clone $MSC_PYGEOAPI_GITREPO . -b docker-oapi-doc-default --depth=1

echo "Stopping/building/starting Docker setup"
docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml build --no-cache
Expand Down
8 changes: 7 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ entry_cmd=${1:-run}
# Shorthand (bash)
function error() {
echo "ERROR: $@"
exit -1
}

echo "Trying to generate OpenAPI document with PYGEOAPI_CONFIG=${PYGEOAPI_CONFIG} and PYGEOAPI_OPENAPI=${PYGEOAPI_OPENAPI}..."
pygeoapi openapi generate ${PYGEOAPI_CONFIG} --output-file ${PYGEOAPI_OPENAPI}
# pygeoapi openapi validate ${PYGEOAPI_OPENAPI}

if [ $? -ne 0 ]; then
error "OpenAPI document could not be generated ERROR"
echo "Using default OpenAPI document"
DEFAULT_PYGEOAPI_OPENAPI=`echo $PYGEOAPI_CONFIG | sed 's/deploy\/nightly/deploy/\default/'`
cp $DEFAULT_PYGEOAPI_OPENAPI $PYGEOAPI_OPENAPI
fi

[[ $? -ne 0 ]] && error "OpenAPI document could not be generated ERROR"

echo "OpenAPI document generated. continue to pygeoapi..."
Expand Down

0 comments on commit 086b7da

Please sign in to comment.