rmetzger commented on a change in pull request #12708: URL: https://github.com/apache/flink/pull/12708#discussion_r442380985
########## File path: tools/azure-pipelines/build_properties.sh ########## @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + + +# +# Returns 0 if the change is a documentation-only pull request +# +function is_docs_only_pullrequest() { + # check if it is a pull request: + if [[ ! $BUILD_SOURCEBRANCHNAME == ci_* ]] ; then + return 1 + fi + PR_ID=`echo "$BUILD_SOURCEBRANCHNAME" | cut -f2 -d_` + if ! [[ "$PR_ID" =~ ^[0-9]+$ ]] ; then + echo "ERROR: Extracted PR_ID is not a number, but this: '$PR_ID'" + return 1 + fi + # check if it is docs only pull request: + CHANGES=`curl --silent "https://api.github.com/repos/apache/flink/pulls/$PR_ID/files" | jq -r ".[].filename"` Review comment: I agree that there's a small risk for such situations, but I believe it is unlikely enough that we can risk it (unless you know a simple solution). For the scenario you are describing, even if the timing of ci-bot is optimal, there's probably a delay of at least 2 minutes between "commit has been added" and "azure checks list of files". (Factors adding delay: ci-bot does not permanently check for new changes; pushing the branch takes some time; azure doesn't immediately kick off the build; the build doesn't immediately check the list of files). A fairly common scenario might be that the e2e build gets queued, and the "get list of files" happens hours later. But the worst that can happen here is that we are wasting 4 hours of CI time for a docs only change (because files were added later). I believe this change is a "best effort" that saves us some CI time in 99% of the cases where it makes sense. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
