Skip to content

Commit

Permalink
Change name of the common environment initialization function (#7805)
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Mar 28, 2020
1 parent 0720819 commit 4f3b81b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion breeze
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ function run_breeze_command {

setup_default_breeze_variables

initialize_breeze_environment
initialize_common_environment

set_mysql_encoding

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/_script_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set -euo pipefail
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export MY_DIR

initialize_breeze_environment
initialize_common_environment

basic_sanity_checks

Expand Down
15 changes: 9 additions & 6 deletions scripts/ci/_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function verbose_docker {
docker "${@}"
}

function initialize_breeze_environment {
# Common environment that is initialized by both Breeze and CI scripts
function initialize_common_environment {
# default python version
PYTHON_VERSION=${PYTHON_VERSION:="3.5"}

AIRFLOW_SOURCES=${AIRFLOW_SOURCES:=$(cd "${MY_DIR}/../../" && pwd)}
export AIRFLOW_SOURCES

Expand Down Expand Up @@ -65,11 +69,10 @@ function initialize_breeze_environment {
export WEBSERVER_HOST_PORT=${WEBSERVER_HOST_PORT:="28080"}
export POSTGRES_HOST_PORT=${POSTGRES_HOST_PORT:="25433"}
export MYSQL_HOST_PORT=${MYSQL_HOST_PORT:="23306"}
export MYSQL_VERSION=${MYSQL_VERSION:="5.6"}

# Default MySQL/Postgres versions
export POSTGRES_VERSION=${POSTGRES_VERSION:="9.6"}
export MYSQL_VERSION=${MYSQL_VERSION:="5.7"}
export MYSQL_VERSION=${MYSQL_VERSION:="5.6"}

# Do not push images from here by default (push them directly from the build script on Dockerhub)
export PUSH_IMAGES=${PUSH_IMAGES:="false"}
Expand Down Expand Up @@ -444,7 +447,7 @@ function assert_not_in_container() {
echo >&2 "You are inside the Airflow docker container!"
echo >&2 "You should only run this script from the host."
echo >&2 "Learn more about how we develop and test airflow in:"
echo >&2 "https://github.com/apache/airflow/blob/master/CONTRIBUTING.md"
echo >&2 "https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst"
echo >&2
exit 1
fi
Expand Down Expand Up @@ -941,15 +944,15 @@ function build_image_on_ci() {
if [[ ${TRAVIS_JOB_NAME:=""} == "Tests"*"Kubernetes"* ]]; then
match_files_regexp 'airflow/kubernetes/.*\.py' 'tests/runtime/kubernetes/.*\.py' \
'airflow/www/.*\.py' 'airflow/www/.*\.js' 'airflow/www/.*\.html' \
'scripts/ci/.*'
'scripts/ci/.*' 'airflow/example_dags/.*'
if [[ ${FILE_MATCHES} == "true" ]]; then
rebuild_ci_image_if_needed
else
touch "${BUILD_CACHE_DIR}"/.skip_tests
fi
elif [[ ${TRAVIS_JOB_NAME:=""} == "Tests"* ]]; then
match_files_regexp '.*\.py' 'airflow/www/.*\.py' 'airflow/www/.*\.js' \
'airflow/www/.*\.html' 'scripts/ci/.*'
'airflow/www/.*\.html' 'scripts/ci/.*' 'airflow/example_dags/.*'
if [[ ${FILE_MATCHES} == "true" ]]; then
rebuild_ci_image_if_needed
else
Expand Down
12 changes: 6 additions & 6 deletions tests/bats/test_breeze_params.bats
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EOF
@test "Test wrong value for a parameter but proper stored in the .build/PARAM" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

export _BREEZE_ALLOWED_TEST_PARAMS="a b c"
export TEST_PARAM=x
Expand All @@ -65,7 +65,7 @@ EOF
@test "Test wrong value for a parameter stored in the .build/PARAM" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

export _BREEZE_ALLOWED_TEST_PARAMS="a b c"
export TEST_PARAM=x
Expand All @@ -87,7 +87,7 @@ EOF
@test "Test correct value for a parameter" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

export _BREEZE_ALLOWED_TEST_PARAMS="a b c"
export TEST_PARAM=a
Expand All @@ -101,7 +101,7 @@ EOF
@test "Test correct value for a parameter from multi-line values" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

_BREEZE_ALLOWED_TEST_PARAMS=$(cat <<-EOF
a
Expand All @@ -122,7 +122,7 @@ EOF
@test "Test read_parameter from missing file" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

run read_from_file TEST_PARAM
[ -z "${TEST_FILE}" ]
Expand All @@ -134,7 +134,7 @@ EOF
@test "Test read_parameter from file" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

echo "a" > "${AIRFLOW_SOURCES}/.build/.TEST_PARAM"
run read_from_file TEST_PARAM
Expand Down
2 changes: 1 addition & 1 deletion tests/bats/test_empty_test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@test "empty test" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

run pwd
[ "${status}" == 0 ]
Expand Down
2 changes: 1 addition & 1 deletion tests/bats/test_local_mounts.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@test "convert volume list to docker params" {
load bats_utils

initialize_breeze_environment
initialize_common_environment

run convert_local_mounts_to_docker_params
diff <(echo "${output}") - << EOF
Expand Down

0 comments on commit 4f3b81b

Please sign in to comment.