Skip to content

Commit

Permalink
Install: Add checks to ensure installer dependencies are available
Browse files Browse the repository at this point in the history
**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.
  • Loading branch information
sbkok committed Mar 28, 2024
1 parent 7a4359f commit e74148e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
46 changes: 44 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e74148e

Please sign in to comment.