chore: add current provisioning state before migration
This commit is contained in:
parent
a9703b4748
commit
50745b0f22
660 changed files with 88126 additions and 0 deletions
10
core/nulib/lib_provisioning/cmd/env.nu
Normal file
10
core/nulib/lib_provisioning/cmd/env.nu
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
export-env {
|
||||
use ../lib_provisioning/cmd/lib.nu check_env
|
||||
check_env
|
||||
$env.PROVISIONING_DEBUG = if $env.PROVISIONING_DEBUG? != null {
|
||||
$env.PROVISIONING_DEBUG | into bool
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
66
core/nulib/lib_provisioning/cmd/lib.nu
Normal file
66
core/nulib/lib_provisioning/cmd/lib.nu
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
# Made for prepare and postrun
|
||||
use ../lib_provisioning/utils/ui.nu *
|
||||
use ../lib_provisioning/sops *
|
||||
|
||||
export def log_debug [
|
||||
msg: string
|
||||
]: nothing -> nothing {
|
||||
use std
|
||||
std log debug $msg
|
||||
# std assert (1 == 1)
|
||||
}
|
||||
export def check_env [
|
||||
]: nothing -> nothing {
|
||||
if $env.PROVISIONING_VARS? == null {
|
||||
_print $"🛑 Error no values found for (_ansi red_bold)env.PROVISIONING_VARS(_ansi reset)"
|
||||
exit 1
|
||||
}
|
||||
if not ($env.PROVISIONING_VARS? | path exists) {
|
||||
_print $"🛑 Error file (_ansi red_bold)($env.PROVISIONING_VARS)(_ansi reset) not found"
|
||||
exit 1
|
||||
}
|
||||
if $env.PROVISIONING_KLOUD_PATH? == null {
|
||||
_print $"🛑 Error no values found for (_ansi red_bold)env.PROVISIONING_KLOUD_PATH(_ansi reset)"
|
||||
exit 1
|
||||
}
|
||||
if not ($env.PROVISIONING_KLOUD_PATH? | path exists) {
|
||||
_print $"🛑 Error file (_ansi red_bold)($env.PROVISIONING_KLOUD_PATH)(_ansi reset) not found"
|
||||
exit 1
|
||||
}
|
||||
if $env.PROVISIONING_WK_ENV_PATH? == null {
|
||||
_print $"🛑 Error no values found for (_ansi red_bold)env.PROVISIONING_WK_ENV_PATH(_ansi reset)"
|
||||
exit 1
|
||||
}
|
||||
if not ($env.PROVISIONING_WK_ENV_PATH? | path exists) {
|
||||
_print $"🛑 Error file (_ansi red_bold)($env.PROVISIONING_WK_ENV_PATH)(_ansi reset) not found"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
export def sops_cmd [
|
||||
task: string
|
||||
source: string
|
||||
target?: string
|
||||
--error_exit # error on exit
|
||||
]: nothing -> nothing {
|
||||
if $env.PROVISIONING_SOPS? == null {
|
||||
$env.CURRENT_INFRA_PATH = ($env.PROVISIONING_INFRA_PATH | path join $env.PROVISIONING_KLOUD )
|
||||
use sops_env.nu
|
||||
}
|
||||
#use sops/lib.nu on_sops
|
||||
if $error_exit {
|
||||
on_sops $task $source $target --error_exit
|
||||
} else {
|
||||
on_sops $task $source $target
|
||||
}
|
||||
}
|
||||
|
||||
export def load_defs [
|
||||
]: nothing -> record {
|
||||
if not ($env.PROVISIONING_VARS | path exists) {
|
||||
_print $"🛑 Error file (_ansi red_bold)($env.PROVISIONING_VARS)(_ansi reset) not found"
|
||||
exit 1
|
||||
}
|
||||
(open $env.PROVISIONING_VARS)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue