Skip to content

Commit

Permalink
Merge pull request #4975 from werf/specific-images-params
Browse files Browse the repository at this point in the history
fix(converge): feature gate for specific images params in werf-converge (due to compatibility issues)
  • Loading branch information
distorhead committed Oct 3, 2022
2 parents a5fdf4d + a836f8f commit be20197
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
25 changes: 22 additions & 3 deletions cmd/werf/converge/converge.go
Expand Up @@ -51,10 +51,22 @@ var cmdData struct {

var commonCmdData common.CmdData

func isSpecificImagesEnabled() bool {
return util.GetBoolEnvironmentDefaultFalse("WERF_CONVERGE_ENABLE_IMAGES_PARAMS")
}

func NewCmd(ctx context.Context) *cobra.Command {
ctx = common.NewContextWithCmdData(ctx, &commonCmdData)

var useMsg string
if isSpecificImagesEnabled() {
useMsg = "converge [IMAGE_NAME ...]"
} else {
useMsg = "converge"
}

cmd := common.SetCommandContext(ctx, &cobra.Command{
Use: "converge [IMAGE_NAME...]",
Use: useMsg,
Short: "Build and push images, then deploy application into Kubernetes",
Long: common.GetLongCommandDescription(GetConvergeDocs().Long),
Example: `# Build and deploy current application state into production environment
Expand All @@ -76,12 +88,19 @@ werf converge --repo registry.mydomain.com/web --env production`,
common.LogVersion()

return common.LogRunningTime(func() error {
return runMain(ctx, common.GetImagesToProcess(args, *commonCmdData.WithoutImages))
var imagesToProcess build.ImagesToProcess
if isSpecificImagesEnabled() {
imagesToProcess = common.GetImagesToProcess(args, *commonCmdData.WithoutImages)
}

return runMain(ctx, imagesToProcess)
})
},
})

commonCmdData.SetupWithoutImages(cmd)
if isSpecificImagesEnabled() {
commonCmdData.SetupWithoutImages(cmd)
}

common.SetupDir(&commonCmdData, cmd)
common.SetupGitWorkTree(&commonCmdData, cmd)
Expand Down
6 changes: 1 addition & 5 deletions docs/_includes/reference/cli/werf_converge.md
Expand Up @@ -15,7 +15,7 @@ Read more info about Helm chart structure, Helm Release name, Kubernetes Namespa
{{ header }} Syntax

```shell
werf converge [IMAGE_NAME...] [options]
werf converge [options]
```

{{ header }} Examples
Expand Down Expand Up @@ -375,9 +375,5 @@ werf converge --repo registry.mydomain.com/web --env production
--virtual-merge=false
Enable virtual/ephemeral merge commit mode when building current application state
($WERF_VIRTUAL_MERGE by default)
--without-images=false
Disable building of images defined in the werf.yaml (if any) and usage of such images
in the .helm/templates ($WERF_WITHOUT_IMAGES or false by default — e.g. enable all
images defined in the werf.yaml by default)
```

0 comments on commit be20197

Please sign in to comment.