Skip to content

Commit

Permalink
fix: add immage flag for . image convention
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Stephenson <chris.stephenson@humanitec.com>
  • Loading branch information
chrishumanitec committed Feb 2, 2024
1 parent 6cb503d commit 6355a99
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/command/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
workloadSourceURL string

overrideParams []string
currentImage string
message string

// deltaID is a cli flag receiver used to support "score-humanitec delta --use foo"
Expand Down
1 change: 1 addition & 0 deletions internal/command/delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func init() {
deltaCmd.MarkFlagRequired("env")

deltaCmd.Flags().StringArrayVarP(&overrideParams, "property", "p", nil, "Overrides selected property value")
deltaCmd.Flags().StringVarP(&currentImage, "image", "i", ".", "Image to use for the current image, signified by \".\"")
deltaCmd.Flags().StringVarP(&message, "message", "m", messageDefault, "Message")

deltaCmd.Flags().BoolVar(&deploy, "deploy", false, "Trigger a new delta deployment at the end")
Expand Down
1 change: 1 addition & 0 deletions internal/command/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func init() {
draftCmd.MarkFlagRequired("env")

draftCmd.Flags().StringArrayVarP(&overrideParams, "property", "p", nil, "Overrides selected property value")
draftCmd.Flags().StringVarP(&currentImage, "image", "i", ".", "Image to use for the current image, signified by \".\"")

draftCmd.Flags().BoolVar(&deploy, "deploy", false, "Trigger a new draft deployment at the end")
draftCmd.Flags().BoolVar(&verbose, "verbose", false, "Enable diagnostic messages (written to STDERR)")
Expand Down
13 changes: 13 additions & 0 deletions internal/command/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func init() {
runCmd.MarkFlagRequired("env")

runCmd.Flags().StringArrayVarP(&overrideParams, "property", "p", nil, "Overrides selected property value")
runCmd.Flags().StringVarP(&currentImage, "image", "i", ".", "Image to use for the current image, signified by \".\"")
runCmd.Flags().StringVarP(&message, "message", "m", messageDefault, "Message")

runCmd.Flags().BoolVar(&skipValidation, "skip-validation", false, "DEPRECATED: Disables Score file schema validation.")
Expand Down Expand Up @@ -158,6 +159,18 @@ func loadSpec(scoreFile, overridesFile, extensionsFile string, skipValidation bo
}
}

// Replace images defined by . (optional)
//
if containers, ok := srcMap["containers"].(map[string]interface{}); ok {
for _, containerVal := range containers {
if container, ok := containerVal.(map[string]interface{}); ok {
if image, ok := container["image"].(string); ok && image == "." {
container["image"] = currentImage
}
}
}
}

// Load extensions (optional)
//
var extMap = make(map[string]interface{})
Expand Down

0 comments on commit 6355a99

Please sign in to comment.