Add cdbg warning for non-debug image

This commit is contained in:
katexochen 2022-07-26 16:52:14 +02:00 committed by Paul Meyer
parent 5d87b48769
commit c37fab0a4c
2 changed files with 17 additions and 0 deletions

View File

@ -66,6 +66,10 @@ func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *c
debugConfig.ConstellationDebugConfig.BootstrapperPath = overrideBootstrapperPath
}
if !state.ImageNameContainsDebug(constellationConfig) {
log.Println("WARN: constellation image does not contain 'debug', are you using a debug image?")
}
overrideIPs, err := cmd.Flags().GetStringSlice("ips")
if err != nil {
return err

View File

@ -2,6 +2,7 @@ package state
import (
"errors"
"strings"
"github.com/edgelesssys/constellation/internal/cloud/cloudtypes"
"github.com/edgelesssys/constellation/internal/config"
@ -76,3 +77,15 @@ func getQEMUInstances(stat state.ConstellationState, _ *config.Config) (controlP
workers = cloudtypes.ScalingGroup{Instances: stat.QEMUWorkers}
return
}
// ImageNameContainsDebug check wether the image name in config contains "debug".
func ImageNameContainsDebug(config *config.Config) bool {
switch {
case config.Provider.GCP != nil:
return strings.Contains(config.Provider.GCP.Image, "debug")
case config.Provider.Azure != nil:
return strings.Contains(config.Provider.Azure.Image, "debug")
default:
return false
}
}