Allow to override istio/api Git URL (#10366)

This allows to override the default istio/api Git repo URL
(https://github.com/istio/api.git) with something else, for example, a
local directory, hence we can check how the documentation generated from
*.proto is rendered and layouted.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
This commit is contained in:
Dhi Aurrahman 2021-09-24 21:36:03 +07:00 committed by GitHub
parent 1901cf2980
commit 65c240814e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -142,8 +142,21 @@ netlify: netlify_install
@scripts/build_site.sh "/latest"
@scripts/include_archive_site.sh
# ISTIO_API_GIT_SOURCE allows to override the default Istio API repository, https://github.com/istio/api@$(SOURCE_BRANCH_NAME)
# with, for example, a mapped local directory: file:///work/istio/api@branch-name when running `update_ref_docs`.
#
# The format for ISTIO_API_GIT_SOURCE value is {GIT_URL}@{TARGET_BRANCH_NAME}.
#
# Note that when running with BUILD_WITH_CONTAINER=1, we can map the local directory by setting
# the ADDITIONAL_CONTAINER_OPTIONS environment variable as shown in the below example:
#
# $ BUILD_WITH_CONTAINER=1 \
# ISTIO_API_GIT_SOURCE="file:///work/istio/api@branchname" \
# ADDITIONAL_CONTAINER_OPTIONS="-v /path/to/local/istio/api:/work/istio/api" \
# make update_ref_docs
export ISTIO_API_GIT_SOURCE ?=
update_ref_docs:
@scripts/grab_reference_docs.sh $(SOURCE_BRANCH_NAME)
@scripts/grab_reference_docs.sh $(SOURCE_BRANCH_NAME) $(ISTIO_API_GIT_SOURCE)
update_test_reference:
@go get istio.io/istio@$(SOURCE_BRANCH_NAME) && go mod tidy

View File

@ -29,6 +29,10 @@ else
SOURCE_BRANCH_NAME="master"
fi
if [[ "$2" != "" ]]; then
ISTIO_API_GIT_SOURCE="$2"
fi
# The repos to mine for docs, just add new entries here to pull in more repos.
REPOS=(
https://github.com/istio/istio.git@"${SOURCE_BRANCH_NAME}"
@ -99,6 +103,10 @@ handle_feature_status_scraping() {
handle_doc_scraping() {
for repo in "${REPOS[@]}"; do
if [[ "$repo" == https://github.com/istio/api.git* ]]; then
repo="${ISTIO_API_GIT_SOURCE:-$repo}"
fi
REPO_URL=$(echo "$repo" | cut -d @ -f 1)
REPO_BRANCH=$(echo "$repo" | cut -d @ -f 2)
DEST_DIR=${REPO_URL//\//_}