ashb commented on a change in pull request #11165:
URL: https://github.com/apache/airflow/pull/11165#discussion_r495435070



##########
File path: scripts/ci/libraries/_selective_tests.sh
##########
@@ -0,0 +1,205 @@
+#!/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.
+
+SCRIPTS_PATTERNS=(
+    "^Dockerfile"
+    "^scripts"
+    "^.github/workflows/"
+    "^setup.py"
+)
+readonly SCRIPTS_PATTERNS
+
+AIRFLOW_PATTERNS=(
+    "^airflow"
+    "^tests"
+)
+readonly AIRFLOW_PATTERNS
+
+AIRFLOW_PROVIDERS_PATTERNS=(
+    "^airflow/providers"
+    "^tests/providers"
+)
+readonly AIRFLOW_PROVIDERS_PATTERNS
+
+KUBERNETES_PATTERNS=(
+    "^airflow/kubernetes"
+    "^airflow/providers/cncf"
+    "^tests/kubernetes"
+    "^tests/providers/cncf"
+    "^kubernetes_tests"
+)
+readonly KUBERNETES_PATTERNS
+
+
+function selective_tests::get_changed_files() {
+    echo
+    echo "GitHub SHA: ${COMMIT_SHA}"
+    echo
+
+    git remote add target "https://github.com/${CI_TARGET_REPO}";
+
+    git fetch target "${CI_TARGET_BRANCH}:${CI_TARGET_BRANCH}" --depth=1
+
+    echo
+    echo "Retrieve changed files from ${COMMIT_SHA} comparing to 
${CI_TARGET_BRANCH}"
+    echo
+
+    changed_files=$(git diff-tree --no-commit-id --name-only -r 
"${COMMIT_SHA}" "${CI_TARGET_BRANCH}" || true)
+
+    echo
+    echo "Changed files:"
+    echo
+    echo "${changed_files}"
+    echo
+}
+
+function selective_tests::build_regexp_string() {
+    local changed_files_regexp=""
+    local separator=""
+    for pattern in "${@}"
+    do
+        changed_files_regexp="${changed_files_regexp}${separator}${pattern}"
+        separator="|"
+    done
+    echo "${changed_files_regexp}"
+}
+
+function selective_tests::print_changed_files_matching_patterns() {
+    local regexp
+    regexp=$(selective_tests::build_regexp_string "${@}")
+    echo
+    echo "Changed files"
+    echo
+    echo "${changed_files}" | grep -E "${regexp}" || true
+}
+
+function selective_tests::count_changed_files_matching_patterns() {
+    local regexp
+    regexp=$(selective_tests::build_regexp_string "${@}")
+    count_changed_files=$(echo "${changed_files}" | grep -c -E "${regexp}" || 
true)

Review comment:
       Missing local for this var

##########
File path: scripts/ci/libraries/_selective_tests.sh
##########
@@ -0,0 +1,205 @@
+#!/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.
+
+SCRIPTS_PATTERNS=(
+    "^Dockerfile"
+    "^scripts"
+    "^.github/workflows/"
+    "^setup.py"
+)
+readonly SCRIPTS_PATTERNS
+
+AIRFLOW_PATTERNS=(
+    "^airflow"
+    "^tests"
+)
+readonly AIRFLOW_PATTERNS
+
+AIRFLOW_PROVIDERS_PATTERNS=(
+    "^airflow/providers"
+    "^tests/providers"
+)
+readonly AIRFLOW_PROVIDERS_PATTERNS
+
+KUBERNETES_PATTERNS=(
+    "^airflow/kubernetes"
+    "^airflow/providers/cncf"
+    "^tests/kubernetes"
+    "^tests/providers/cncf"
+    "^kubernetes_tests"

Review comment:
       Chart/ folder too?




----------------------------------------------------------------
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]


Reply via email to