provisioning-catalog/playbooks/bootstrap_initial/steps/build_golden_image.nu

33 lines
1.1 KiB
Text
Raw Normal View History

#!/usr/bin/env nu
def main [
--skip-if: string = "false"
--dry-run
]: nothing -> nothing {
let skip = ($skip_if == "true")
if $skip {
print "[skip] golden image build skipped (--skip-if=true)"
return
}
let buildspec_path = "provisioning/extensions/components/buildkit_runner/metadata.ncl"
if $dry_run {
print "[dry-run] would build buildkit-runner golden image from ($buildspec_path)"
print "[dry-run] buildkit-runner golden images are built via: prvng build golden-image --component buildkit_runner"
return
}
if not ($buildspec_path | path exists) {
error make { msg: $"buildkit_runner metadata.ncl not found at ($buildspec_path) — check component path" }
}
print "Building buildkit-runner golden image..."
let build_r = do { ^prvng build golden-image --component buildkit_runner } | complete
if $build_r.exit_code != 0 {
error make { msg: $"Golden image build failed: ($build_r.stderr | str trim)" }
}
print $build_r.stdout
print "buildkit-runner golden image built successfully"
}