This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 458d7d4 Fix CI: Fetch target only when source repo != target repo
(#9962)
458d7d4 is described below
commit 458d7d4cb0ffb2a525f85e5c06de2852186507c8
Author: zikun <[email protected]>
AuthorDate: Fri Jul 24 16:09:18 2020 +0800
Fix CI: Fetch target only when source repo != target repo (#9962)
---
scripts/ci/openapi/client_codegen_diff.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/scripts/ci/openapi/client_codegen_diff.sh
b/scripts/ci/openapi/client_codegen_diff.sh
index 5c37a1b..9a8511b 100755
--- a/scripts/ci/openapi/client_codegen_diff.sh
+++ b/scripts/ci/openapi/client_codegen_diff.sh
@@ -23,15 +23,17 @@ SCRIPTS_CI_DIR=$(dirname "${BASH_SOURCE[0]}")
get_environment_for_builds_on_ci
set -e
-if [ "${CI_TARGET_REPO}" != "${CI_SOURCE_BRANCH}" ]; then
+TARGET_REMOTE=origin
+if [ "${CI_TARGET_REPO}" != "${CI_SOURCE_REPO}" ]; then
+ TARGET_REMOTE=target
git remote add target "https://github.com/${CI_TARGET_REPO}"
- git fetch target "${CI_TARGET_BRANCH}:${CI_TARGET_BRANCH}" --depth=1
+ git fetch target "${CI_TARGET_BRANCH}" --depth=1
fi
-echo "Diffing openapi spec against ${CI_TARGET_BRANCH}..."
+echo "Diffing openapi spec against ${TARGET_REMOTE}/${CI_TARGET_BRANCH}..."
SPEC_FILE=airflow/api_connexion/openapi/v1.yaml
-if ! git diff --name-only "${CI_TARGET_BRANCH}" HEAD | grep
"${SPEC_FILE}\|clients/gen" ; then
+if ! git diff --name-only "${TARGET_REMOTE}/${CI_TARGET_BRANCH}" HEAD | grep
"${SPEC_FILE}\|clients/gen" ; then
echo "No openapi spec change detected, going to skip client code gen
validation."
exit 0
fi
@@ -43,7 +45,7 @@ mkdir -p ./clients/go/airflow
./clients/gen/go.sh ./airflow/api_connexion/openapi/v1.yaml
./clients/go/airflow
# generate client for target patch
mkdir -p ./clients/go_target_branch/airflow
-git reset --hard "${CI_TARGET_BRANCH}"
+git reset --hard "${TARGET_REMOTE}/${CI_TARGET_BRANCH}"
./clients/gen/go.sh ./airflow/api_connexion/openapi/v1.yaml
./clients/go_target_branch/airflow
diff ./clients/go_target_branch/airflow ./clients/go/airflow || true