rewrite just update command to provide a one-line command to update everything (#3410)

* rewrite `just update` command to provide a one-line command to update everything

* update prefix

* uncomment update-self

* Revert requirements.yml updates not belonging to this PR

* Justfile and documentation updates to make things clearer

---------

Co-authored-by: Slavi Pantaleev <slavi@devture.com>
This commit is contained in:
Aine
2024-07-15 04:57:08 +00:00
committed by GitHub
parent f81c00c948
commit b347d98161
5 changed files with 31 additions and 11 deletions

View File

@ -5,6 +5,7 @@ default:
# Pulls external Ansible roles
roles:
#!/usr/bin/env sh
echo "[NOTE] This command just updates the roles, but if you want to update everything at once (playbook, roles, etc.) - use 'just update'"
if [ -x "$(command -v agru)" ]; then
agru
else
@ -12,9 +13,25 @@ roles:
ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
fi
# Updates requirements.yml if there are any new tags available. Requires agru
update:
@agru -u
# Updates the playbook and installs the necessary Ansible roles pinned in requirements.yml. If a -u flag is passed, also updates the requirements.yml file with new role versions (if available)
update *flags: update-playbook-only
#!/usr/bin/env sh
if [ -x "$(command -v agru)" ]; then
echo {{ if flags == "" { "Installing roles pinned in requirements.yml..." } else if flags == "-u" { "Updating roles and pinning new versions in requirements.yml..." } else { "Unknown flags passed" } }}
agru {{ flags }}
else
echo "[NOTE] You are using the standard ansible-galaxy tool to install roles, which is slow and lacks other features. We recommend installing the 'agru' tool to speed up the process: https://gitlab.com/etke.cc/tools/agru#where-to-get"
echo "Installing roles..."
rm -rf roles/galaxy
ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
fi
# Updates the playbook without installing/updating Ansible roles
update-playbook-only:
@echo "Updating playbook..."
@git stash -q
@git pull -q
@-git stash pop -q
# Runs ansible-lint against all roles in the playbook
lint: