Move validate step into Nix script

This commit is contained in:
Greg Hellings
2024-06-24 23:13:53 -05:00
parent f138e5af3e
commit 2d124c652a
2 changed files with 20 additions and 6 deletions
+3 -6
View File
@@ -34,6 +34,8 @@ distros:
validate:
stage: lint
tags:
- nix
needs:
- generate
cache:
@@ -42,12 +44,7 @@ validate:
- sources/build.pkr.hcl
paths:
- ./packer_config/
script: |-
set -exo pipefail
packer init sources
for vars in $(find distros/ -name '*.pkrvars.hcl'); do
packer validate -except=upload -var-file=${vars} sources/
done
script: nix run ".#validate"
shellcheck:
stage: lint
+17
View File
@@ -43,6 +43,10 @@
package = self'.packages.shellcheck;
category = "utils";
help = "Run shellchecks";
} {
package = self'.packages.validate;
category = "utils";
help = "Validate all the files";
} ];
};
@@ -80,6 +84,19 @@
shellcheck -e SC2239 "''${scripts[@]}"
'';
};
validate = pkgs.writeShellApplication {
name = "validate";
runtimeInputs = with pkgs; [
packer
];
text = ''
shopt -s globstar
packer init sources
for vars in distros/**/*.pkrvars.hcl; do
packer validate -except=upload "-var-file=''${vars}" sources/
done
'';
};
};
# https://numtide.github.io/treefmt/