build: replace scripts with more concise makefile

This commit is contained in:
Marc 2024-10-13 16:31:30 -04:00
parent 0ed0d8542c
commit e8a98665b6
Signed by: marc
GPG key ID: 048E042F22B5DC79
5 changed files with 41 additions and 13 deletions

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM debian:bookworm
COPY . .
RUN apt update && apt install pipx -y
ENV PATH="$PATH:/root/.local/bin"
CMD ./run.sh ./home.yml

View file

@ -2,4 +2,8 @@
Environment tweaks for (my) everyday happiness. Environment tweaks for (my) everyday happiness.
Do the thing, it will do the needful: `./run.sh <playbook-path>` Do the thing, it will do the needful: `make configure-env PLAY=<playbook-path>`.
## Development
Repository prerequisites can be installed and validated via `make bootstrap` and containerized playbook tests can be run via `make test`.

View file

@ -1,3 +0,0 @@
#!/bin/bash
pipx run pre-commit install

27
makefile Normal file
View file

@ -0,0 +1,27 @@
HELPTEXT="\
help: \n\
\tshows this helpful text.\n\
bootstrap: \n\
\tensures that repository-specific prerequisites are installed. \n\
test:\n\
\truns the playbook in a containerized environment for validation \n\
configure-env:\n\
\truns the playbook specified by PLAY on the host.\n\
"
.PHONY: help
help:
@echo $(HELPTEXT)
.PHONY: bootstrap
bootstrap:
pipx run pre-commit install
.PHONY: test
test:
podman build . -t env-ansible-test
podman run env-ansible-test
.PHONY: configure-env
configure-env:
pipx install "ansible-core"
ansible-playbook -v --ask-become-pass $(PLAY)

9
run.sh
View file

@ -1,9 +0,0 @@
#!/bin/bash
if [[ -z "$(command -v pipx)" ]]; then
echo -e "\033[31;1mThis expects pipx to be installed.\033[0m"
exit 1
fi
pipx install "ansible-core"
ansible-playbook -v --ask-become-pass "$1"