Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ repos:
# The below pre-commits are those requiring CI image to be built
- id: build
name: Check if image build is needed
entry: ./scripts/ci/pre_commit/pre_commit_ci_build.sh 3.7 false
entry: ./scripts/ci/pre_commit/pre_commit_ci_build.sh 3.7
language: system
always_run: true
pass_filenames: false
Expand Down
2 changes: 0 additions & 2 deletions breeze
Original file line number Diff line number Diff line change
Expand Up @@ -3605,8 +3605,6 @@ breeze::parse_arguments "${@}"

breeze::print_header_line

build_images::forget_last_answer

breeze::check_and_save_all_params

build_images::determine_docker_cache_strategy
Expand Down
1 change: 0 additions & 1 deletion dev/breeze/src/airflow_breeze/global_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
FORCE_PULL_IMAGES = False
CHECK_IF_BASE_PYTHON_IMAGE_UPDATED = False
FORCE_BUILD_IMAGES = False
# LAST_FORCE_ANSWER_FILE = f"{BUILD_CACHE_DIR}/last_force_answer.sh"
FORCE_ANSWER_TO_QUESTION = ""
SKIP_CHECK_REMOTE_IMAGE = False
PUSH_PYTHON_BASE_IMAGE = False
Expand Down
37 changes: 0 additions & 37 deletions scripts/ci/libraries/_build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,36 +87,6 @@ function build_images::get_airflow_version_from_production_image() {
docker run --entrypoint /bin/bash "${AIRFLOW_PROD_IMAGE}" -c 'echo "${AIRFLOW_VERSION}"'
}

# Removes the "Forced answer" (yes/no/quit) given previously, unless you specifically want to remember it.
#
# This is the default behaviour of all rebuild scripts to ask independently whether you want to
# rebuild the image or not. Sometimes however we want to remember answer previously given. For
# example if you answered "no" to rebuild the image, the assumption is that you do not
# want to rebuild image also for other rebuilds in the same pre-commit execution.
#
# All the pre-commit checks therefore have `export REMEMBER_LAST_ANSWER="true"` set
# So that in case they are run in a sequence of commits they will not rebuild. Similarly if your most
# recent answer was "no" and you run `pre-commit run mypy` (for example) it will also reuse the
# "no" answer given previously. This happens until you run any of the breeze commands or run all
# pre-commits `pre-commit run` - then the "LAST_FORCE_ANSWER_FILE" will be removed and you will
# be asked again.
function build_images::forget_last_answer() {
if [[ ${REMEMBER_LAST_ANSWER:="false"} != "true" ]]; then
verbosity::print_info
verbosity::print_info "Forgetting last answer from ${LAST_FORCE_ANSWER_FILE}:"
verbosity::print_info
rm -f "${LAST_FORCE_ANSWER_FILE}"
else
if [[ -f "${LAST_FORCE_ANSWER_FILE}" ]]; then
verbosity::print_info
verbosity::print_info "Still remember last answer from ${LAST_FORCE_ANSWER_FILE}:"
verbosity::print_info "$(cat "${LAST_FORCE_ANSWER_FILE}")"
verbosity::print_info
fi
fi
}


function build_images::reconfirm_rebuilding_if_not_rebased() {
local latest_main_commit_sha
latest_main_commit_sha=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" \
Expand Down Expand Up @@ -178,12 +148,6 @@ function build_images::confirm_rebuilding_on_modified_files() {
# So that the script works also from within pre-commit run via git hooks - where stdin is not
# available - it tries to find usable terminal and ask the user via this terminal.
function build_images::confirm_image_rebuild() {
if [[ -f "${LAST_FORCE_ANSWER_FILE}" ]]; then
# set variable from last answered response given in the same pre-commit run - so that it can be
# answered in the first pre-commit check (build) and then used in another (mypy/flake8 etc).
# shellcheck disable=SC1090
source "${LAST_FORCE_ANSWER_FILE}"
fi
set +e
local RES
if [[ ${CI:="false"} == "true" ]]; then
Expand Down Expand Up @@ -235,7 +199,6 @@ function build_images::confirm_image_rebuild() {
# Force "no" also to subsequent questions so that if you answer it once, you are not asked
# For all other pre-commits and you will continue using the images you already have
export FORCE_ANSWER_TO_QUESTIONS="no"
echo 'export FORCE_ANSWER_TO_QUESTIONS="no"' >"${LAST_FORCE_ANSWER_FILE}"
elif [[ ${RES} == "2" ]]; then
echo
echo "${COLOR_RED}ERROR: The ${THE_IMAGE_TYPE} needs to be rebuilt - it is outdated. ${COLOR_RESET}"
Expand Down
5 changes: 0 additions & 5 deletions scripts/ci/libraries/_initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,6 @@ function initialization::initialize_force_variables() {
# Can be overridden by '--force-build-images' flag.
export FORCE_BUILD_IMAGES=${FORCE_BUILD_IMAGES:="false"}

# File to keep the last forced answer. This is useful for pre-commits where you need to
# only answer once if the image should be rebuilt or not and your answer is used for
# All the subsequent questions
export LAST_FORCE_ANSWER_FILE="${BUILD_CACHE_DIR}/last_force_answer.sh"

# Can be set to "yes/no/quit" in order to force specified answer to all questions asked to the user.
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:=""}

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_bat_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"
export SKIP_CHECK_REMOTE_IMAGE="true"

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# under the License.
set -euo pipefail
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"
export SKIP_CHECK_REMOTE_IMAGE="true"

Expand Down
3 changes: 0 additions & 3 deletions scripts/ci/pre_commit/pre_commit_ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.
export PYTHON_MAJOR_MINOR_VERSION="${1}"
export REMEMBER_LAST_ANSWER="${2}"
export PRINT_INFO_FROM_SCRIPTS="false"

# shellcheck source=scripts/ci/libraries/_script_init.sh
Expand Down Expand Up @@ -50,8 +49,6 @@ function build_images::rebuild_ci_image_if_confirmed_for_pre_commit() {
fi
}

build_images::forget_last_answer

build_images::prepare_ci_build

build_images::rebuild_ci_image_if_confirmed_for_pre_commit
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_flake8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# under the License.
export PYTHON_MAJOR_MINOR_VERSION="3.7"
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"

# shellcheck source=scripts/ci/static_checks/flake8.sh
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_helm_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"
export SKIP_CHECK_REMOTE_IMAGE="true"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"
export SKIP_CHECK_REMOTE_IMAGE="true"

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_lint_dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"
export SKIP_CHECK_REMOTE_IMAGE="true"

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/pre_commit/pre_commit_mypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# under the License.
export PYTHON_MAJOR_MINOR_VERSION="3.7"
export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
export REMEMBER_LAST_ANSWER="true"
export PRINT_INFO_FROM_SCRIPTS="false"

# shellcheck source=scripts/ci/static_checks/mypy.sh
Expand Down