Check all commits in branch for examples (to trigger testing) (#14243)
* Check for examples changes in all branch commits Review all the commits in the branch looking for changes inside content/*/examples and if any are found, trigger testing. This assumes that the main line branch is named "master" * Tidy examples testing wrapper - print diagnostics to standard error - check for a "Yes" value rather than for absence of "No"
This commit is contained in:
parent
a1cde3f626
commit
6e901b9dec
|
@ -3,21 +3,18 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# List files changed in the commit to check
|
# List files changed in the commit to check
|
||||||
FILES=`git log -n 2 --name-only --format=""`
|
FILES=($( git diff "$( git merge-base --fork-point master )" --name-only ))
|
||||||
|
|
||||||
TEST_EXAMPLES=No
|
TEST_EXAMPLES=No
|
||||||
|
|
||||||
# Currently examine en directory only, can extend to other lang when neded
|
# Check if examples folders (all locales) change in this branch
|
||||||
for f in $FILES; do
|
if printf -- '%s\n' "${FILES[@]}" | grep -qE '^"?content/[^/]+/examples/'; then
|
||||||
if [[ $f =~ "content/en/examples/" ]]; then
|
|
||||||
TEST_EXAMPLES=Yes
|
TEST_EXAMPLES=Yes
|
||||||
break
|
fi
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
function install() {
|
function install() {
|
||||||
if [[ $TEST_EXAMPLES == No ]]; then
|
if ! [[ $TEST_EXAMPLES == Yes ]]; then
|
||||||
echo "PR not touching examples, skipping example tests install"
|
echo "PR not touching examples, skipping example tests install" 1>&2
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -42,8 +39,8 @@ function install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
if [[ $TEST_EXAMPLES == No ]]; then
|
if ! [[ $TEST_EXAMPLES == Yes ]]; then
|
||||||
echo "PR not touching examples, skipping example tests execution"
|
echo "PR not touching examples, skipping example tests execution" 1>&2
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
go test -v k8s.io/website/content/en/examples
|
go test -v k8s.io/website/content/en/examples
|
||||||
|
|
Loading…
Reference in New Issue