|
13 | 13 | # See the License for the specific language governing permissions and
|
14 | 14 | # limitations under the License.
|
15 | 15 |
|
| 16 | +# Only run Python 2.7 if the PR in question has a `kokoro-lite` label |
| 17 | +if [[ ! -z "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ]]; then |
| 18 | + set +e |
| 19 | + curl -s "https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER" \ |
| 20 | + | grep "kokoro:lite" > /dev/null |
| 21 | + if [[ $? -eq 0 ]] && [[ "${RUN_TESTS_SESSION}" != "py-2.7" ]]; then |
| 22 | + # Skip this build |
| 23 | + echo "This build is being skipped!" |
| 24 | + echo " GitHub PRs with the 'kokoro:lite'" |
| 25 | + echo " label are ONLY tested in Python 2.7" |
| 26 | + |
| 27 | + exit 1 |
| 28 | + fi |
| 29 | + set -e |
| 30 | +fi |
| 31 | + |
16 | 32 | # `-e` enables the script to automatically fail when a command fails
|
17 | 33 | # `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
|
18 | 34 | set -eo pipefail
|
@@ -51,20 +67,6 @@ if [[ $* == *--only-diff-head* ]]; then
|
51 | 67 | fi
|
52 | 68 | fi
|
53 | 69 |
|
54 |
| -# Only run Python 2.7 if the PR in question has a `kokoro-lite` label |
55 |
| -if [[ ! -z $KOKORO_GITHUB_PULL_REQUEST_NUMBER ]]; then |
56 |
| - curl -s "https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER" \ |
57 |
| - | grep "kokoro:lite" > /dev/null |
58 |
| - if [[ $? -eq 0 ]] && [[ "${RUN_TESTS_SESSION}" != "py-2.7" ]]; then |
59 |
| - # Skip this build |
60 |
| - echo "This build is being skipped!" |
61 |
| - echo " GitHub PRs with the 'kokoro:lite'" |
62 |
| - echo " label are ONLY tested in Python 2.7" |
63 |
| - |
64 |
| - exit 1 |
65 |
| - fi |
66 |
| -fi |
67 |
| - |
68 | 70 | # Because Kokoro runs presubmit builds simalteneously, we often see
|
69 | 71 | # quota related errors. I think we can avoid this by changing the
|
70 | 72 | # order of tests to execute (e.g. reverse order for py-3.8
|
|
0 commit comments