Add update_test_reference target and cleanup old target (#9843)

This commit is contained in:
Eric Van Norman 2021-05-25 16:04:20 -05:00 committed by GitHub
parent 8c3d5f80ef
commit 48c55859ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 53 deletions

View File

@ -140,7 +140,10 @@ netlify: netlify_install
update_ref_docs:
@scripts/grab_reference_docs.sh $(SOURCE_BRANCH_NAME)
update_all: update_ref_docs update_examples
update_test_reference:
@go get istio.io/istio@$(SOURCE_BRANCH_NAME) && go mod tidy
update_all: update_ref_docs update_test_reference
foo2:
hugo version
@ -200,4 +203,4 @@ test_status:
include common/Makefile.common.mk
.PHONY: site gen build build_nominify opt clean_public clean lint serve netlify_install netlify netlify_archive archive update_ref_docs update_operator_yamls update_examples update_all
.PHONY: site gen build build_nominify opt clean_public clean lint serve netlify_install netlify netlify_archive archive update_ref_docs update_operator_yamls update_all

View File

@ -1,51 +0,0 @@
#!/bin/bash
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script copies test snippets from documentation tests in the istio/istio repo.
# These snippets are put into the examples directory and referenced from markdown files
# throughout the site.
if [[ "$1" != "" ]]; then
SOURCE_BRANCH_NAME="$1"
else
SOURCE_BRANCH_NAME="master"
fi
SNIPPET_REPO=https://github.com/istio/istio
rm -fr examples/*.snippets.txt
echo Cloning "${SNIPPET_REPO}@${SOURCE_BRANCH_NAME}"
WORK_DIR="$(mktemp -d)"
mkdir -p "${WORK_DIR}"
git clone -q -b """${SOURCE_BRANCH_NAME}""" "${SNIPPET_REPO}" "${WORK_DIR}"
COMMITS=$(git --git-dir="${WORK_DIR}/.git" log --oneline --no-abbrev-commit | cut -d " " -f 1)
rm -fr "${WORK_DIR}"
echo "Querying for snippets"
# iterate through all the commits for the repo until we find one that has the needed artifacts
# in gcs
for COMMIT in $COMMITS; do
if gsutil -m cp "gs://istio-snippets/${COMMIT}/*.txt" examples; then
echo "Example snippets updated"
exit 0
fi
done
echo "Unable to download example snippets"
exit 1