Skip to content

Commit

Permalink
feat(v2): remove --...-implementation flags
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Apr 24, 2024
1 parent 5960147 commit 82b548f
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions cmd/werf/common/repo_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/spf13/cobra"

"github.com/werf/logboek"
"github.com/werf/werf/v2/pkg/container_backend"
"github.com/werf/werf/v2/pkg/docker_registry"
"github.com/werf/werf/v2/pkg/storage"
Expand Down Expand Up @@ -112,16 +111,11 @@ func (d *RepoData) GetContainerRegistry(ctx context.Context) string {
return ""
}

switch {
case *d.ContainerRegistry != "":
if *d.ContainerRegistry != "" {
return *d.ContainerRegistry
case *d.Implementation != "":
repoNameUpper := strings.ToUpper(strings.ReplaceAll(d.Name, "-", "_"))
logboek.Context(ctx).Warn().LogF("DEPRECATION WARNING: The option --%s-implementation ($WERF_%s_IMPLEMENTATION) is renamed to --%s-container-registry ($WERF_%s_CONTAINER_REGISTRY) and will be removed in v1.3!", d.Name, repoNameUpper, d.Name, repoNameUpper)
return *d.Implementation
default:
return ""
}

return ""
}

func (d *RepoData) GetDockerRegistryOptions(insecureRegistry, skipTlsVerifyRegistry bool) docker_registry.DockerRegistryOptions {
Expand Down Expand Up @@ -162,7 +156,6 @@ func (repoData *RepoData) SetupCmd(cmd *cobra.Command) {
return
}

repoData.SetupImplementationForRepoData(cmd, makeOpt("implementation"), []string{makeEnvVar("IMPLEMENTATION")}) // legacy
repoData.SetupContainerRegistryForRepoData(cmd, makeOpt("container-registry"), []string{makeEnvVar("CONTAINER_REGISTRY")})
repoData.SetupDockerHubUsernameForRepoData(cmd, makeOpt("docker-hub-username"), []string{makeEnvVar("DOCKER_HUB_USERNAME")})
repoData.SetupDockerHubPasswordForRepoData(cmd, makeOpt("docker-hub-password"), []string{makeEnvVar("DOCKER_HUB_PASSWORD")})
Expand Down Expand Up @@ -240,19 +233,6 @@ func (repoData *RepoData) SetupAddressForRepoData(cmd *cobra.Command, paramName
)
}

// legacy
func (repoData *RepoData) SetupImplementationForRepoData(cmd *cobra.Command, paramName string, paramEnvNames []string) {
repoData.Implementation = new(string)
cmd.Flags().StringVarP(
repoData.Implementation,
paramName,
"",
getDefaultValueByParamEnvNames(paramEnvNames),
"",
)
cmd.Flag(paramName).Hidden = true
}

func (repoData *RepoData) SetupContainerRegistryForRepoData(cmd *cobra.Command, paramName string, paramEnvNames []string) {
usageTitle := fmt.Sprintf("Choose %s container registry implementation", repoData.Name)

Expand Down

0 comments on commit 82b548f

Please sign in to comment.