Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip tests if all changes in docs #6870

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .ibm/pipelines/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,29 @@ cleanup_namespaces() {
fi
done
}

skip_if_only() {
echo "Checking if tests need to be executed..."
NAMES=$(git diff --name-only main)
rm3l marked this conversation as resolved.
Show resolved Hide resolved
for change in ${NAMES}; do
skip $change
if [[ $? == 0 ]]; then
return
fi
done
echo " => Skipping the tests."
exit 0
}

skip() {
SKIP_IF_ONLY="docs/ CONTRIBUTING.md OWNERS README.md USAGE_DATA.md"
change=$1
for skip in ${SKIP_IF_ONLY}; do
if [[ "${change}" == "${skip}"* ]]; then
echo " - ${change} is ${skip}*"
return 1
fi
done
echo " - $change not in $SKIP_IF_ONLY"
return 0
}
2 changes: 2 additions & 0 deletions .ibm/pipelines/kubernetes-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-kubernetes-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r "${IBM_REGION}"
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/nocluster-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-nocluster-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r "${IBM_REGION}"

Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/openshift-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r eu-de
ibmcloud oc cluster config -c "${CLUSTER_ID}"
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/openshift-unauth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-unauth-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r eu-de
ibmcloud oc cluster config -c "${CLUSTER_ID}"
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-unit-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

(
set -e
make test
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-Validate-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

(
set -e
make goget-tools
Expand Down
5 changes: 4 additions & 1 deletion .ibm/pipelines/windows-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

set -x

source .ibm/pipelines/functions.sh

skip_if_only

LOGFILE="pr-${GIT_PR_NUMBER}-windows-tests-${BUILD_NUMBER}"
export REPO=${REPO:-"https://github.com/redhat-developer/odo"}
#copy test script inside /tmp/
Expand All @@ -19,7 +23,6 @@ RESULT=$?
echo "RESULT: $RESULT"

# save log
source .ibm/pipelines/functions.sh
ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}"
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/${LOGFILE} /tmp/${LOGFILE}
save_logs "${LOGFILE}" "Windows Tests (OCP)" $RESULT
Expand Down