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 2022/01/22 15:49:40 UTC
[airflow] 27/33: Fix new buildkit builds on MacOS (#20963)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ae477d0f417fea62985486a9b6d03d21ccf5b474
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Wed Jan 19 19:10:54 2022 +0100
Fix new buildkit builds on MacOS (#20963)
MacOS requires array variables to be declared on top level
(Bash3).
This PR changes BUILD_COMMAND variable to be declared at top level.
(cherry picked from commit 9a1eeeb5c085c9aa8aab0d1f7a814c9e0fc0ecef)
---
scripts/ci/libraries/_build_images.sh | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/scripts/ci/libraries/_build_images.sh b/scripts/ci/libraries/_build_images.sh
index 9229c3f..2d84a92 100644
--- a/scripts/ci/libraries/_build_images.sh
+++ b/scripts/ci/libraries/_build_images.sh
@@ -16,6 +16,10 @@
# specific language governing permissions and limitations
# under the License.
+# Needs to be declared outside of function for MacOS
+
+BUILD_COMMAND=()
+
# For remote installation of airflow (from GitHub or PyPI) when building the image, you need to
# pass build flags depending on the version and method of the installation (for example to
# get proper requirement constraint files)
@@ -319,26 +323,24 @@ function build_images::get_docker_cache_image_names() {
}
function build_images::check_if_buildx_plugin_available() {
- export BUILD_COMMAND=("build")
local buildx_version
buildx_version=$(docker buildx version 2>/dev/null || true)
if [[ ${buildx_version} != "" ]]; then
- BUILDX_PLUGIN_AVAILABLE="true"
- export BUILD_COMMAND=("buildx" "build" "--builder" "default" "--progress=tty")
- else
- BUILDX_PLUGIN_AVAILABLE="false"
- fi
- if [[ ${PREPARE_BUILDX_CACHE} == "true" ]]; then
- if [[ ${BUILDX_PLUGIN_AVAILABLE} == "true" ]]; then
- export BUILD_COMMAND=("buildx" "build" "--builder" "airflow_cache" "--progress=tty")
+ if [[ ${PREPARE_BUILDX_CACHE} == "true" ]]; then
+ BUILD_COMMAND+=("buildx" "build" "--builder" "airflow_cache" "--progress=tty")
docker_v buildx inspect airflow_cache || docker_v buildx create --name airflow_cache
else
+ BUILD_COMMAND+=("buildx" "build" "--builder" "default" "--progress=tty")
+ fi
+ else
+ if [[ ${PREPARE_BUILDX_CACHE} == "true" ]]; then
echo
echo "${COLOR_RED}Buildx cli plugin is not available and you need it to prepare buildx cache.${COLOR_RESET}"
echo "${COLOR_RED}Please install it following https://docs.docker.com/buildx/working-with-buildx/${COLOR_RESET}"
echo
exit 1
fi
+ BUILD_COMMAND+=("build")
fi
}