Skip to content

Commit

Permalink
Fix constraints generation scripts. (#18094)
Browse files Browse the repository at this point in the history
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 afd4ba6)
  • Loading branch information
potiuk committed Sep 9, 2021
1 parent 92899ca commit 6c2ae7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/_docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CI_TARGET_REPO
CI_TARGET_BRANCH
COMMIT_SHA
DB_RESET
DEFAULT_BRANCH
DEFAULT_CONSTRAINTS_BRANCH
ENABLED_INTEGRATIONS
ENABLED_SYSTEMS
Expand Down
7 changes: 4 additions & 3 deletions scripts/in_container/run_generate_constraints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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')
Expand All @@ -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
Expand Down

0 comments on commit 6c2ae7d

Please sign in to comment.