github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/cmd/helmExecute_generated.go (about)

     1  // Code generated by piper's step-generator. DO NOT EDIT.
     2  
     3  package cmd
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"path/filepath"
     9  	"time"
    10  
    11  	"github.com/SAP/jenkins-library/pkg/config"
    12  	"github.com/SAP/jenkins-library/pkg/log"
    13  	"github.com/SAP/jenkins-library/pkg/piperenv"
    14  	"github.com/SAP/jenkins-library/pkg/splunk"
    15  	"github.com/SAP/jenkins-library/pkg/telemetry"
    16  	"github.com/SAP/jenkins-library/pkg/validation"
    17  	"github.com/spf13/cobra"
    18  )
    19  
    20  type helmExecuteOptions struct {
    21  	AdditionalParameters      []string `json:"additionalParameters,omitempty"`
    22  	ChartPath                 string   `json:"chartPath,omitempty"`
    23  	TargetRepositoryURL       string   `json:"targetRepositoryURL,omitempty"`
    24  	TargetRepositoryName      string   `json:"targetRepositoryName,omitempty"`
    25  	TargetRepositoryUser      string   `json:"targetRepositoryUser,omitempty"`
    26  	TargetRepositoryPassword  string   `json:"targetRepositoryPassword,omitempty"`
    27  	SourceRepositoryURL       string   `json:"sourceRepositoryURL,omitempty"`
    28  	SourceRepositoryName      string   `json:"sourceRepositoryName,omitempty"`
    29  	SourceRepositoryUser      string   `json:"sourceRepositoryUser,omitempty"`
    30  	SourceRepositoryPassword  string   `json:"sourceRepositoryPassword,omitempty"`
    31  	HelmDeployWaitSeconds     int      `json:"helmDeployWaitSeconds,omitempty"`
    32  	HelmValues                []string `json:"helmValues,omitempty"`
    33  	Image                     string   `json:"image,omitempty"`
    34  	KeepFailedDeployments     bool     `json:"keepFailedDeployments,omitempty"`
    35  	KubeConfig                string   `json:"kubeConfig,omitempty"`
    36  	KubeContext               string   `json:"kubeContext,omitempty"`
    37  	Namespace                 string   `json:"namespace,omitempty"`
    38  	DockerConfigJSON          string   `json:"dockerConfigJSON,omitempty"`
    39  	HelmCommand               string   `json:"helmCommand,omitempty" validate:"possible-values=upgrade lint install test uninstall dependency publish"`
    40  	AppVersion                string   `json:"appVersion,omitempty"`
    41  	Dependency                string   `json:"dependency,omitempty" validate:"possible-values=build list update"`
    42  	PackageDependencyUpdate   bool     `json:"packageDependencyUpdate,omitempty"`
    43  	DumpLogs                  bool     `json:"dumpLogs,omitempty"`
    44  	FilterTest                string   `json:"filterTest,omitempty"`
    45  	CustomTLSCertificateLinks []string `json:"customTlsCertificateLinks,omitempty"`
    46  	Publish                   bool     `json:"publish,omitempty"`
    47  	Version                   string   `json:"version,omitempty"`
    48  	RenderSubchartNotes       bool     `json:"renderSubchartNotes,omitempty"`
    49  	TemplateStartDelimiter    string   `json:"templateStartDelimiter,omitempty"`
    50  	TemplateEndDelimiter      string   `json:"templateEndDelimiter,omitempty"`
    51  	RenderValuesTemplate      bool     `json:"renderValuesTemplate,omitempty"`
    52  }
    53  
    54  type helmExecuteCommonPipelineEnvironment struct {
    55  	custom struct {
    56  		helmChartURL string
    57  	}
    58  }
    59  
    60  func (p *helmExecuteCommonPipelineEnvironment) persist(path, resourceName string) {
    61  	content := []struct {
    62  		category string
    63  		name     string
    64  		value    interface{}
    65  	}{
    66  		{category: "custom", name: "helmChartUrl", value: p.custom.helmChartURL},
    67  	}
    68  
    69  	errCount := 0
    70  	for _, param := range content {
    71  		err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value)
    72  		if err != nil {
    73  			log.Entry().WithError(err).Error("Error persisting piper environment.")
    74  			errCount++
    75  		}
    76  	}
    77  	if errCount > 0 {
    78  		log.Entry().Error("failed to persist Piper environment")
    79  	}
    80  }
    81  
    82  // HelmExecuteCommand Executes helm3 functionality as the package manager for Kubernetes.
    83  func HelmExecuteCommand() *cobra.Command {
    84  	const STEP_NAME = "helmExecute"
    85  
    86  	metadata := helmExecuteMetadata()
    87  	var stepConfig helmExecuteOptions
    88  	var startTime time.Time
    89  	var commonPipelineEnvironment helmExecuteCommonPipelineEnvironment
    90  	var logCollector *log.CollectorHook
    91  	var splunkClient *splunk.Splunk
    92  	telemetryClient := &telemetry.Telemetry{}
    93  
    94  	var createHelmExecuteCmd = &cobra.Command{
    95  		Use:   STEP_NAME,
    96  		Short: "Executes helm3 functionality as the package manager for Kubernetes.",
    97  		Long: `Alpha version: please expect incompatible changes
    98  
    99  Executes helm functionality as the package manager for Kubernetes.
   100  
   101  * [Helm](https://helm.sh/)  is the package manager for Kubernetes.
   102  * [Helm documentation https://helm.sh/docs/intro/using_helm/ and best practies https://helm.sh/docs/chart_best_practices/conventions/]
   103  * [Helm Charts] (https://artifacthub.io/)
   104  ` + "`" + `` + "`" + `` + "`" + `
   105  Available Commands:
   106  ` + "`" + `upgrade` + "`" + `, ` + "`" + `lint` + "`" + `, ` + "`" + `install` + "`" + `, ` + "`" + `test` + "`" + `, ` + "`" + `uninstall` + "`" + `, ` + "`" + `dependency` + "`" + `, ` + "`" + `publish` + "`" + `
   107  
   108    upgrade       upgrade a release
   109    lint          examine a chart for possible issues
   110    install       install a chart
   111    test          run tests for a release
   112    uninstall     uninstall a release
   113    dependency     package a chart directory into a chart archive
   114    publish       package and puslish a release
   115  
   116  ` + "`" + `` + "`" + `` + "`" + `
   117  
   118  Note: piper supports only helm3 version, since helm2 is deprecated.`,
   119  		PreRunE: func(cmd *cobra.Command, _ []string) error {
   120  			startTime = time.Now()
   121  			log.SetStepName(STEP_NAME)
   122  			log.SetVerbose(GeneralConfig.Verbose)
   123  
   124  			GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens)
   125  
   126  			path, _ := os.Getwd()
   127  			fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
   128  			log.RegisterHook(fatalHook)
   129  
   130  			err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
   131  			if err != nil {
   132  				log.SetErrorCategory(log.ErrorConfiguration)
   133  				return err
   134  			}
   135  			log.RegisterSecret(stepConfig.TargetRepositoryUser)
   136  			log.RegisterSecret(stepConfig.TargetRepositoryPassword)
   137  			log.RegisterSecret(stepConfig.SourceRepositoryUser)
   138  			log.RegisterSecret(stepConfig.SourceRepositoryPassword)
   139  			log.RegisterSecret(stepConfig.KubeConfig)
   140  			log.RegisterSecret(stepConfig.DockerConfigJSON)
   141  
   142  			if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
   143  				sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
   144  				log.RegisterHook(&sentryHook)
   145  			}
   146  
   147  			if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   148  				splunkClient = &splunk.Splunk{}
   149  				logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
   150  				log.RegisterHook(logCollector)
   151  			}
   152  
   153  			if err = log.RegisterANSHookIfConfigured(GeneralConfig.CorrelationID); err != nil {
   154  				log.Entry().WithError(err).Warn("failed to set up SAP Alert Notification Service log hook")
   155  			}
   156  
   157  			validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages())
   158  			if err != nil {
   159  				return err
   160  			}
   161  			if err = validation.ValidateStruct(stepConfig); err != nil {
   162  				log.SetErrorCategory(log.ErrorConfiguration)
   163  				return err
   164  			}
   165  
   166  			return nil
   167  		},
   168  		Run: func(_ *cobra.Command, _ []string) {
   169  			stepTelemetryData := telemetry.CustomData{}
   170  			stepTelemetryData.ErrorCode = "1"
   171  			handler := func() {
   172  				commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment")
   173  				config.RemoveVaultSecretFiles()
   174  				stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
   175  				stepTelemetryData.ErrorCategory = log.GetErrorCategory().String()
   176  				stepTelemetryData.PiperCommitHash = GitCommit
   177  				telemetryClient.SetData(&stepTelemetryData)
   178  				telemetryClient.Send()
   179  				if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
   180  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   181  						GeneralConfig.HookConfig.SplunkConfig.Dsn,
   182  						GeneralConfig.HookConfig.SplunkConfig.Token,
   183  						GeneralConfig.HookConfig.SplunkConfig.Index,
   184  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   185  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   186  				}
   187  				if len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 {
   188  					splunkClient.Initialize(GeneralConfig.CorrelationID,
   189  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint,
   190  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblToken,
   191  						GeneralConfig.HookConfig.SplunkConfig.ProdCriblIndex,
   192  						GeneralConfig.HookConfig.SplunkConfig.SendLogs)
   193  					splunkClient.Send(telemetryClient.GetData(), logCollector)
   194  				}
   195  			}
   196  			log.DeferExitHandler(handler)
   197  			defer handler()
   198  			telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
   199  			helmExecute(stepConfig, &stepTelemetryData, &commonPipelineEnvironment)
   200  			stepTelemetryData.ErrorCode = "0"
   201  			log.Entry().Info("SUCCESS")
   202  		},
   203  	}
   204  
   205  	addHelmExecuteFlags(createHelmExecuteCmd, &stepConfig)
   206  	return createHelmExecuteCmd
   207  }
   208  
   209  func addHelmExecuteFlags(cmd *cobra.Command, stepConfig *helmExecuteOptions) {
   210  	cmd.Flags().StringSliceVar(&stepConfig.AdditionalParameters, "additionalParameters", []string{}, "Defines additional parameters for Helm like  \"helm install [NAME] [CHART] [flags]\".")
   211  	cmd.Flags().StringVar(&stepConfig.ChartPath, "chartPath", os.Getenv("PIPER_chartPath"), "Defines the chart path for helm. chartPath is mandatory for install/upgrade/publish commands.")
   212  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryURL, "targetRepositoryURL", os.Getenv("PIPER_targetRepositoryURL"), "URL of the target repository where the compiled helm .tgz archive shall be uploaded - typically provided by the CI/CD environment.")
   213  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryName, "targetRepositoryName", os.Getenv("PIPER_targetRepositoryName"), "set the chart repository. The value is required for install/upgrade/uninstall commands.")
   214  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryUser, "targetRepositoryUser", os.Getenv("PIPER_targetRepositoryUser"), "Username for the chart repository where the compiled helm .tgz archive shall be uploaded - typically provided by the CI/CD environment.")
   215  	cmd.Flags().StringVar(&stepConfig.TargetRepositoryPassword, "targetRepositoryPassword", os.Getenv("PIPER_targetRepositoryPassword"), "Password for the target repository where the compiled helm .tgz archive shall be uploaded - typically provided by the CI/CD environment.")
   216  	cmd.Flags().StringVar(&stepConfig.SourceRepositoryURL, "sourceRepositoryURL", os.Getenv("PIPER_sourceRepositoryURL"), "URL of the source repository where the dependencies can be downloaded.")
   217  	cmd.Flags().StringVar(&stepConfig.SourceRepositoryName, "sourceRepositoryName", os.Getenv("PIPER_sourceRepositoryName"), "Set the name of the chart repository. The value might be required for fetching dependencies.")
   218  	cmd.Flags().StringVar(&stepConfig.SourceRepositoryUser, "sourceRepositoryUser", os.Getenv("PIPER_sourceRepositoryUser"), "Username for the chart repository for fetching the dependencies.")
   219  	cmd.Flags().StringVar(&stepConfig.SourceRepositoryPassword, "sourceRepositoryPassword", os.Getenv("PIPER_sourceRepositoryPassword"), "Password for the chart repository for fetching the dependencies.")
   220  	cmd.Flags().IntVar(&stepConfig.HelmDeployWaitSeconds, "helmDeployWaitSeconds", 300, "Number of seconds before helm deploy returns.")
   221  	cmd.Flags().StringSliceVar(&stepConfig.HelmValues, "helmValues", []string{}, "List of helm values as YAML file reference or URL (as per helm parameter description for `-f` / `--values`)")
   222  	cmd.Flags().StringVar(&stepConfig.Image, "image", os.Getenv("PIPER_image"), "Full name of the image to be deployed.")
   223  	cmd.Flags().BoolVar(&stepConfig.KeepFailedDeployments, "keepFailedDeployments", false, "Defines whether a failed deployment will be purged")
   224  	cmd.Flags().StringVar(&stepConfig.KubeConfig, "kubeConfig", os.Getenv("PIPER_kubeConfig"), "Defines the path to the \"kubeconfig\" file.")
   225  	cmd.Flags().StringVar(&stepConfig.KubeContext, "kubeContext", os.Getenv("PIPER_kubeContext"), "Defines the context to use from the \"kubeconfig\" file.")
   226  	cmd.Flags().StringVar(&stepConfig.Namespace, "namespace", `default`, "Defines the target Kubernetes namespace for the deployment.")
   227  	cmd.Flags().StringVar(&stepConfig.DockerConfigJSON, "dockerConfigJSON", os.Getenv("PIPER_dockerConfigJSON"), "Path to the file `.docker/config.json` - this is typically provided by your CI/CD system. You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).")
   228  	cmd.Flags().StringVar(&stepConfig.HelmCommand, "helmCommand", os.Getenv("PIPER_helmCommand"), "Helm: defines the command `upgrade`, `lint`, `install`, `test`, `uninstall`, `dependency`, `publish`.")
   229  	cmd.Flags().StringVar(&stepConfig.AppVersion, "appVersion", os.Getenv("PIPER_appVersion"), "set the appVersion on the chart to this version")
   230  	cmd.Flags().StringVar(&stepConfig.Dependency, "dependency", os.Getenv("PIPER_dependency"), "manage a chart's dependencies")
   231  	cmd.Flags().BoolVar(&stepConfig.PackageDependencyUpdate, "packageDependencyUpdate", false, "update dependencies from \"Chart.yaml\" to dir \"charts/\" before packaging")
   232  	cmd.Flags().BoolVar(&stepConfig.DumpLogs, "dumpLogs", false, "dump the logs from test pods (this runs after all tests are complete, but before any cleanup)")
   233  	cmd.Flags().StringVar(&stepConfig.FilterTest, "filterTest", os.Getenv("PIPER_filterTest"), "specify tests by attribute (currently `name`) using attribute=value syntax or `!attribute=value` to exclude a test (can specify multiple or separate values with commas `name=test1,name=test2`)")
   234  	cmd.Flags().StringSliceVar(&stepConfig.CustomTLSCertificateLinks, "customTlsCertificateLinks", []string{}, "List of download links to custom TLS certificates. This is required to ensure trusted connections to instances with repositories (like nexus) when publish flag is set to true.")
   235  	cmd.Flags().BoolVar(&stepConfig.Publish, "publish", false, "Configures helm to run the deploy command to publish artifacts to a repository.")
   236  	cmd.Flags().StringVar(&stepConfig.Version, "version", os.Getenv("PIPER_version"), "Defines the artifact version to use from helm package/publish commands.")
   237  	cmd.Flags().BoolVar(&stepConfig.RenderSubchartNotes, "renderSubchartNotes", true, "If set, render subchart notes along with the parent.")
   238  	cmd.Flags().StringVar(&stepConfig.TemplateStartDelimiter, "templateStartDelimiter", `{{`, "When templating value files, use this start delimiter.")
   239  	cmd.Flags().StringVar(&stepConfig.TemplateEndDelimiter, "templateEndDelimiter", `}}`, "When templating value files, use this end delimiter.")
   240  	cmd.Flags().BoolVar(&stepConfig.RenderValuesTemplate, "renderValuesTemplate", true, "A flag to turn templating value files on or off.")
   241  
   242  	cmd.MarkFlagRequired("image")
   243  }
   244  
   245  // retrieve step metadata
   246  func helmExecuteMetadata() config.StepData {
   247  	var theMetaData = config.StepData{
   248  		Metadata: config.StepMetadata{
   249  			Name:        "helmExecute",
   250  			Aliases:     []config.Alias{},
   251  			Description: "Executes helm3 functionality as the package manager for Kubernetes.",
   252  		},
   253  		Spec: config.StepSpec{
   254  			Inputs: config.StepInputs{
   255  				Secrets: []config.StepSecrets{
   256  					{Name: "kubeConfigFileCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing kubeconfig file. Details can be found in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).", Type: "jenkins", Aliases: []config.Alias{{Name: "kubeCredentialsId", Deprecated: true}}},
   257  					{Name: "dockerConfigJsonCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing Docker config.json (with registry credential(s)).", Type: "jenkins"},
   258  					{Name: "sourceRepositoryCredentialsId", Description: "Jenkins 'Username Password' credentials ID containing username and password for the Helm Repository authentication (source repo)", Type: "jenkins"},
   259  					{Name: "targetRepositoryCredentialsId", Description: "Jenkins 'Username Password' credentials ID containing username and password for the Helm Repository authentication (target repo)", Type: "jenkins"},
   260  				},
   261  				Resources: []config.StepResources{
   262  					{Name: "deployDescriptor", Type: "stash"},
   263  				},
   264  				Parameters: []config.StepParameters{
   265  					{
   266  						Name:        "additionalParameters",
   267  						ResourceRef: []config.ResourceReference{},
   268  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   269  						Type:        "[]string",
   270  						Mandatory:   false,
   271  						Aliases:     []config.Alias{{Name: "helmDeploymentParameters"}},
   272  						Default:     []string{},
   273  					},
   274  					{
   275  						Name:        "chartPath",
   276  						ResourceRef: []config.ResourceReference{},
   277  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   278  						Type:        "string",
   279  						Mandatory:   false,
   280  						Aliases:     []config.Alias{{Name: "helmChartPath"}},
   281  						Default:     os.Getenv("PIPER_chartPath"),
   282  					},
   283  					{
   284  						Name: "targetRepositoryURL",
   285  						ResourceRef: []config.ResourceReference{
   286  							{
   287  								Name:  "commonPipelineEnvironment",
   288  								Param: "custom/helmRepositoryURL",
   289  							},
   290  
   291  							{
   292  								Name:  "commonPipelineEnvironment",
   293  								Param: "custom/repositoryUrl",
   294  							},
   295  						},
   296  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   297  						Type:      "string",
   298  						Mandatory: false,
   299  						Aliases:   []config.Alias{},
   300  						Default:   os.Getenv("PIPER_targetRepositoryURL"),
   301  					},
   302  					{
   303  						Name:        "targetRepositoryName",
   304  						ResourceRef: []config.ResourceReference{},
   305  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   306  						Type:        "string",
   307  						Mandatory:   false,
   308  						Aliases:     []config.Alias{},
   309  						Default:     os.Getenv("PIPER_targetRepositoryName"),
   310  					},
   311  					{
   312  						Name: "targetRepositoryUser",
   313  						ResourceRef: []config.ResourceReference{
   314  							{
   315  								Name:  "targetRepositoryCredentialsId",
   316  								Param: "username",
   317  								Type:  "secret",
   318  							},
   319  
   320  							{
   321  								Name:    "targetRepositoryUserSecretName",
   322  								Type:    "vaultSecret",
   323  								Default: "publishing",
   324  							},
   325  
   326  							{
   327  								Name:  "commonPipelineEnvironment",
   328  								Param: "custom/helmRepositoryUsername",
   329  							},
   330  
   331  							{
   332  								Name:  "commonPipelineEnvironment",
   333  								Param: "custom/repositoryUsername",
   334  							},
   335  						},
   336  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   337  						Type:      "string",
   338  						Mandatory: false,
   339  						Aliases:   []config.Alias{{Name: "helmRepositoryUsername"}},
   340  						Default:   os.Getenv("PIPER_targetRepositoryUser"),
   341  					},
   342  					{
   343  						Name: "targetRepositoryPassword",
   344  						ResourceRef: []config.ResourceReference{
   345  							{
   346  								Name:  "targetRepositoryCredentialsId",
   347  								Param: "password",
   348  								Type:  "secret",
   349  							},
   350  
   351  							{
   352  								Name:    "targetRepositoryPasswordSecret",
   353  								Type:    "vaultSecret",
   354  								Default: "publishing",
   355  							},
   356  
   357  							{
   358  								Name:  "commonPipelineEnvironment",
   359  								Param: "custom/helmRepositoryPassword",
   360  							},
   361  
   362  							{
   363  								Name:  "commonPipelineEnvironment",
   364  								Param: "custom/repositoryPassword",
   365  							},
   366  						},
   367  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   368  						Type:      "string",
   369  						Mandatory: false,
   370  						Aliases:   []config.Alias{{Name: "helmRepositoryPassword"}},
   371  						Default:   os.Getenv("PIPER_targetRepositoryPassword"),
   372  					},
   373  					{
   374  						Name:        "sourceRepositoryURL",
   375  						ResourceRef: []config.ResourceReference{},
   376  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   377  						Type:        "string",
   378  						Mandatory:   false,
   379  						Aliases:     []config.Alias{},
   380  						Default:     os.Getenv("PIPER_sourceRepositoryURL"),
   381  					},
   382  					{
   383  						Name:        "sourceRepositoryName",
   384  						ResourceRef: []config.ResourceReference{},
   385  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   386  						Type:        "string",
   387  						Mandatory:   false,
   388  						Aliases:     []config.Alias{},
   389  						Default:     os.Getenv("PIPER_sourceRepositoryName"),
   390  					},
   391  					{
   392  						Name: "sourceRepositoryUser",
   393  						ResourceRef: []config.ResourceReference{
   394  							{
   395  								Name:  "sourceRepositoryCredentialsId",
   396  								Param: "username",
   397  								Type:  "secret",
   398  							},
   399  
   400  							{
   401  								Name:    "sourceRepositoryUserSecretName",
   402  								Type:    "vaultSecret",
   403  								Default: "dependencies",
   404  							},
   405  						},
   406  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   407  						Type:      "string",
   408  						Mandatory: false,
   409  						Aliases:   []config.Alias{},
   410  						Default:   os.Getenv("PIPER_sourceRepositoryUser"),
   411  					},
   412  					{
   413  						Name: "sourceRepositoryPassword",
   414  						ResourceRef: []config.ResourceReference{
   415  							{
   416  								Name:  "sourceRepositoryCredentialsId",
   417  								Param: "password",
   418  								Type:  "secret",
   419  							},
   420  
   421  							{
   422  								Name:    "sourceRepositoryPasswordSecret",
   423  								Type:    "vaultSecret",
   424  								Default: "dependencies",
   425  							},
   426  						},
   427  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   428  						Type:      "string",
   429  						Mandatory: false,
   430  						Aliases:   []config.Alias{},
   431  						Default:   os.Getenv("PIPER_sourceRepositoryPassword"),
   432  					},
   433  					{
   434  						Name:        "helmDeployWaitSeconds",
   435  						ResourceRef: []config.ResourceReference{},
   436  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   437  						Type:        "int",
   438  						Mandatory:   false,
   439  						Aliases:     []config.Alias{},
   440  						Default:     300,
   441  					},
   442  					{
   443  						Name:        "helmValues",
   444  						ResourceRef: []config.ResourceReference{},
   445  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   446  						Type:        "[]string",
   447  						Mandatory:   false,
   448  						Aliases:     []config.Alias{},
   449  						Default:     []string{},
   450  					},
   451  					{
   452  						Name: "image",
   453  						ResourceRef: []config.ResourceReference{
   454  							{
   455  								Name:  "commonPipelineEnvironment",
   456  								Param: "container/imageNameTag",
   457  							},
   458  						},
   459  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   460  						Type:      "string",
   461  						Mandatory: true,
   462  						Aliases:   []config.Alias{{Name: "deployImage"}},
   463  						Default:   os.Getenv("PIPER_image"),
   464  					},
   465  					{
   466  						Name:        "keepFailedDeployments",
   467  						ResourceRef: []config.ResourceReference{},
   468  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   469  						Type:        "bool",
   470  						Mandatory:   false,
   471  						Aliases:     []config.Alias{},
   472  						Default:     false,
   473  					},
   474  					{
   475  						Name: "kubeConfig",
   476  						ResourceRef: []config.ResourceReference{
   477  							{
   478  								Name: "kubeConfigFileCredentialsId",
   479  								Type: "secret",
   480  							},
   481  
   482  							{
   483  								Name:    "kubeConfigFileVaultSecretName",
   484  								Type:    "vaultSecretFile",
   485  								Default: "kube-config",
   486  							},
   487  						},
   488  						Scope:     []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   489  						Type:      "string",
   490  						Mandatory: false,
   491  						Aliases:   []config.Alias{},
   492  						Default:   os.Getenv("PIPER_kubeConfig"),
   493  					},
   494  					{
   495  						Name:        "kubeContext",
   496  						ResourceRef: []config.ResourceReference{},
   497  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   498  						Type:        "string",
   499  						Mandatory:   false,
   500  						Aliases:     []config.Alias{},
   501  						Default:     os.Getenv("PIPER_kubeContext"),
   502  					},
   503  					{
   504  						Name:        "namespace",
   505  						ResourceRef: []config.ResourceReference{},
   506  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   507  						Type:        "string",
   508  						Mandatory:   false,
   509  						Aliases:     []config.Alias{{Name: "helmDeploymentNamespace"}},
   510  						Default:     `default`,
   511  					},
   512  					{
   513  						Name: "dockerConfigJSON",
   514  						ResourceRef: []config.ResourceReference{
   515  							{
   516  								Name: "dockerConfigJsonCredentialsId",
   517  								Type: "secret",
   518  							},
   519  
   520  							{
   521  								Name:    "dockerConfigFileVaultSecretName",
   522  								Type:    "vaultSecretFile",
   523  								Default: "docker-config",
   524  							},
   525  						},
   526  						Scope:     []string{"PARAMETERS", "STAGES", "STEPS"},
   527  						Type:      "string",
   528  						Mandatory: false,
   529  						Aliases:   []config.Alias{},
   530  						Default:   os.Getenv("PIPER_dockerConfigJSON"),
   531  					},
   532  					{
   533  						Name:        "helmCommand",
   534  						ResourceRef: []config.ResourceReference{},
   535  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   536  						Type:        "string",
   537  						Mandatory:   false,
   538  						Aliases:     []config.Alias{},
   539  						Default:     os.Getenv("PIPER_helmCommand"),
   540  					},
   541  					{
   542  						Name:        "appVersion",
   543  						ResourceRef: []config.ResourceReference{},
   544  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   545  						Type:        "string",
   546  						Mandatory:   false,
   547  						Aliases:     []config.Alias{},
   548  						Default:     os.Getenv("PIPER_appVersion"),
   549  					},
   550  					{
   551  						Name:        "dependency",
   552  						ResourceRef: []config.ResourceReference{},
   553  						Scope:       []string{"PARAMETERS", "STAGES", "STEPS"},
   554  						Type:        "string",
   555  						Mandatory:   false,
   556  						Aliases:     []config.Alias{},
   557  						Default:     os.Getenv("PIPER_dependency"),
   558  					},
   559  					{
   560  						Name:        "packageDependencyUpdate",
   561  						ResourceRef: []config.ResourceReference{},
   562  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   563  						Type:        "bool",
   564  						Mandatory:   false,
   565  						Aliases:     []config.Alias{},
   566  						Default:     false,
   567  					},
   568  					{
   569  						Name:        "dumpLogs",
   570  						ResourceRef: []config.ResourceReference{},
   571  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   572  						Type:        "bool",
   573  						Mandatory:   false,
   574  						Aliases:     []config.Alias{},
   575  						Default:     false,
   576  					},
   577  					{
   578  						Name:        "filterTest",
   579  						ResourceRef: []config.ResourceReference{},
   580  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   581  						Type:        "string",
   582  						Mandatory:   false,
   583  						Aliases:     []config.Alias{},
   584  						Default:     os.Getenv("PIPER_filterTest"),
   585  					},
   586  					{
   587  						Name:        "customTlsCertificateLinks",
   588  						ResourceRef: []config.ResourceReference{},
   589  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   590  						Type:        "[]string",
   591  						Mandatory:   false,
   592  						Aliases:     []config.Alias{},
   593  						Default:     []string{},
   594  					},
   595  					{
   596  						Name:        "publish",
   597  						ResourceRef: []config.ResourceReference{},
   598  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   599  						Type:        "bool",
   600  						Mandatory:   false,
   601  						Aliases:     []config.Alias{},
   602  						Default:     false,
   603  					},
   604  					{
   605  						Name:        "version",
   606  						ResourceRef: []config.ResourceReference{},
   607  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   608  						Type:        "string",
   609  						Mandatory:   false,
   610  						Aliases:     []config.Alias{},
   611  						Default:     os.Getenv("PIPER_version"),
   612  					},
   613  					{
   614  						Name:        "renderSubchartNotes",
   615  						ResourceRef: []config.ResourceReference{},
   616  						Scope:       []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
   617  						Type:        "bool",
   618  						Mandatory:   false,
   619  						Aliases:     []config.Alias{},
   620  						Default:     true,
   621  					},
   622  					{
   623  						Name:        "templateStartDelimiter",
   624  						ResourceRef: []config.ResourceReference{},
   625  						Scope:       []string{"STEPS", "PARAMETERS"},
   626  						Type:        "string",
   627  						Mandatory:   false,
   628  						Aliases:     []config.Alias{},
   629  						Default:     `{{`,
   630  					},
   631  					{
   632  						Name:        "templateEndDelimiter",
   633  						ResourceRef: []config.ResourceReference{},
   634  						Scope:       []string{"STEPS", "PARAMETERS"},
   635  						Type:        "string",
   636  						Mandatory:   false,
   637  						Aliases:     []config.Alias{},
   638  						Default:     `}}`,
   639  					},
   640  					{
   641  						Name:        "renderValuesTemplate",
   642  						ResourceRef: []config.ResourceReference{},
   643  						Scope:       []string{"STEPS", "PARAMETERS"},
   644  						Type:        "bool",
   645  						Mandatory:   false,
   646  						Aliases:     []config.Alias{},
   647  						Default:     true,
   648  					},
   649  				},
   650  			},
   651  			Containers: []config.Container{
   652  				{Image: "dtzar/helm-kubectl:3", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}},
   653  			},
   654  			Outputs: config.StepOutputs{
   655  				Resources: []config.StepResources{
   656  					{
   657  						Name: "commonPipelineEnvironment",
   658  						Type: "piperEnvironment",
   659  						Parameters: []map[string]interface{}{
   660  							{"name": "custom/helmChartUrl"},
   661  						},
   662  					},
   663  				},
   664  			},
   665  		},
   666  	}
   667  	return theMetaData
   668  }