tasks.py: add update-terraform
This commit is contained in:
parent
851255b2bb
commit
f1738b6e64
1 changed files with 19 additions and 0 deletions
19
tasks.py
19
tasks.py
|
@ -198,6 +198,25 @@ def scan_age_keys(c, host):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def update_terraform(c):
|
||||||
|
"""
|
||||||
|
Update terraform devshell flake
|
||||||
|
"""
|
||||||
|
with c.cd("terraform"):
|
||||||
|
c.run(
|
||||||
|
"""
|
||||||
|
system="$(nix eval --impure --raw --expr 'builtins.currentSystem')"
|
||||||
|
old="$(nix build --no-link --print-out-paths ".#devShells.${system}.default")"
|
||||||
|
nix flake update --commit-lock-file
|
||||||
|
new="$(nix build --no-link --print-out-paths ".#devShells.${system}.default")"
|
||||||
|
commit="$(git log --pretty=format:%B -1)"
|
||||||
|
diff="$(nix store diff-closures "${old}" "${new}" | awk -F ',' '/terraform/ && /→/ {print $1}')"
|
||||||
|
git commit --amend -m "${commit}" -m "Terraform updates:" -m "${diff}"
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def format_disks(c, hosts="", disks=""):
|
def format_disks(c, hosts="", disks=""):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue