verify checksum on upload

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
Kiara Grouwstra 2025-10-25 19:20:16 +02:00
parent e0b868e2ff
commit 72ad66edf8
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
3 changed files with 8 additions and 2 deletions

View file

@ -367,10 +367,12 @@ let
ls -l ${raw} >&2
ls -l /tmp/${name}.qcow2 >&2
checksum="$(sha256sum /tmp/${name}.qcow2 | cut -d " " -f1)"
env ${toString (lib.mapAttrsToList (k: v: "TF_VAR_${k}=\"${toBash v}\"") environment)} \
${toString (lib.mapAttrsToList (k: v: "${k}=\"${toBash v}\"") httpBackend)} \
TF_VAR_image=/tmp/${name}.qcow2 \
TF_VAR_checksum="$checksum" \
tf_env=${tf-env} bash ./deployment/run/tf-proxmox-template/run.sh
'';
};

View file

@ -53,8 +53,7 @@ resource "proxmox_virtual_environment_file" "upload" {
source_file {
path = var.image
file_name = local.dump_name
# FIXME compute and pass hash (so identical builds don't trigger drift)
# checksum = "sha256"
checksum = var.checksum
}
}

View file

@ -24,3 +24,8 @@ variable "category" {
description = "Category to be used in naming the base image."
default = "test"
}
variable "checksum" {
type = string
description = "The SHA256 checksum of the source file."
}