This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 6c2ae7da580cb4d0dc4c868924e6d1b71d9ce9ea
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Sep 9 18:32:08 2021 +0200

    Fix constraints generation scripts. (#18094)
    
    We are now generatnung constraints with better description, and
    we include information about DEFAULT_BRANCH (main/v2-1-test etc.)
    
    The scripts to generate the constraints need to get teh variable
    passed to docker.
    
    Also names of generated files were wrong. The constraints did
    not update the right constraint files.
    
    (cherry picked from commit afd4ba666149b27a4aab7e15c8d76ed1fd4f134a)
---
 scripts/ci/docker-compose/_docker.env            | 1 +
 scripts/in_container/run_generate_constraints.sh | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/ci/docker-compose/_docker.env 
b/scripts/ci/docker-compose/_docker.env
index 6e8a5c5..a4e0178 100644
--- a/scripts/ci/docker-compose/_docker.env
+++ b/scripts/ci/docker-compose/_docker.env
@@ -26,6 +26,7 @@ CI_TARGET_REPO
 CI_TARGET_BRANCH
 COMMIT_SHA
 DB_RESET
+DEFAULT_BRANCH
 DEFAULT_CONSTRAINTS_BRANCH
 ENABLED_INTEGRATIONS
 ENABLED_SYSTEMS
diff --git a/scripts/in_container/run_generate_constraints.sh 
b/scripts/in_container/run_generate_constraints.sh
index 402ac85..dbb349c 100755
--- a/scripts/in_container/run_generate_constraints.sh
+++ b/scripts/in_container/run_generate_constraints.sh
@@ -21,14 +21,13 @@
 CONSTRAINTS_DIR="/files/constraints-${PYTHON_MAJOR_MINOR_VERSION}"
 
 
LATEST_CONSTRAINT_FILE="${CONSTRAINTS_DIR}/original-${AIRFLOW_CONSTRAINTS}-${PYTHON_MAJOR_MINOR_VERSION}.txt"
-CURRENT_CONSTRAINT_FILE="${CONSTRAINTS_DIR}/${AIRFLOW_CONSTRAINTS}-${PYTHON_MAJOR_MINOR_VERSION}.txt"
-
 mkdir -pv "${CONSTRAINTS_DIR}"
 
 
 if [[ ${GENERATE_CONSTRAINTS_MODE} == "no-providers" ]]; then
     AIRFLOW_CONSTRAINTS="constraints-no-providers"
     NO_PROVIDERS_EXTRAS=$(python -c 'import setup; 
print(",".join(setup.CORE_EXTRAS_REQUIREMENTS.keys()))')
+    
CURRENT_CONSTRAINT_FILE="${CONSTRAINTS_DIR}/${AIRFLOW_CONSTRAINTS}-${PYTHON_MAJOR_MINOR_VERSION}.txt"
     echo
     echo "UnInstall All PIP packages."
     echo
@@ -50,6 +49,7 @@ if [[ ${GENERATE_CONSTRAINTS_MODE} == "no-providers" ]]; then
 EOF
 elif [[ ${GENERATE_CONSTRAINTS_MODE} == "source-providers" ]]; then
     AIRFLOW_CONSTRAINTS="constraints-source-providers"
+    
CURRENT_CONSTRAINT_FILE="${CONSTRAINTS_DIR}/${AIRFLOW_CONSTRAINTS}-${PYTHON_MAJOR_MINOR_VERSION}.txt"
     echo
     echo "Providers are already installed from sources."
     echo
@@ -67,11 +67,11 @@ elif [[ ${GENERATE_CONSTRAINTS_MODE} == "source-providers" 
]]; then
 EOF
 elif [[ ${GENERATE_CONSTRAINTS_MODE} == "pypi-providers" ]]; then
     AIRFLOW_CONSTRAINTS="constraints"
+    
CURRENT_CONSTRAINT_FILE="${CONSTRAINTS_DIR}/${AIRFLOW_CONSTRAINTS}-${PYTHON_MAJOR_MINOR_VERSION}.txt"
     echo
     echo "Install all providers from PyPI so that they are included in the 
constraints."
     echo
     install_all_providers_from_pypi_with_eager_upgrade
-else
     cat <<EOF >"${CURRENT_CONSTRAINT_FILE}"
 #
 # This constraints file was automatically generated on $(date -u 
+'%Y-%m-%dT%H:%M:%SZ')
@@ -84,6 +84,7 @@ else
 # "constraints-X.Y.Z" tag to build the production image for that version.
 #
 EOF
+else
     echo
     echo "${COLOR_RED}Error! GENERATE_CONSTRAINTS_MODE has wrong value: 
'${GENERATE_CONSTRAINTS_MODE}' ${COLOR_RESET}"
     echo

Reply via email to