github.com/SAP/jenkins-library@v1.362.0/cmd/kubernetesDeploy_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 "time" 9 10 "github.com/SAP/jenkins-library/pkg/config" 11 "github.com/SAP/jenkins-library/pkg/log" 12 "github.com/SAP/jenkins-library/pkg/splunk" 13 "github.com/SAP/jenkins-library/pkg/telemetry" 14 "github.com/SAP/jenkins-library/pkg/validation" 15 "github.com/spf13/cobra" 16 ) 17 18 type kubernetesDeployOptions struct { 19 AdditionalParameters []string `json:"additionalParameters,omitempty"` 20 APIServer string `json:"apiServer,omitempty"` 21 AppTemplate string `json:"appTemplate,omitempty"` 22 ChartPath string `json:"chartPath,omitempty"` 23 ContainerRegistryPassword string `json:"containerRegistryPassword,omitempty"` 24 ContainerImageName string `json:"containerImageName,omitempty"` 25 ContainerImageTag string `json:"containerImageTag,omitempty"` 26 ContainerRegistryURL string `json:"containerRegistryUrl,omitempty"` 27 ContainerRegistryUser string `json:"containerRegistryUser,omitempty"` 28 ContainerRegistrySecret string `json:"containerRegistrySecret,omitempty"` 29 CreateDockerRegistrySecret bool `json:"createDockerRegistrySecret,omitempty"` 30 DeploymentName string `json:"deploymentName,omitempty"` 31 DeployTool string `json:"deployTool,omitempty" validate:"possible-values=kubectl helm helm3"` 32 ForceUpdates bool `json:"forceUpdates,omitempty"` 33 HelmDeployWaitSeconds int `json:"helmDeployWaitSeconds,omitempty"` 34 HelmTestWaitSeconds int `json:"helmTestWaitSeconds,omitempty"` 35 HelmValues []string `json:"helmValues,omitempty"` 36 ValuesMapping map[string]interface{} `json:"valuesMapping,omitempty"` 37 RenderSubchartNotes bool `json:"renderSubchartNotes,omitempty"` 38 GithubToken string `json:"githubToken,omitempty"` 39 Image string `json:"image,omitempty"` 40 ImageNames []string `json:"imageNames,omitempty"` 41 ImageNameTags []string `json:"imageNameTags,omitempty"` 42 ImageDigests []string `json:"imageDigests,omitempty"` 43 IngressHosts []string `json:"ingressHosts,omitempty"` 44 KeepFailedDeployments bool `json:"keepFailedDeployments,omitempty"` 45 RunHelmTests bool `json:"runHelmTests,omitempty"` 46 ShowTestLogs bool `json:"showTestLogs,omitempty"` 47 KubeConfig string `json:"kubeConfig,omitempty"` 48 KubeContext string `json:"kubeContext,omitempty"` 49 KubeToken string `json:"kubeToken,omitempty"` 50 Namespace string `json:"namespace,omitempty"` 51 TillerNamespace string `json:"tillerNamespace,omitempty"` 52 DockerConfigJSON string `json:"dockerConfigJSON,omitempty"` 53 DeployCommand string `json:"deployCommand,omitempty" validate:"possible-values=apply replace"` 54 SetupScript string `json:"setupScript,omitempty"` 55 VerificationScript string `json:"verificationScript,omitempty"` 56 TeardownScript string `json:"teardownScript,omitempty"` 57 } 58 59 // KubernetesDeployCommand Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster. 60 func KubernetesDeployCommand() *cobra.Command { 61 const STEP_NAME = "kubernetesDeploy" 62 63 metadata := kubernetesDeployMetadata() 64 var stepConfig kubernetesDeployOptions 65 var startTime time.Time 66 var logCollector *log.CollectorHook 67 var splunkClient *splunk.Splunk 68 telemetryClient := &telemetry.Telemetry{} 69 70 var createKubernetesDeployCmd = &cobra.Command{ 71 Use: STEP_NAME, 72 Short: "Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.", 73 Long: `Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster. 74 75 !!! note "Deployment supports multiple deployment tools" 76 Currently the following are supported: 77 78 * [Helm](https://helm.sh/) command line tool and [Helm Charts](https://docs.helm.sh/developing_charts/#charts). 79 * [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) and ` + "`" + `kubectl apply` + "`" + ` command. 80 81 ## Helm 82 Following helm command will be executed by default: 83 84 ` + "`" + `` + "`" + `` + "`" + ` 85 helm upgrade <deploymentName> <chartPath> --install --force --namespace <namespace> --wait --timeout <helmDeployWaitSeconds> --set "image.repository=<yourRegistry>/<yourImageName>,image.tag=<yourImageTag>,secret.dockerconfigjson=<dockerSecret>,ingress.hosts[0]=<ingressHosts[0]>,,ingress.hosts[1]=<ingressHosts[1]>,... 86 ` + "`" + `` + "`" + `` + "`" + ` 87 88 * ` + "`" + `yourRegistry` + "`" + ` will be retrieved from ` + "`" + `containerRegistryUrl` + "`" + ` 89 * ` + "`" + `yourImageName` + "`" + `, ` + "`" + `yourImageTag` + "`" + ` will be retrieved from ` + "`" + `image` + "`" + ` 90 * ` + "`" + `dockerSecret` + "`" + ` will be calculated with a call to ` + "`" + `kubectl create secret generic <containerRegistrySecret> --from-file=.dockerconfigjson=<dockerConfigJson> --type=kubernetes.io/dockerconfigjson --insecure-skip-tls-verify=true --dry-run=client --output=json` + "`" + ``, 91 PreRunE: func(cmd *cobra.Command, _ []string) error { 92 startTime = time.Now() 93 log.SetStepName(STEP_NAME) 94 log.SetVerbose(GeneralConfig.Verbose) 95 96 GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens) 97 98 path, _ := os.Getwd() 99 fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path} 100 log.RegisterHook(fatalHook) 101 102 err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile) 103 if err != nil { 104 log.SetErrorCategory(log.ErrorConfiguration) 105 return err 106 } 107 log.RegisterSecret(stepConfig.ContainerRegistryPassword) 108 log.RegisterSecret(stepConfig.ContainerRegistryUser) 109 log.RegisterSecret(stepConfig.GithubToken) 110 log.RegisterSecret(stepConfig.KubeConfig) 111 log.RegisterSecret(stepConfig.KubeToken) 112 log.RegisterSecret(stepConfig.DockerConfigJSON) 113 114 if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 { 115 sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID) 116 log.RegisterHook(&sentryHook) 117 } 118 119 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 || len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 { 120 splunkClient = &splunk.Splunk{} 121 logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID} 122 log.RegisterHook(logCollector) 123 } 124 125 if err = log.RegisterANSHookIfConfigured(GeneralConfig.CorrelationID); err != nil { 126 log.Entry().WithError(err).Warn("failed to set up SAP Alert Notification Service log hook") 127 } 128 129 validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages()) 130 if err != nil { 131 return err 132 } 133 if err = validation.ValidateStruct(stepConfig); err != nil { 134 log.SetErrorCategory(log.ErrorConfiguration) 135 return err 136 } 137 138 return nil 139 }, 140 Run: func(_ *cobra.Command, _ []string) { 141 stepTelemetryData := telemetry.CustomData{} 142 stepTelemetryData.ErrorCode = "1" 143 handler := func() { 144 config.RemoveVaultSecretFiles() 145 stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds()) 146 stepTelemetryData.ErrorCategory = log.GetErrorCategory().String() 147 stepTelemetryData.PiperCommitHash = GitCommit 148 telemetryClient.SetData(&stepTelemetryData) 149 telemetryClient.Send() 150 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 151 splunkClient.Initialize(GeneralConfig.CorrelationID, 152 GeneralConfig.HookConfig.SplunkConfig.Dsn, 153 GeneralConfig.HookConfig.SplunkConfig.Token, 154 GeneralConfig.HookConfig.SplunkConfig.Index, 155 GeneralConfig.HookConfig.SplunkConfig.SendLogs) 156 splunkClient.Send(telemetryClient.GetData(), logCollector) 157 } 158 if len(GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint) > 0 { 159 splunkClient.Initialize(GeneralConfig.CorrelationID, 160 GeneralConfig.HookConfig.SplunkConfig.ProdCriblEndpoint, 161 GeneralConfig.HookConfig.SplunkConfig.ProdCriblToken, 162 GeneralConfig.HookConfig.SplunkConfig.ProdCriblIndex, 163 GeneralConfig.HookConfig.SplunkConfig.SendLogs) 164 splunkClient.Send(telemetryClient.GetData(), logCollector) 165 } 166 } 167 log.DeferExitHandler(handler) 168 defer handler() 169 telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME, GeneralConfig.HookConfig.PendoConfig.Token) 170 kubernetesDeploy(stepConfig, &stepTelemetryData) 171 stepTelemetryData.ErrorCode = "0" 172 log.Entry().Info("SUCCESS") 173 }, 174 } 175 176 addKubernetesDeployFlags(createKubernetesDeployCmd, &stepConfig) 177 return createKubernetesDeployCmd 178 } 179 180 func addKubernetesDeployFlags(cmd *cobra.Command, stepConfig *kubernetesDeployOptions) { 181 cmd.Flags().StringSliceVar(&stepConfig.AdditionalParameters, "additionalParameters", []string{}, "Defines additional parameters for \"helm install\" or \"kubectl apply\" command.") 182 cmd.Flags().StringVar(&stepConfig.APIServer, "apiServer", os.Getenv("PIPER_apiServer"), "Defines the Url of the API Server of the Kubernetes cluster.") 183 cmd.Flags().StringVar(&stepConfig.AppTemplate, "appTemplate", os.Getenv("PIPER_appTemplate"), "Defines the filename for the kubernetes app template (e.g. k8s_apptemplate.yaml).") 184 cmd.Flags().StringVar(&stepConfig.ChartPath, "chartPath", os.Getenv("PIPER_chartPath"), "Defines the chart path for deployments using helm. It is a mandatory parameter when `deployTool:helm` or `deployTool:helm3`.") 185 cmd.Flags().StringVar(&stepConfig.ContainerRegistryPassword, "containerRegistryPassword", os.Getenv("PIPER_containerRegistryPassword"), "Password for container registry access - typically provided by the CI/CD environment.") 186 cmd.Flags().StringVar(&stepConfig.ContainerImageName, "containerImageName", os.Getenv("PIPER_containerImageName"), "Name of the container which will be built - will be used together with `containerImageTag` instead of parameter `containerImage`") 187 cmd.Flags().StringVar(&stepConfig.ContainerImageTag, "containerImageTag", os.Getenv("PIPER_containerImageTag"), "Tag of the container which will be built - will be used together with `containerImageName` instead of parameter `containerImage`") 188 cmd.Flags().StringVar(&stepConfig.ContainerRegistryURL, "containerRegistryUrl", os.Getenv("PIPER_containerRegistryUrl"), "http(s) url of the Container registry where the image to deploy is located.") 189 cmd.Flags().StringVar(&stepConfig.ContainerRegistryUser, "containerRegistryUser", os.Getenv("PIPER_containerRegistryUser"), "Username for container registry access - typically provided by the CI/CD environment.") 190 cmd.Flags().StringVar(&stepConfig.ContainerRegistrySecret, "containerRegistrySecret", `regsecret`, "Name of the container registry secret used for pulling containers from the registry.") 191 cmd.Flags().BoolVar(&stepConfig.CreateDockerRegistrySecret, "createDockerRegistrySecret", false, "Only for `deployTool:kubectl`: Toggle to turn on `containerRegistrySecret` creation.") 192 cmd.Flags().StringVar(&stepConfig.DeploymentName, "deploymentName", os.Getenv("PIPER_deploymentName"), "Defines the name of the deployment. It is a mandatory parameter when `deployTool:helm` or `deployTool:helm3`.") 193 cmd.Flags().StringVar(&stepConfig.DeployTool, "deployTool", `kubectl`, "Defines the tool which should be used for deployment.") 194 cmd.Flags().BoolVar(&stepConfig.ForceUpdates, "forceUpdates", true, "Adds `--force` flag to a helm resource update command or to a kubectl replace command") 195 cmd.Flags().IntVar(&stepConfig.HelmDeployWaitSeconds, "helmDeployWaitSeconds", 300, "Number of seconds before helm deploy returns.") 196 cmd.Flags().IntVar(&stepConfig.HelmTestWaitSeconds, "helmTestWaitSeconds", 300, "Number of seconds to wait for any individual Kubernetes operation (like Jobs for hooks). See https://helm.sh/docs/helm/helm_test/#options for further details") 197 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`)") 198 199 cmd.Flags().BoolVar(&stepConfig.RenderSubchartNotes, "renderSubchartNotes", true, "If set, render subchart notes along with the parent.") 200 cmd.Flags().StringVar(&stepConfig.GithubToken, "githubToken", os.Getenv("PIPER_githubToken"), "GitHub personal access token as per https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line") 201 cmd.Flags().StringVar(&stepConfig.Image, "image", os.Getenv("PIPER_image"), "Full name of the image to be deployed.") 202 cmd.Flags().StringSliceVar(&stepConfig.ImageNames, "imageNames", []string{}, "List of names of the images to be deployed.") 203 cmd.Flags().StringSliceVar(&stepConfig.ImageNameTags, "imageNameTags", []string{}, "List of full names (registry and tag) of the images to be deployed.") 204 cmd.Flags().StringSliceVar(&stepConfig.ImageDigests, "imageDigests", []string{}, "List of image digests of the images to be deployed, in the format `sha256:<hash>`. If provided, image digests will be appended to the image tag, e.g. `<repository>/<name>:<tag>@<digest>`") 205 cmd.Flags().StringSliceVar(&stepConfig.IngressHosts, "ingressHosts", []string{}, "(Deprecated) List of ingress hosts to be exposed via helm deployment.") 206 cmd.Flags().BoolVar(&stepConfig.KeepFailedDeployments, "keepFailedDeployments", false, "Defines whether a failed deployment will be purged") 207 cmd.Flags().BoolVar(&stepConfig.RunHelmTests, "runHelmTests", false, "Defines whether or not to run helm tests against the recently deployed release") 208 cmd.Flags().BoolVar(&stepConfig.ShowTestLogs, "showTestLogs", false, "Defines whether to print the pod logs after running helm tests") 209 cmd.Flags().StringVar(&stepConfig.KubeConfig, "kubeConfig", os.Getenv("PIPER_kubeConfig"), "Defines the path to the \"kubeconfig\" file.") 210 cmd.Flags().StringVar(&stepConfig.KubeContext, "kubeContext", os.Getenv("PIPER_kubeContext"), "Defines the context to use from the \"kubeconfig\" file.") 211 cmd.Flags().StringVar(&stepConfig.KubeToken, "kubeToken", os.Getenv("PIPER_kubeToken"), "Contains the id_token used by kubectl for authentication. Consider using kubeConfig parameter instead.") 212 cmd.Flags().StringVar(&stepConfig.Namespace, "namespace", `default`, "Defines the target Kubernetes namespace for the deployment.") 213 cmd.Flags().StringVar(&stepConfig.TillerNamespace, "tillerNamespace", os.Getenv("PIPER_tillerNamespace"), "Defines optional tiller namespace for deployments using helm.") 214 cmd.Flags().StringVar(&stepConfig.DockerConfigJSON, "dockerConfigJSON", `.pipeline/docker/config.json`, "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/).") 215 cmd.Flags().StringVar(&stepConfig.DeployCommand, "deployCommand", `apply`, "Only for `deployTool: kubectl`: defines the command `apply` or `replace`. The default is `apply`.") 216 cmd.Flags().StringVar(&stepConfig.SetupScript, "setupScript", os.Getenv("PIPER_setupScript"), "HTTP location of setup script") 217 cmd.Flags().StringVar(&stepConfig.VerificationScript, "verificationScript", os.Getenv("PIPER_verificationScript"), "HTTP location of verification script") 218 cmd.Flags().StringVar(&stepConfig.TeardownScript, "teardownScript", os.Getenv("PIPER_teardownScript"), "HTTP location of teardown script") 219 220 cmd.MarkFlagRequired("containerRegistryUrl") 221 cmd.MarkFlagRequired("deployTool") 222 cmd.Flags().MarkDeprecated("image", "This parameter is deprecated, please use [containerImageName](#containerimagename) and [containerImageTag](#containerimagetag)") 223 } 224 225 // retrieve step metadata 226 func kubernetesDeployMetadata() config.StepData { 227 var theMetaData = config.StepData{ 228 Metadata: config.StepMetadata{ 229 Name: "kubernetesDeploy", 230 Aliases: []config.Alias{{Name: "deployToKubernetes", Deprecated: true}}, 231 Description: "Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.", 232 }, 233 Spec: config.StepSpec{ 234 Inputs: config.StepInputs{ 235 Secrets: []config.StepSecrets{ 236 {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}}}, 237 {Name: "kubeTokenCredentialsId", Description: "Jenkins 'Secret text' credentials ID containing token to authenticate to Kubernetes. This is an alternative way to using a kubeconfig file. Details can be found in the [Kubernetes documentation](https://kubernetes.io/docs/reference/access-authn-authz/authentication/).", Type: "jenkins", Aliases: []config.Alias{{Name: "k8sTokenCredentialsId", Deprecated: true}}}, 238 {Name: "dockerCredentialsId", Type: "jenkins"}, 239 {Name: "dockerConfigJsonCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing Docker config.json (with registry credential(s)).", Type: "jenkins"}, 240 {Name: "githubTokenCredentialsId", Description: "Jenkins credentials ID containing the github token.", Type: "jenkins"}, 241 }, 242 Resources: []config.StepResources{ 243 {Name: "deployDescriptor", Type: "stash"}, 244 {Name: "downloadedArtifact", Type: "stash"}, 245 }, 246 Parameters: []config.StepParameters{ 247 { 248 Name: "additionalParameters", 249 ResourceRef: []config.ResourceReference{}, 250 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 251 Type: "[]string", 252 Mandatory: false, 253 Aliases: []config.Alias{{Name: "helmDeploymentParameters"}}, 254 Default: []string{}, 255 }, 256 { 257 Name: "apiServer", 258 ResourceRef: []config.ResourceReference{}, 259 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 260 Type: "string", 261 Mandatory: false, 262 Aliases: []config.Alias{{Name: "k8sAPIServer"}}, 263 Default: os.Getenv("PIPER_apiServer"), 264 }, 265 { 266 Name: "appTemplate", 267 ResourceRef: []config.ResourceReference{}, 268 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 269 Type: "string", 270 Mandatory: false, 271 Aliases: []config.Alias{{Name: "k8sAppTemplate"}}, 272 Default: os.Getenv("PIPER_appTemplate"), 273 }, 274 { 275 Name: "chartPath", 276 ResourceRef: []config.ResourceReference{ 277 { 278 Name: "commonPipelineEnvironment", 279 Param: "custom/localHelmChartPath", 280 }, 281 }, 282 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 283 Type: "string", 284 Mandatory: false, 285 Aliases: []config.Alias{{Name: "helmChartPath"}}, 286 Default: os.Getenv("PIPER_chartPath"), 287 }, 288 { 289 Name: "containerRegistryPassword", 290 ResourceRef: []config.ResourceReference{ 291 { 292 Name: "dockerCredentialsId", 293 Param: "password", 294 Type: "secret", 295 }, 296 297 { 298 Name: "commonPipelineEnvironment", 299 Param: "container/repositoryPassword", 300 }, 301 302 { 303 Name: "commonPipelineEnvironment", 304 Param: "custom/repositoryPassword", 305 }, 306 }, 307 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 308 Type: "string", 309 Mandatory: false, 310 Aliases: []config.Alias{}, 311 Default: os.Getenv("PIPER_containerRegistryPassword"), 312 }, 313 { 314 Name: "containerImageName", 315 ResourceRef: []config.ResourceReference{}, 316 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 317 Type: "string", 318 Mandatory: false, 319 Aliases: []config.Alias{{Name: "dockerImageName"}}, 320 Default: os.Getenv("PIPER_containerImageName"), 321 }, 322 { 323 Name: "containerImageTag", 324 ResourceRef: []config.ResourceReference{ 325 { 326 Name: "commonPipelineEnvironment", 327 Param: "artifactVersion", 328 }, 329 }, 330 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 331 Type: "string", 332 Mandatory: false, 333 Aliases: []config.Alias{{Name: "artifactVersion"}}, 334 Default: os.Getenv("PIPER_containerImageTag"), 335 }, 336 { 337 Name: "containerRegistryUrl", 338 ResourceRef: []config.ResourceReference{ 339 { 340 Name: "commonPipelineEnvironment", 341 Param: "container/registryUrl", 342 }, 343 }, 344 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 345 Type: "string", 346 Mandatory: true, 347 Aliases: []config.Alias{{Name: "dockerRegistryUrl"}}, 348 Default: os.Getenv("PIPER_containerRegistryUrl"), 349 }, 350 { 351 Name: "containerRegistryUser", 352 ResourceRef: []config.ResourceReference{ 353 { 354 Name: "dockerCredentialsId", 355 Param: "username", 356 Type: "secret", 357 }, 358 359 { 360 Name: "commonPipelineEnvironment", 361 Param: "container/repositoryUsername", 362 }, 363 364 { 365 Name: "commonPipelineEnvironment", 366 Param: "custom/repositoryUsername", 367 }, 368 }, 369 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 370 Type: "string", 371 Mandatory: false, 372 Aliases: []config.Alias{}, 373 Default: os.Getenv("PIPER_containerRegistryUser"), 374 }, 375 { 376 Name: "containerRegistrySecret", 377 ResourceRef: []config.ResourceReference{}, 378 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 379 Type: "string", 380 Mandatory: false, 381 Aliases: []config.Alias{}, 382 Default: `regsecret`, 383 }, 384 { 385 Name: "createDockerRegistrySecret", 386 ResourceRef: []config.ResourceReference{}, 387 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 388 Type: "bool", 389 Mandatory: false, 390 Aliases: []config.Alias{}, 391 Default: false, 392 }, 393 { 394 Name: "deploymentName", 395 ResourceRef: []config.ResourceReference{}, 396 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 397 Type: "string", 398 Mandatory: false, 399 Aliases: []config.Alias{{Name: "helmDeploymentName"}}, 400 Default: os.Getenv("PIPER_deploymentName"), 401 }, 402 { 403 Name: "deployTool", 404 ResourceRef: []config.ResourceReference{}, 405 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 406 Type: "string", 407 Mandatory: true, 408 Aliases: []config.Alias{}, 409 Default: `kubectl`, 410 }, 411 { 412 Name: "forceUpdates", 413 ResourceRef: []config.ResourceReference{}, 414 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 415 Type: "bool", 416 Mandatory: false, 417 Aliases: []config.Alias{{Name: "force"}}, 418 Default: true, 419 }, 420 { 421 Name: "helmDeployWaitSeconds", 422 ResourceRef: []config.ResourceReference{}, 423 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 424 Type: "int", 425 Mandatory: false, 426 Aliases: []config.Alias{}, 427 Default: 300, 428 }, 429 { 430 Name: "helmTestWaitSeconds", 431 ResourceRef: []config.ResourceReference{}, 432 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 433 Type: "int", 434 Mandatory: false, 435 Aliases: []config.Alias{}, 436 Default: 300, 437 }, 438 { 439 Name: "helmValues", 440 ResourceRef: []config.ResourceReference{}, 441 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 442 Type: "[]string", 443 Mandatory: false, 444 Aliases: []config.Alias{}, 445 Default: []string{}, 446 }, 447 { 448 Name: "valuesMapping", 449 ResourceRef: []config.ResourceReference{}, 450 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 451 Type: "map[string]interface{}", 452 Mandatory: false, 453 Aliases: []config.Alias{}, 454 }, 455 { 456 Name: "renderSubchartNotes", 457 ResourceRef: []config.ResourceReference{}, 458 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 459 Type: "bool", 460 Mandatory: false, 461 Aliases: []config.Alias{}, 462 Default: true, 463 }, 464 { 465 Name: "githubToken", 466 ResourceRef: []config.ResourceReference{ 467 { 468 Name: "githubTokenCredentialsId", 469 Type: "secret", 470 }, 471 472 { 473 Name: "githubVaultSecretName", 474 Type: "vaultSecret", 475 Default: "github", 476 }, 477 }, 478 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 479 Type: "string", 480 Mandatory: false, 481 Aliases: []config.Alias{{Name: "access_token"}}, 482 Default: os.Getenv("PIPER_githubToken"), 483 }, 484 { 485 Name: "image", 486 ResourceRef: []config.ResourceReference{ 487 { 488 Name: "commonPipelineEnvironment", 489 Param: "container/imageNameTag", 490 }, 491 }, 492 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 493 Type: "string", 494 Mandatory: false, 495 Aliases: []config.Alias{{Name: "deployImage"}}, 496 Default: os.Getenv("PIPER_image"), 497 DeprecationMessage: "This parameter is deprecated, please use [containerImageName](#containerimagename) and [containerImageTag](#containerimagetag)", 498 }, 499 { 500 Name: "imageNames", 501 ResourceRef: []config.ResourceReference{ 502 { 503 Name: "commonPipelineEnvironment", 504 Param: "container/imageNames", 505 }, 506 }, 507 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 508 Type: "[]string", 509 Mandatory: false, 510 Aliases: []config.Alias{}, 511 Default: []string{}, 512 }, 513 { 514 Name: "imageNameTags", 515 ResourceRef: []config.ResourceReference{ 516 { 517 Name: "commonPipelineEnvironment", 518 Param: "container/imageNameTags", 519 }, 520 }, 521 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 522 Type: "[]string", 523 Mandatory: false, 524 Aliases: []config.Alias{}, 525 Default: []string{}, 526 }, 527 { 528 Name: "imageDigests", 529 ResourceRef: []config.ResourceReference{ 530 { 531 Name: "commonPipelineEnvironment", 532 Param: "container/imageDigests", 533 }, 534 }, 535 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 536 Type: "[]string", 537 Mandatory: false, 538 Aliases: []config.Alias{}, 539 Default: []string{}, 540 }, 541 { 542 Name: "ingressHosts", 543 ResourceRef: []config.ResourceReference{}, 544 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 545 Type: "[]string", 546 Mandatory: false, 547 Aliases: []config.Alias{}, 548 Default: []string{}, 549 }, 550 { 551 Name: "keepFailedDeployments", 552 ResourceRef: []config.ResourceReference{}, 553 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 554 Type: "bool", 555 Mandatory: false, 556 Aliases: []config.Alias{}, 557 Default: false, 558 }, 559 { 560 Name: "runHelmTests", 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: "showTestLogs", 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: "kubeConfig", 579 ResourceRef: []config.ResourceReference{ 580 { 581 Name: "kubeConfigFileCredentialsId", 582 Type: "secret", 583 }, 584 585 { 586 Name: "kubeConfigFileVaultSecretName", 587 Type: "vaultSecretFile", 588 Default: "kube-config", 589 }, 590 }, 591 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 592 Type: "string", 593 Mandatory: false, 594 Aliases: []config.Alias{}, 595 Default: os.Getenv("PIPER_kubeConfig"), 596 }, 597 { 598 Name: "kubeContext", 599 ResourceRef: []config.ResourceReference{}, 600 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 601 Type: "string", 602 Mandatory: false, 603 Aliases: []config.Alias{}, 604 Default: os.Getenv("PIPER_kubeContext"), 605 }, 606 { 607 Name: "kubeToken", 608 ResourceRef: []config.ResourceReference{ 609 { 610 Name: "kubeTokenCredentialsId", 611 Type: "secret", 612 }, 613 }, 614 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 615 Type: "string", 616 Mandatory: false, 617 Aliases: []config.Alias{}, 618 Default: os.Getenv("PIPER_kubeToken"), 619 }, 620 { 621 Name: "namespace", 622 ResourceRef: []config.ResourceReference{}, 623 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 624 Type: "string", 625 Mandatory: false, 626 Aliases: []config.Alias{{Name: "helmDeploymentNamespace"}, {Name: "k8sDeploymentNamespace"}}, 627 Default: `default`, 628 }, 629 { 630 Name: "tillerNamespace", 631 ResourceRef: []config.ResourceReference{}, 632 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 633 Type: "string", 634 Mandatory: false, 635 Aliases: []config.Alias{{Name: "helmTillerNamespace"}}, 636 Default: os.Getenv("PIPER_tillerNamespace"), 637 }, 638 { 639 Name: "dockerConfigJSON", 640 ResourceRef: []config.ResourceReference{ 641 { 642 Name: "dockerConfigJsonCredentialsId", 643 Type: "secret", 644 }, 645 646 { 647 Name: "dockerConfigFileVaultSecretName", 648 Type: "vaultSecretFile", 649 Default: "docker-config", 650 }, 651 }, 652 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 653 Type: "string", 654 Mandatory: false, 655 Aliases: []config.Alias{}, 656 Default: `.pipeline/docker/config.json`, 657 }, 658 { 659 Name: "deployCommand", 660 ResourceRef: []config.ResourceReference{}, 661 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 662 Type: "string", 663 Mandatory: false, 664 Aliases: []config.Alias{}, 665 Default: `apply`, 666 }, 667 { 668 Name: "setupScript", 669 ResourceRef: []config.ResourceReference{}, 670 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 671 Type: "string", 672 Mandatory: false, 673 Aliases: []config.Alias{}, 674 Default: os.Getenv("PIPER_setupScript"), 675 }, 676 { 677 Name: "verificationScript", 678 ResourceRef: []config.ResourceReference{}, 679 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 680 Type: "string", 681 Mandatory: false, 682 Aliases: []config.Alias{}, 683 Default: os.Getenv("PIPER_verificationScript"), 684 }, 685 { 686 Name: "teardownScript", 687 ResourceRef: []config.ResourceReference{}, 688 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 689 Type: "string", 690 Mandatory: false, 691 Aliases: []config.Alias{}, 692 Default: os.Getenv("PIPER_teardownScript"), 693 }, 694 }, 695 }, 696 Containers: []config.Container{ 697 {Image: "dtzar/helm-kubectl:3", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm3"}}}}}, 698 {Image: "dtzar/helm-kubectl:2.17.0", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm"}}}}}, 699 {Image: "dtzar/helm-kubectl:2.17.0", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "kubectl"}}}}}, 700 }, 701 }, 702 } 703 return theMetaData 704 }