Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
fix: add immage flag for . image convention
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishumanitec committed Jan 31, 2024
1 parent 111380a commit 592bbad
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 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 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 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 592bbad

Please sign in to comment.