Change pushManifest into preDeployScript
Much more generic, allows users to do whatever they want with the manifest ahead of time.
This commit is contained in:
parent
b5f0a09c8e
commit
b0c78e8b05
1 changed files with 13 additions and 16 deletions
29
kluctl.nix
29
kluctl.nix
|
|
@ -21,17 +21,18 @@ in
|
|||
'';
|
||||
default = "easykubenix";
|
||||
};
|
||||
pushManifest = {
|
||||
enable = lib.mkEnableOption "pushing manifest to bianry cache";
|
||||
to = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "nix store url";
|
||||
};
|
||||
failCachePush = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "If we should fail if we can't push";
|
||||
};
|
||||
preDeployScript = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
description = ''
|
||||
Script that runs just before deploying, useful to push manifests to
|
||||
a binary cache. JSON manifest file is passed as first argument
|
||||
'';
|
||||
default =
|
||||
pkgs.writeScriptBin "preDeployScript" # bash
|
||||
''
|
||||
#! ${pkgs.runtimeShell}
|
||||
true
|
||||
'';
|
||||
};
|
||||
project = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
|
|
@ -166,11 +167,7 @@ in
|
|||
#! ${pkgs.runtimeShell}
|
||||
set -euo pipefail
|
||||
set -x
|
||||
${lib.optionalString cfg.pushManifest.enable ''
|
||||
nix copy --to ${cfg.pushManifest.to} ${config.internal.manifestJSONFile} || ${
|
||||
lib.boolToString (!cfg.pushManifest.failCachePush)
|
||||
}
|
||||
''}
|
||||
${lib.getExe cfg.preDeployScript} ${config.internal.manifestJSONFile}
|
||||
${lib.getExe cfg.package} \
|
||||
deploy \
|
||||
--no-update-check \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue