diff --git a/Dockerfile.test b/Dockerfile.test index 73f51b1..df118ca 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -15,21 +15,13 @@ COPY --from=build /app/kairos-init /kairos-init # Target to use the validator directly inside a generated image with kairos-init FROM ${VALIDATE_IMAGE} AS validate -ARG MODEL=generic -ARG VARIANT=core -ARG FRAMEWORK_VERSION="" -ARG TRUSTED_BOOT=false COPY --from=build /app/kairos-init /kairos-init -RUN /kairos-init -l debug --validate -m "${MODEL}" -v "${VARIANT}" -f "${FRAMEWORK_VERSION}" -t "${TRUSTED_BOOT}" +RUN /kairos-init -l debug --validate FROM ${BASE_IMAGE} -ARG MODEL=generic -ARG VARIANT=core -ARG FRAMEWORK_VERSION="" -ARG TRUSTED_BOOT=false COPY --from=kairos-init /kairos-init /kairos-init -RUN /kairos-init -l debug -s install -m "${MODEL}" -v "${VARIANT}" -f "${FRAMEWORK_VERSION}" -t "${TRUSTED_BOOT}" -RUN /kairos-init -l debug -s init -m "${MODEL}" -v "${VARIANT}" -f "${FRAMEWORK_VERSION}" -t "${TRUSTED_BOOT}" -RUN /kairos-init -l debug --validate -m "${MODEL}" -v "${VARIANT}" -f "${FRAMEWORK_VERSION}" -t "${TRUSTED_BOOT}" +RUN /kairos-init -l debug -s install +RUN /kairos-init -l debug -s init +RUN /kairos-init -l debug --validate RUN rm /kairos-init \ No newline at end of file diff --git a/main.go b/main.go index 6fdcafc..a49c897 100644 --- a/main.go +++ b/main.go @@ -53,10 +53,26 @@ func main() { logger.Infof("Starting kairos-init version %s", values.GetVersion()) logger.Debug(litter.Sdump(values.GetFullVersion())) - // If the framework version is set in the config use that, otherwise use the version from the values which usually its the latest - if config.DefaultConfig.FrameworkVersion == "" { - logger.Logger.Debug().Str("version", values.GetFrameworkVersion()).Msg("Setting framework version from config") - config.DefaultConfig.FrameworkVersion = values.GetFrameworkVersion() + // Validate flags are being passed with actual values + requiredFlags := []struct { + name string + value string + }{ + {"l", config.DefaultConfig.Level}, + {"s", config.DefaultConfig.Stage}, + {"m", config.DefaultConfig.Model}, + {"v", config.DefaultConfig.Variant}, + {"r", config.DefaultConfig.Registry}, + {"t", trusted}, + {"f", config.DefaultConfig.FrameworkVersion}, + } + + for _, rf := range requiredFlags { + if rf.value == "" { + fmt.Fprintf(os.Stderr, "Error: -%s flag is required to have a value\n", rf.name) + flag.Usage() + os.Exit(1) + } } logger.Debug(litter.Sdump(config.DefaultConfig))