diff --git a/cmd/werf/bundle/export/export.go b/cmd/werf/bundle/export/export.go index b0bde0c1a7..463da13067 100644 --- a/cmd/werf/bundle/export/export.go +++ b/cmd/werf/bundle/export/export.go @@ -139,6 +139,7 @@ func NewCmd(ctx context.Context) *cobra.Command { common.SetupParallelOptions(&commonCmdData, cmd, common.DefaultBuildParallelTasksLimit) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) commonCmdData.SetupPlatform(cmd) common.SetupDisableAutoHostCleanup(&commonCmdData, cmd) @@ -296,7 +297,7 @@ func runExport(ctx context.Context, imagesToProcess build.ImagesToProcess) error defer conveyorWithRetry.Terminate() if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig) if err != nil { return err diff --git a/cmd/werf/bundle/publish/publish.go b/cmd/werf/bundle/publish/publish.go index d79b4d9769..f0964104f3 100644 --- a/cmd/werf/bundle/publish/publish.go +++ b/cmd/werf/bundle/publish/publish.go @@ -137,6 +137,7 @@ func NewCmd(ctx context.Context) *cobra.Command { common.SetupDockerServerStoragePath(&commonCmdData, cmd) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) commonCmdData.SetupPlatform(cmd) commonCmdData.SetupHelmCompatibleChart(cmd, false) @@ -302,7 +303,7 @@ func runPublish(ctx context.Context, imagesToProcess build.ImagesToProcess) erro defer conveyorWithRetry.Terminate() if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig) if err != nil { return err diff --git a/cmd/werf/common/cmd_data.go b/cmd/werf/common/cmd_data.go index 0339dd1fb0..f77dfa1ea9 100644 --- a/cmd/werf/common/cmd_data.go +++ b/cmd/werf/common/cmd_data.go @@ -54,8 +54,9 @@ type CmdData struct { SecondaryStagesStorage *[]string CacheStagesStorage *[]string - SkipBuild *bool - StubTags *bool + SkipBuild *bool + RequireBuiltImages *bool + StubTags *bool AddCustomTag *[]string UseCustomTag *string diff --git a/cmd/werf/common/common.go b/cmd/werf/common/common.go index 5e8694bbc9..9454a2bed2 100644 --- a/cmd/werf/common/common.go +++ b/cmd/werf/common/common.go @@ -800,9 +800,19 @@ IMAGE_NAME is the name of an image or artifact described in werf.yaml, the namel STAGE_NAME should be one of the following: `+strings.Join(allStagesNames(), ", ")) } +// SetupSkipBuild +// Deprecated. See [SetupRequireBuiltImages]. func SetupSkipBuild(cmdData *CmdData, cmd *cobra.Command) { cmdData.SkipBuild = new(bool) - cmd.Flags().BoolVarP(cmdData.SkipBuild, "skip-build", "Z", util.GetBoolEnvironmentDefaultFalse("WERF_SKIP_BUILD"), "Disable building of docker images, cached images in the repo should exist in the repo if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD)") + cmd.Flags().BoolVarP(cmdData.SkipBuild, "skip-build", "", util.GetBoolEnvironmentDefaultFalse("WERF_SKIP_BUILD"), "DEPRECATED: use --require-built-images.") + _ = cmd.Flags().MarkHidden("skip-build") +} + +// SetupRequireBuiltImages adds --require-built-images flag. +// See also [quireBuiltImages]. +func SetupRequireBuiltImages(cmdData *CmdData, cmd *cobra.Command) { + cmdData.RequireBuiltImages = new(bool) + cmd.Flags().BoolVarP(cmdData.RequireBuiltImages, "require-built-images", "Z", util.GetBoolEnvironmentDefaultFalse("WERF_REQUIRE_BUILT_IMAGES"), "Requires all used images to be previously built and exist in repo. Exits with error if needed images are not cached and so require to run build instructions (default $WERF_REQUIRE_BUILT_IMAGES)") } func SetupStubTags(cmdData *CmdData, cmd *cobra.Command) { @@ -1166,6 +1176,20 @@ func GetOptionalRelease(cmdData *CmdData) string { return *cmdData.Release } +// GetRequireBuiltImages returns true if --require-built-images is set or --skip-build is set. +// There is no way to determine if both options are used, so no warning. +func GetRequireBuiltImages(ctx context.Context, cmdData *CmdData) bool { + if cmdData.RequireBuiltImages != nil && *cmdData.RequireBuiltImages { + return true + } + // Support for deprecated option. + if cmdData.SkipBuild != nil && *cmdData.SkipBuild { + logboek.Context(ctx).Warn().LogF("DEPRECATED: use --require-built-images ($WERF_REQUIRE_BUILT_IMAGES) instead of --skip-build\n") + return true + } + return false +} + func GetIntrospectOptions(cmdData *CmdData, werfConfig *config.WerfConfig) (build.IntrospectOptions, error) { isStageExist := func(sName string) bool { for _, stageName := range allStagesNames() { diff --git a/cmd/werf/compose/main.go b/cmd/werf/compose/main.go index cab6207d9d..eecb1982e4 100644 --- a/cmd/werf/compose/main.go +++ b/cmd/werf/compose/main.go @@ -193,6 +193,7 @@ func newCmd(ctx context.Context, composeCmdName string, options *newCmdOptions) common.SetupFinalRepo(&commonCmdData, cmd) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) if options.FollowSupport { common.SetupFollow(&commonCmdData, cmd) @@ -408,7 +409,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken defer conveyorWithRetry.Terminate() if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { if err := c.ShouldBeBuilt(ctx, build.ShouldBeBuiltOptions{}); err != nil { return err } diff --git a/cmd/werf/converge/converge.go b/cmd/werf/converge/converge.go index 967a855257..eadc7d9530 100644 --- a/cmd/werf/converge/converge.go +++ b/cmd/werf/converge/converge.go @@ -173,6 +173,7 @@ werf converge --repo registry.mydomain.com/web --env production`, common.SetupParallelOptions(&commonCmdData, cmd, common.DefaultBuildParallelTasksLimit) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) commonCmdData.SetupPlatform(cmd) common.SetupFollow(&commonCmdData, cmd) @@ -344,7 +345,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken defer conveyorWithRetry.Terminate() if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig) if err != nil { return err diff --git a/cmd/werf/export/export.go b/cmd/werf/export/export.go index cf3a19bbc8..7f4052d576 100644 --- a/cmd/werf/export/export.go +++ b/cmd/werf/export/export.go @@ -104,6 +104,7 @@ func NewExportCmd(ctx context.Context) *cobra.Command { common.SetupFinalRepo(&commonCmdData, cmd) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) common.SetupDockerConfig(&commonCmdData, cmd, "Command needs granted permissions to read and pull images from the specified repo") common.SetupInsecureRegistry(&commonCmdData, cmd) @@ -265,7 +266,7 @@ func run(ctx context.Context, imagesToProcess build.ImagesToProcess, tagTemplate return c.Export(ctx, build.ExportOptions{ BuildPhaseOptions: build.BuildPhaseOptions{ BuildOptions: build.BuildOptions{SkipImageMetadataPublication: *commonCmdData.Dev}, - ShouldBeBuiltMode: *commonCmdData.SkipBuild, + ShouldBeBuiltMode: common.GetRequireBuiltImages(ctx, &commonCmdData), }, ExportPhaseOptions: build.ExportPhaseOptions{ ExportImageNameList: imageNameList, diff --git a/cmd/werf/kube_run/kube_run.go b/cmd/werf/kube_run/kube_run.go index a8b4c6ee29..cbd568ca8c 100644 --- a/cmd/werf/kube_run/kube_run.go +++ b/cmd/werf/kube_run/kube_run.go @@ -171,6 +171,7 @@ func NewCmd(ctx context.Context) *cobra.Command { common.SetupFinalRepo(&commonCmdData, cmd) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) common.SetupFollow(&commonCmdData, cmd) @@ -406,7 +407,7 @@ func run(ctx context.Context, pod, secret, namespace string, werfConfig *config. var image string if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { if err := c.ShouldBeBuilt(ctx, build.ShouldBeBuiltOptions{}); err != nil { return err } diff --git a/cmd/werf/render/render.go b/cmd/werf/render/render.go index 6b3e86d6a7..44fde39da0 100644 --- a/cmd/werf/render/render.go +++ b/cmd/werf/render/render.go @@ -148,6 +148,7 @@ func NewCmd(ctx context.Context) *cobra.Command { common.SetupParallelOptions(&commonCmdData, cmd, common.DefaultBuildParallelTasksLimit) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) commonCmdData.SetupPlatform(cmd) cmd.Flags().BoolVarP(&cmdData.Validate, "validate", "", util.GetBoolEnvironmentDefaultFalse("WERF_VALIDATE"), "Validate your manifests against the Kubernetes cluster you are currently pointing at (default $WERF_VALIDATE)") @@ -321,7 +322,7 @@ func runRender(ctx context.Context, imagesToProcess build.ImagesToProcess) error if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { buildFunc := func(ctx context.Context) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig) if err != nil { return err diff --git a/cmd/werf/run/run.go b/cmd/werf/run/run.go index 1e10b15902..d2feaeb39a 100644 --- a/cmd/werf/run/run.go +++ b/cmd/werf/run/run.go @@ -132,6 +132,7 @@ func NewCmd(ctx context.Context) *cobra.Command { common.SetupFinalRepo(&commonCmdData, cmd) common.SetupSkipBuild(&commonCmdData, cmd) + common.SetupRequireBuiltImages(&commonCmdData, cmd) common.SetupFollow(&commonCmdData, cmd) @@ -392,7 +393,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken var dockerImageName string if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error { - if *commonCmdData.SkipBuild { + if common.GetRequireBuiltImages(ctx, &commonCmdData) { if err := c.ShouldBeBuilt(ctx, build.ShouldBeBuiltOptions{}); err != nil { return err } diff --git a/docs/_includes/reference/cli/werf_bundle_export.md b/docs/_includes/reference/cli/werf_bundle_export.md index 2b979efe4f..8f9855fcb1 100644 --- a/docs/_includes/reference/cli/werf_bundle_export.md +++ b/docs/_includes/reference/cli/werf_bundle_export.md @@ -251,6 +251,10 @@ werf bundle export [IMAGE_NAME...] [options] --report-path='' DEPRECATED: use --save-build-report with optional --build-report-path. Report save path ($WERF_REPORT_PATH by default) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --save-build-report=false Save build report (by default $WERF_SAVE_BUILD_REPORT or false). Its path and format configured with --build-report-path @@ -274,9 +278,6 @@ werf bundle export [IMAGE_NAME...] [options] with commas: key1=val1,key2=val2). Also, can be defined with $WERF_SET_STRING_* (e.g. $WERF_SET_STRING_1=key1=val1, $WERF_SET_STRING_2=key2=val2) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) -L, --skip-dependencies-repo-refresh=false Do not refresh helm chart repositories locally cached index --skip-tls-verify-registry=false diff --git a/docs/_includes/reference/cli/werf_bundle_publish.md b/docs/_includes/reference/cli/werf_bundle_publish.md index 8cd2c46482..9860e26987 100644 --- a/docs/_includes/reference/cli/werf_bundle_publish.md +++ b/docs/_includes/reference/cli/werf_bundle_publish.md @@ -278,6 +278,10 @@ werf bundle publish [IMAGE_NAME...] [options] --report-path='' DEPRECATED: use --save-build-report with optional --build-report-path. Report save path ($WERF_REPORT_PATH by default) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --save-build-report=false Save build report (by default $WERF_SAVE_BUILD_REPORT or false). Its path and format configured with --build-report-path @@ -306,9 +310,6 @@ werf bundle publish [IMAGE_NAME...] [options] with commas: key1=val1,key2=val2). Also, can be defined with $WERF_SET_STRING_* (e.g. $WERF_SET_STRING_1=key1=val1, $WERF_SET_STRING_2=key2=val2) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) -L, --skip-dependencies-repo-refresh=false Do not refresh helm chart repositories locally cached index --skip-tls-verify-registry=false diff --git a/docs/_includes/reference/cli/werf_compose_config.md b/docs/_includes/reference/cli/werf_compose_config.md index 80482bc7c9..dcdeb3ce93 100644 --- a/docs/_includes/reference/cli/werf_compose_config.md +++ b/docs/_includes/reference/cli/werf_compose_config.md @@ -243,14 +243,15 @@ werf compose config [IMAGE_NAME...] [options] [--docker-compose-options="OPTIONS repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_compose_down.md b/docs/_includes/reference/cli/werf_compose_down.md index a6652f5f18..4c96021ee0 100644 --- a/docs/_includes/reference/cli/werf_compose_down.md +++ b/docs/_includes/reference/cli/werf_compose_down.md @@ -236,14 +236,15 @@ werf compose down [IMAGE_NAME...] [options] [--docker-compose-options="OPTIONS"] repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_compose_run.md b/docs/_includes/reference/cli/werf_compose_run.md index 030bc47230..b12df51332 100644 --- a/docs/_includes/reference/cli/werf_compose_run.md +++ b/docs/_includes/reference/cli/werf_compose_run.md @@ -233,14 +233,15 @@ werf compose run [IMAGE_NAME...] [options] [--docker-compose-options="OPTIONS"] repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_compose_up.md b/docs/_includes/reference/cli/werf_compose_up.md index 8ee73648c5..c99b59c963 100644 --- a/docs/_includes/reference/cli/werf_compose_up.md +++ b/docs/_includes/reference/cli/werf_compose_up.md @@ -244,14 +244,15 @@ werf compose up [IMAGE_NAME...] [options] [--docker-compose-options="OPTIONS"] [ repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_converge.md b/docs/_includes/reference/cli/werf_converge.md index f48d1ad5a4..964b0581a2 100644 --- a/docs/_includes/reference/cli/werf_converge.md +++ b/docs/_includes/reference/cli/werf_converge.md @@ -318,6 +318,10 @@ werf converge --repo registry.mydomain.com/web --env production --report-path='' DEPRECATED: use --save-build-report with optional --build-report-path. Report save path ($WERF_REPORT_PATH by default) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --save-build-report=false Save build report (by default $WERF_SAVE_BUILD_REPORT or false). Its path and format configured with --build-report-path @@ -351,9 +355,6 @@ werf converge --repo registry.mydomain.com/web --env production with commas: key1=val1,key2=val2). Also, can be defined with $WERF_SET_STRING_* (e.g. $WERF_SET_STRING_1=key1=val1, $WERF_SET_STRING_2=key2=val2) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) -L, --skip-dependencies-repo-refresh=false Do not refresh helm chart repositories locally cached index --skip-tls-verify-registry=false diff --git a/docs/_includes/reference/cli/werf_export.md b/docs/_includes/reference/cli/werf_export.md index e423a8bb60..c1cc05b98d 100644 --- a/docs/_includes/reference/cli/werf_export.md +++ b/docs/_includes/reference/cli/werf_export.md @@ -185,14 +185,15 @@ werf export [IMAGE_NAME...] [options] repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_kube_run.md b/docs/_includes/reference/cli/werf_kube_run.md index bb7d7a9cb5..d95d0829b9 100644 --- a/docs/_includes/reference/cli/werf_kube_run.md +++ b/docs/_includes/reference/cli/werf_kube_run.md @@ -211,6 +211,10 @@ werf kube-run [options] [IMAGE_NAME] [-- COMMAND ARG...] repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --rm=true Remove pod and other created resources after command completion (default $WERF_RM or true if not specified) @@ -222,9 +226,6 @@ werf kube-run [options] [IMAGE_NAME] [-- COMMAND ARG...] cache. Also, can be specified with $WERF_SECONDARY_REPO_* (e.g. $WERF_SECONDARY_REPO_1=..., $WERF_SECONDARY_REPO_2=...) - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/_includes/reference/cli/werf_render.md b/docs/_includes/reference/cli/werf_render.md index 81c482f832..019c12498a 100644 --- a/docs/_includes/reference/cli/werf_render.md +++ b/docs/_includes/reference/cli/werf_render.md @@ -260,6 +260,10 @@ werf render [IMAGE_NAME...] [options] --report-path='' DEPRECATED: use --save-build-report with optional --build-report-path. Report save path ($WERF_REPORT_PATH by default) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --save-build-report=false Save build report (by default $WERF_SAVE_BUILD_REPORT or false). Its path and format configured with --build-report-path @@ -292,9 +296,6 @@ werf render [IMAGE_NAME...] [options] $WERF_SET_STRING_2=key2=val2) -s, --show-only=[] only show manifests rendered from the given templates - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) -L, --skip-dependencies-repo-refresh=false Do not refresh helm chart repositories locally cached index --skip-tls-verify-registry=false diff --git a/docs/_includes/reference/cli/werf_run.md b/docs/_includes/reference/cli/werf_run.md index 61c05ddf85..5ca23c1adc 100644 --- a/docs/_includes/reference/cli/werf_run.md +++ b/docs/_includes/reference/cli/werf_run.md @@ -184,6 +184,10 @@ werf run [options] [IMAGE_NAME] [-- COMMAND ARG...] repo Selectel VPC (default $WERF_REPO_SELECTEL_VPC) --repo-selectel-vpc-id='' repo Selectel VPC ID (default $WERF_REPO_SELECTEL_VPC_ID) + -Z, --require-built-images=false + Requires all used images to be previously built and exist in repo. Exits with error if + needed images are not cached and so require to run build instructions (default + $WERF_REQUIRE_BUILT_IMAGES) --secondary-repo=[] Specify one or multiple secondary read-only repos with images that will be used as a cache. @@ -191,9 +195,6 @@ werf run [options] [IMAGE_NAME] [-- COMMAND ARG...] $WERF_SECONDARY_REPO_2=...) --shell=false Use predefined docker options and command for debug - -Z, --skip-build=false - Disable building of docker images, cached images in the repo should exist in the repo - if werf.yaml contains at least one image description (default $WERF_SKIP_BUILD) --skip-tls-verify-registry=false Skip TLS certificate validation when accessing a registry (default $WERF_SKIP_TLS_VERIFY_REGISTRY) diff --git a/docs/pages_en/reference/cheat_sheet.md b/docs/pages_en/reference/cheat_sheet.md index 364942a23f..bf1492c24f 100644 --- a/docs/pages_en/reference/cheat_sheet.md +++ b/docs/pages_en/reference/cheat_sheet.md @@ -22,7 +22,7 @@ werf converge --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" You can create a pipeline tailored to your needs using the commands below. -Running most of the commands will first cause the missing images to be rebuilt. You can skip the rebuild by using the `--skip-build` flag. Make sure that the necessary images are built beforehand using the `werf build` command. +Running most commands will first check for images in the specified repo. Build instructions will run for missing images. For some scenarios, e.g. running tests in CI system, it is more convenient to use `werf build` to build images first and then strictly use the same images on other steps with flag `--require-built-images`. The step command will exit with an error in case of missing images. ### Integrating with a CI system (GitLab and GitHub-based workflows are currently supported) @@ -128,7 +128,7 @@ werf converge --repo ghcr.io/group/project --env production Deploying the application you built in the previous step and using a custom tag: ```shell -werf converge --skip-build --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" +werf converge --require-built-images --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" ``` Deploying the previously published bundle with the 1.0.0 tag to production: diff --git a/docs/pages_en/resources/how_to_migrate_from_v1_1_to_v1_2.md b/docs/pages_en/resources/how_to_migrate_from_v1_1_to_v1_2.md index 5c7479a7ea..8f623e51bb 100644 --- a/docs/pages_en/resources/how_to_migrate_from_v1_1_to_v1_2.md +++ b/docs/pages_en/resources/how_to_migrate_from_v1_1_to_v1_2.md @@ -216,10 +216,9 @@ werf provides following compose commands: #### Interface rework -- Single `werf converge` command to build and publish needed images into the container registry and deploy application into the kubernetes. - - `werf converge --skip-build` emulates behaviour of an old `werf deploy` command. - - werf will complain if needed images was not found in the container registry as `werf deploy` did. -- Removed `werf stages *`, `werf images *` and `werf host project *` commands. +- `werf deploy` is removed. Use `werf converge` — a single command to build and publish needed images into the container registry and deploy application into the kubernetes. + - Use `werf converge --require-built-images` to emulate `werf deploy` behaviour: werf will exit with error in case needed images was not found in the container registry. +- Commands `werf stages *`, `werf images *` and `werf host project *` are removed. - There is no more `werf publish` command, because `werf build` command with `--repo` param will publish images with all it's stages into the container registry automatically. - There is no more `--tag-by-stages-signature`, `--tag-git-branch`, `--tag-git-commit`, `--tag-git-tag`, `--tag-custom` options, `--tag-by-stages-signature` behaviour is default. - Forcing of custom tags is [not yet available](https://github.com/werf/werf/issues/2869) in the v1.2 diff --git a/docs/pages_en/usage/deploy/deployment_scenarios.md b/docs/pages_en/usage/deploy/deployment_scenarios.md index 6c169ed12e..5bf0592157 100644 --- a/docs/pages_en/usage/deploy/deployment_scenarios.md +++ b/docs/pages_en/usage/deploy/deployment_scenarios.md @@ -18,7 +18,7 @@ werf build --repo example.org/mycompany/myapp ``` ```shell -werf converge --skip-build --repo example.org/mycompany/myapp +werf converge --require-built-images --repo example.org/mycompany/myapp ``` ## Deploying using custom image tags @@ -42,7 +42,7 @@ werf build --add-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp ``` ```shell -werf converge --skip-build --use-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp +werf converge --require-built-images --use-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp ``` ## Deploying without access to the application's Git repository @@ -76,7 +76,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Deploying without access to an application's Git repository and container registry @@ -126,7 +126,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Deploying with a third-party tool @@ -160,7 +160,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf render --skip-build --output manifests.yaml --repo example.org/mycompany/myapp +werf render --require-built-images --output manifests.yaml --repo example.org/mycompany/myapp ``` ## Deploying with a third-party tool without access to the application's Git repository @@ -202,7 +202,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Saving a deployment report diff --git a/docs/pages_ru/reference/cheat_sheet.md b/docs/pages_ru/reference/cheat_sheet.md index 897af8069b..dc3affa43c 100644 --- a/docs/pages_ru/reference/cheat_sheet.md +++ b/docs/pages_ru/reference/cheat_sheet.md @@ -22,7 +22,7 @@ werf converge --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" Приведенные ниже команды позволяют организовать пайплайн, адаптированный под ваши нужды. -При выполнении большинства команд сначала будут пересобраны недостающие образы. Пересборку можно пропустить, применив флаг `--skip-build`. Убедитесь, что необходимые образы собраны заранее с помощью команды `werf build`. +При выполнении большинства команд будет проверено наличие собранных образов в указанном репозитории container registry. При отсутствии нужных образов, будут запущены инструкции сборки. В некоторых сценариях (например, запуск тестов в CI системе) правильнее вначале собирать образы с помощью команды `werf build`, а затем использовать те же самые образы на следующих шагах пайплайна, указывая флаг `--require-built-images`. В этом случае команда завершится с ошибкой, если нужные образы отсутствуют. ### Интеграция с CI-системой (в настоящее время поддерживаются GitLab и GitHub Workflows) @@ -128,7 +128,7 @@ werf converge --repo ghcr.io/group/project --env production Развернуть приложение, собранное на предыдущем шаге, и использовать кастомный тег вместо тега по умолчанию на основе содержимого: ```shell -werf converge --skip-build --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" +werf converge --require-built-images --repo ghcr.io/group/project --use-custom-tag "%image%-$CI_JOB_ID" ``` Развернуть ранее опубликованный бандл с тегом 1.0.0 в production: diff --git a/docs/pages_ru/resources/how_to_migrate_from_v1_1_to_v1_2.md b/docs/pages_ru/resources/how_to_migrate_from_v1_1_to_v1_2.md index b788f5c4ea..c925881ebd 100644 --- a/docs/pages_ru/resources/how_to_migrate_from_v1_1_to_v1_2.md +++ b/docs/pages_ru/resources/how_to_migrate_from_v1_1_to_v1_2.md @@ -224,10 +224,8 @@ werf предоставляет следующие команды compose: #### Переработка интерфейса -- Единая команда `werf converge` для сборки и публикации требуемых образов в container registry и деплоя приложения в kubernetes. -- Single `werf converge` command to build and publish needed images and deploy application into the kubernetes. - - Вызов команды с опцией `werf converge --skip-build` эмулирует поведение ранее существующей команды `werf deploy`. - - werf упадёт с ошибкой если требуемые образы не будут найдены в container registry, так же как падал с ошибкой `werf deploy`. +- Удалена команда `werf deploy`. Рекомендуется использовать команду `werf converge` — единую команду для сборки и публикации требуемых образов в container registry и деплоя приложения в kubernetes. + - Вызов `werf converge --require-built-images` эмулирует поведение `werf deploy`: werf выходит с ошибкой если требуемые образы не будут найдены в container registry. - Удалены команды `werf stages *`, `werf images *` и `werf host project *`. - Более нет команды `werf publish`, потому что команда `werf build` с параметром `--repo` загрузит образы и все стадии, из которых они состоят, в container registry автоматически. - Более нет флагов тегирования: `--tag-by-stages-signature`, `--tag-git-branch`, `--tag-git-commit`, `--tag-git-tag` и `--tag-custom`, werf всегда использует поведение ранее включаемое флагом `--tag-by-stages-signature`. diff --git a/docs/pages_ru/usage/deploy/deployment_scenarios.md b/docs/pages_ru/usage/deploy/deployment_scenarios.md index 3f83754d2d..2d1736076a 100644 --- a/docs/pages_ru/usage/deploy/deployment_scenarios.md +++ b/docs/pages_ru/usage/deploy/deployment_scenarios.md @@ -18,7 +18,7 @@ werf build --repo example.org/mycompany/myapp ``` ```shell -werf converge --skip-build --repo example.org/mycompany/myapp +werf converge --require-built-images --repo example.org/mycompany/myapp ``` ## Развертывание с использованием произвольных тегов образов @@ -42,7 +42,7 @@ werf build --add-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp ``` ```shell -werf converge --skip-build --use-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp +werf converge --require-built-images --use-custom-tag '%image%-v1.0.0' --repo example.org/mycompany/myapp ``` ## Развертывание без доступа к Git-репозиторию приложения @@ -76,7 +76,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Развертывание без доступа к Git-репозиторию и container registry приложения @@ -126,7 +126,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Развертывание сторонним инструментом @@ -160,7 +160,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf render --skip-build --output manifests.yaml --repo example.org/mycompany/myapp +werf render --require-built-images --output manifests.yaml --repo example.org/mycompany/myapp ``` ## Развертывание сторонним инструментом без доступа к Git-репозиторию приложения @@ -202,7 +202,7 @@ werf build --repo example.org/mycompany/myapp ``` ``` -werf bundle publish --skip-build --tag latest --repo example.org/mycompany/myapp +werf bundle publish --require-built-images --tag latest --repo example.org/mycompany/myapp ``` ## Сохранение отчета о развертывании diff --git a/integration/suites/cleanup_after_converge/cleanup_test.go b/integration/suites/cleanup_after_converge/cleanup_test.go index 7e451c63bb..adc273e73f 100644 --- a/integration/suites/cleanup_after_converge/cleanup_test.go +++ b/integration/suites/cleanup_after_converge/cleanup_test.go @@ -65,7 +65,7 @@ var _ = Describe("cleaning images and stages", func() { "--set", fmt.Sprintf("imageCredentials.username=%s", os.Getenv("WERF_TEST_K8S_DOCKER_REGISTRY_USERNAME")), "--set", fmt.Sprintf("imageCredentials.password=%s", os.Getenv("WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD")), ) - werfArgs = append(werfArgs, "--skip-build") + werfArgs = append(werfArgs, "--require-built-images") if useCustomTag { werfArgs = append(werfArgs, "--use-custom-tag", useCustomTagValue) diff --git a/integration/suites/deploy/custom_tag_test.go b/integration/suites/deploy/custom_tag_test.go index 6338f91508..ef7b584324 100644 --- a/integration/suites/deploy/custom_tag_test.go +++ b/integration/suites/deploy/custom_tag_test.go @@ -103,7 +103,7 @@ var _ = Describe("custom tag", func() { "--set", fmt.Sprintf("imageCredentials.password=%s", os.Getenv("WERF_TEST_K8S_DOCKER_REGISTRY_PASSWORD")), ) werfArgs = append(werfArgs, "--use-custom-tag", customTagValue) - werfArgs = append(werfArgs, "--skip-build") + werfArgs = append(werfArgs, "--require-built-images") bytes, err := utils.RunCommand( SuiteData.GetProjectWorktree(SuiteData.ProjectName), diff --git a/integration/suites/giterminism/config_dockerfile_test.go b/integration/suites/giterminism/config_dockerfile_test.go index 518ef3bcf0..c56c8eb7f8 100644 --- a/integration/suites/giterminism/config_dockerfile_test.go +++ b/integration/suites/giterminism/config_dockerfile_test.go @@ -130,7 +130,7 @@ config: output, err := utils.RunCommand( SuiteData.TestDirPath, SuiteData.WerfBinPath, - "run", "--skip-build", + "run", "--require-built-images", ) Ω(err).Should(HaveOccurred()) @@ -255,7 +255,7 @@ config: output, err := utils.RunCommand( SuiteData.TestDirPath, SuiteData.WerfBinPath, - "run", "--skip-build", + "run", "--require-built-images", ) Ω(err).Should(HaveOccurred()) @@ -377,7 +377,7 @@ config: output, err := utils.RunCommand( SuiteData.TestDirPath, SuiteData.WerfBinPath, - "run", "--skip-build", + "run", "--require-built-images", ) Ω(err).Should(HaveOccurred())