Files
docker-docs/_scripts/update-api-toc.sh
Sebastiaan van Stijn 20267e58b9 prevent fetching resources when updating _config.yml or toc.yaml
The "fetch-upstream-resources" script also updated the toc.yaml,
based on values in the _config.yml.

As a result, any change in either the "_config.yml" or "toc.yaml"
would also result in the upstream resources to be fetched again.

This patch separates the step to update the toc, so that the
upstream resources can be cached. This _does_ mean that remote
sources can get outdated (only will be rebuilt when changing
ENGINE_BRANCH or DISTRIBUTION_BRANCH). That should not be a
problem for actual deployments, which don't use caching.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 14:18:17 +01:00

19 lines
730 B
Bash
Executable File

#!/bin/sh
# Do some sanity-checking to make sure we are running this from the right place
if ! [ -f _config.yml ]; then
echo "Could not find _config.yml. We may not be in the right place. Bailing."
exit 1
fi
# Helper function to deal with sed differences between osx and Linux
# See https://stackoverflow.com/a/38595160
sedi () {
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@"
}
# Parse latest_engine_api_version variables from _config.yml to replace the value
# in toc.yaml. This is brittle!
latest_engine_api_version="$(grep 'latest_engine_api_version:' ./_config.yml | grep -oh '"[0-9].*"$' | sed 's/"//g')"
sedi "s/{{ site.latest_engine_api_version }}/${latest_engine_api_version}/g" ./_data/toc.yaml