You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/09/15 08:22:48 UTC
[airflow] 01/02: Github repository can be overridden in command
line by Breeze
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit a3535f3a87f0d2d2765c87c08a19e033c9c94fcf
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Sep 14 23:31:10 2020 +0200
Github repository can be overridden in command line by Breeze
During testing v1-10-test backport for Breeze the
--github-repository flag did not work. It turned out that
the lowercase variable was not re-set when the flag was
provided by Breeze.
This change causes the lowercasing to be run just before it
is used to make sure that the GITHUB_REPOSITORY value
is used after it's been overwritten.
(cherry picked from commit 1155e7fdc0613ed9e26955a15e1e9fba6056c720)
---
scripts/ci/libraries/_build_images.sh | 12 +++++++-----
scripts/ci/libraries/_initialization.sh | 6 ------
scripts/ci/libraries/_push_pull_remove_images.sh | 3 ++-
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/scripts/ci/libraries/_build_images.sh b/scripts/ci/libraries/_build_images.sh
index 2de09b9..38b3571 100644
--- a/scripts/ci/libraries/_build_images.sh
+++ b/scripts/ci/libraries/_build_images.sh
@@ -357,8 +357,9 @@ function build_images::prepare_ci_build() {
"${GITHUB_REGISTRY}"
fi
# Github Registry names must be lowercase :(
- export GITHUB_REGISTRY_AIRFLOW_CI_IMAGE="${GITHUB_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/${AIRFLOW_CI_BASE_TAG}"
- export GITHUB_REGISTRY_PYTHON_BASE_IMAGE="${GITHUB_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/python:${PYTHON_BASE_IMAGE_VERSION}-slim-buster"
+ github_repository_lowercase="$(echo "${GITHUB_REPOSITORY}" |tr '[:upper:]' '[:lower:]')"
+ export GITHUB_REGISTRY_AIRFLOW_CI_IMAGE="${GITHUB_REGISTRY}/${github_repository_lowercase}/${AIRFLOW_CI_BASE_TAG}"
+ export GITHUB_REGISTRY_PYTHON_BASE_IMAGE="${GITHUB_REGISTRY}/${github_repository_lowercase}/python:${PYTHON_BASE_IMAGE_VERSION}-slim-buster"
fi
if [[ "${DEFAULT_PYTHON_MAJOR_MINOR_VERSION}" == "${PYTHON_MAJOR_MINOR_VERSION}" ]]; then
export DEFAULT_PROD_IMAGE="${AIRFLOW_CI_IMAGE_DEFAULT}"
@@ -625,9 +626,10 @@ function build_images::prepare_prod_build() {
"${GITHUB_REGISTRY}"
fi
# Github Registry names must be lowercase :(
- export GITHUB_REGISTRY_AIRFLOW_PROD_IMAGE="${GITHUB_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/${AIRFLOW_PROD_BASE_TAG}"
- export GITHUB_REGISTRY_AIRFLOW_PROD_BUILD_IMAGE="${GITHUB_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/${AIRFLOW_PROD_BASE_TAG}-build"
- export GITHUB_REGISTRY_PYTHON_BASE_IMAGE="${GITHUB_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/python:${PYTHON_BASE_IMAGE_VERSION}-slim-buster"
+ github_repository_lowercase="$(echo "${GITHUB_REPOSITORY}" |tr '[:upper:]' '[:lower:]')"
+ export GITHUB_REGISTRY_AIRFLOW_PROD_IMAGE="${GITHUB_REGISTRY}/${github_repository_lowercase}/${AIRFLOW_PROD_BASE_TAG}"
+ export GITHUB_REGISTRY_AIRFLOW_PROD_BUILD_IMAGE="${GITHUB_REGISTRY}/${github_repository_lowercase}/${AIRFLOW_PROD_BASE_TAG}-build"
+ export GITHUB_REGISTRY_PYTHON_BASE_IMAGE="${GITHUB_REGISTRY}/${github_repository_lowercase}/python:${PYTHON_BASE_IMAGE_VERSION}-slim-buster"
fi
AIRFLOW_BRANCH_FOR_PYPI_PRELOADING="${BRANCH_NAME}"
diff --git a/scripts/ci/libraries/_initialization.sh b/scripts/ci/libraries/_initialization.sh
index a771844..08f242e 100644
--- a/scripts/ci/libraries/_initialization.sh
+++ b/scripts/ci/libraries/_initialization.sh
@@ -346,8 +346,6 @@ function initialization::initialize_git_variables() {
function initialization::initialize_github_variables() {
# Defaults for interacting with GitHub
export GITHUB_REPOSITORY=${GITHUB_REPOSITORY:="apache/airflow"}
- GITHUB_REPOSITORY_LOWERCASE="$(echo "${GITHUB_REPOSITORY}" |tr '[:upper:]' '[:lower:]')"
- export GITHUB_REPOSITORY_LOWERCASE
export GITHUB_REGISTRY=${GITHUB_REGISTRY:="docker.pkg.github.com"}
export USE_GITHUB_REGISTRY=${USE_GITHUB_REGISTRY:="false"}
export GITHUB_REGISTRY_WAIT_FOR_IMAGE=${GITHUB_REGISTRY_WAIT_FOR_IMAGE:="false"}
@@ -355,8 +353,6 @@ function initialization::initialize_github_variables() {
export GITHUB_REGISTRY_PUSH_IMAGE_TAG=${GITHUB_REGISTRY_PUSH_IMAGE_TAG:="latest"}
export GITHUB_REPOSITORY=${GITHUB_REPOSITORY:="apache/airflow"}
- GITHUB_REPOSITORY_LOWERCASE="$(echo "${GITHUB_REPOSITORY}" |tr '[:upper:]' '[:lower:]')"
- export GITHUB_REPOSITORY_LOWERCASE
# Used only in CI environment
export GITHUB_TOKEN="${GITHUB_TOKEN=""}"
@@ -459,7 +455,6 @@ Detected GitHub environment:
USE_GITHUB_REGISTRY=${USE_GITHUB_REGISTRY}
GITHUB_REGISTRY=${GITHUB_REGISTRY}
GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
- GITHUB_REPOSITORY_LOWERCASE=${GITHUB_REPOSITORY_LOWERCASE}
GITHUB_USERNAME=${GITHUB_USERNAME}
GITHUB_TOKEN=${GITHUB_TOKEN}
GITHUB_REGISTRY_WAIT_FOR_IMAGE=${GITHUB_REGISTRY_WAIT_FOR_IMAGE}
@@ -607,7 +602,6 @@ function initialization::make_constants_read_only() {
readonly GITHUB_REGISTRY_PUSH_IMAGE_TAG
readonly GITHUB_REPOSITORY
- readonly GITHUB_REPOSITORY_LOWERCASE
readonly GITHUB_TOKEN
readonly GITHUB_USERNAME
diff --git a/scripts/ci/libraries/_push_pull_remove_images.sh b/scripts/ci/libraries/_push_pull_remove_images.sh
index dbbb35d..a3e5800 100644
--- a/scripts/ci/libraries/_push_pull_remove_images.sh
+++ b/scripts/ci/libraries/_push_pull_remove_images.sh
@@ -214,7 +214,8 @@ function push_pull_remove_images::push_prod_images() {
# waits for an image to be available in the github registry
function push_pull_remove_images::wait_for_github_registry_image() {
- GITHUB_API_ENDPOINT="https://${GITHUB_REGISTRY}/v2/${GITHUB_REPOSITORY_LOWERCASE}"
+ github_repository_lowercase="$(echo "${GITHUB_REPOSITORY}" |tr '[:upper:]' '[:lower:]')"
+ GITHUB_API_ENDPOINT="https://${GITHUB_REGISTRY}/v2/${github_repository_lowercase}"
IMAGE_NAME="${1}"
IMAGE_TAG=${2}
echo "Waiting for ${IMAGE_NAME}:${IMAGE_TAG} image"