From e74148eda069ae7ccfe2822396d5364af0d64a33 Mon Sep 17 00:00:00 2001 From: Simon Kok Date: Thu, 28 Mar 2024 20:17:14 +0100 Subject: [PATCH] Install: Add checks to ensure installer dependencies are available **Why?** When running the make / install process of ADF, we need to ensure it will not continue if some of the tools are not installed yet. For example, in the past, if you did not install jq, it would still continue with the build process. Resulting in a broken template at deployment time. As reported in #696, the Python version in the environment was set to v3.8, which resulted in a broken installation process too. **What?** * Updated the documentation to indicate that `jq` needs to be available too. * Added checks in the build process to exit and warn the user about missing dependencies. * Updated the version number of the Makefile. --- Makefile | 46 ++++++++++++++++++++++++++++++++++++-- docs/installation-guide.md | 3 +++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a734d6b5b..64b296e30 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # Makefile versions -MAKEFILE_VERSION := 2.0 +MAKEFILE_VERSION := 2.1 UPDATE_VERSION := make/latest # Repository versions @@ -175,6 +175,48 @@ docs: @echo "* $(CLR_BLUE)$(SRC_TAGGED_URL_BASE)/docs/user-guide.md$(CLR_END)" @echo "" +verify_tooling: .venv + @( \ + . .venv/bin/activate; \ + python3 --version &> /dev/null && \ + ( \ + python3 -c "import sys; sys.version_info < (3,11) and sys.exit(1)" || \ + ( \ + python3 --version && \ + echo '$(CLR_RED)Python version is too old!$(CLR_END)' && \ + echo '$(CLR_RED)Python v3.11 or later is required.$(CLR_END)' && \ + exit 1 \ + ) \ + ) || ( \ + echo '$(CLR_RED)Python is not installed!$(CLR_END)' && \ + exit 1 \ + ); \ + ) + @( \ + docker --version &> /dev/null || ( \ + echo '$(CLR_RED)Docker is not installed!$(CLR_END)' && \ + exit 1 \ + ); \ + ) + @( \ + git --version &> /dev/null || ( \ + echo '$(CLR_RED)Git is not installed!$(CLR_END)' && \ + exit 1 \ + ); \ + ) + @( \ + sed --version &> /dev/null || ( \ + echo '$(CLR_RED)Sed is not installed!$(CLR_END)' && \ + exit 1 \ + ); \ + ) + @( \ + jq --version &> /dev/null || ( \ + echo '$(CLR_RED)Jq is not installed!$(CLR_END)' && \ + exit 1 \ + ); \ + ) + pre_build: build_deps docker version_number git_ignore pre_deps_build: deps docker version_number git_ignore @@ -194,7 +236,7 @@ post_build: @echo "$(CLR_GREEN)To deploy ADF, please run:$(CLR_END) make deploy" @echo "" -build: pre_build sam_build post_build +build: verify_tooling pre_build sam_build post_build deps_build: pre_deps_build sam_build post_build diff --git a/docs/installation-guide.md b/docs/installation-guide.md index 9669bd06c..03ee39f49 100644 --- a/docs/installation-guide.md +++ b/docs/installation-guide.md @@ -74,6 +74,9 @@ Please note that building on *Windows* is not supported, please use the - [python 3](https://www.python.org/downloads/) - To test if it is available, run `python --version`. This should return 3.11 or later. +- [jq](https://github.com/jqlang/jq) + - To test if it is available, run `jq --version`. + This version should be 1.6 or later. - [sed](https://www.gnu.org/software/sed/) - To test if it is available, run `sed --version`. This should return 4.3 or later.