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

fix: add immage flag for . image convention #69

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading