github.com/xgoffin/jenkins-library@v1.154.0/cmd/cloudFoundryDeploy_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 cloudFoundryDeployOptions struct { 21 APIEndpoint string `json:"apiEndpoint,omitempty"` 22 AppName string `json:"appName,omitempty"` 23 ArtifactVersion string `json:"artifactVersion,omitempty"` 24 CommitHash string `json:"commitHash,omitempty"` 25 CfHome string `json:"cfHome,omitempty"` 26 CfNativeDeployParameters string `json:"cfNativeDeployParameters,omitempty"` 27 CfPluginHome string `json:"cfPluginHome,omitempty"` 28 DeployDockerImage string `json:"deployDockerImage,omitempty"` 29 DeployTool string `json:"deployTool,omitempty"` 30 BuildTool string `json:"buildTool,omitempty"` 31 DeployType string `json:"deployType,omitempty"` 32 DockerPassword string `json:"dockerPassword,omitempty"` 33 DockerUsername string `json:"dockerUsername,omitempty"` 34 KeepOldInstance bool `json:"keepOldInstance,omitempty"` 35 LoginParameters string `json:"loginParameters,omitempty"` 36 Manifest string `json:"manifest,omitempty"` 37 ManifestVariables []string `json:"manifestVariables,omitempty"` 38 ManifestVariablesFiles []string `json:"manifestVariablesFiles,omitempty"` 39 MtaDeployParameters string `json:"mtaDeployParameters,omitempty"` 40 MtaExtensionDescriptor string `json:"mtaExtensionDescriptor,omitempty"` 41 MtaExtensionCredentials map[string]interface{} `json:"mtaExtensionCredentials,omitempty"` 42 MtaPath string `json:"mtaPath,omitempty"` 43 Org string `json:"org,omitempty"` 44 Password string `json:"password,omitempty"` 45 SmokeTestScript string `json:"smokeTestScript,omitempty"` 46 SmokeTestStatusCode int `json:"smokeTestStatusCode,omitempty"` 47 Space string `json:"space,omitempty"` 48 Username string `json:"username,omitempty"` 49 } 50 51 type cloudFoundryDeployInflux struct { 52 deployment_data struct { 53 fields struct { 54 artifactURL string 55 deployTime string 56 commitHash string 57 jobTrigger string 58 } 59 tags struct { 60 artifactVersion string 61 deployUser string 62 deployResult string 63 cfAPIEndpoint string 64 cfOrg string 65 cfSpace string 66 } 67 } 68 } 69 70 func (i *cloudFoundryDeployInflux) persist(path, resourceName string) { 71 measurementContent := []struct { 72 measurement string 73 valType string 74 name string 75 value interface{} 76 }{ 77 {valType: config.InfluxField, measurement: "deployment_data", name: "artifactUrl", value: i.deployment_data.fields.artifactURL}, 78 {valType: config.InfluxField, measurement: "deployment_data", name: "deployTime", value: i.deployment_data.fields.deployTime}, 79 {valType: config.InfluxField, measurement: "deployment_data", name: "commitHash", value: i.deployment_data.fields.commitHash}, 80 {valType: config.InfluxField, measurement: "deployment_data", name: "jobTrigger", value: i.deployment_data.fields.jobTrigger}, 81 {valType: config.InfluxTag, measurement: "deployment_data", name: "artifactVersion", value: i.deployment_data.tags.artifactVersion}, 82 {valType: config.InfluxTag, measurement: "deployment_data", name: "deployUser", value: i.deployment_data.tags.deployUser}, 83 {valType: config.InfluxTag, measurement: "deployment_data", name: "deployResult", value: i.deployment_data.tags.deployResult}, 84 {valType: config.InfluxTag, measurement: "deployment_data", name: "cfApiEndpoint", value: i.deployment_data.tags.cfAPIEndpoint}, 85 {valType: config.InfluxTag, measurement: "deployment_data", name: "cfOrg", value: i.deployment_data.tags.cfOrg}, 86 {valType: config.InfluxTag, measurement: "deployment_data", name: "cfSpace", value: i.deployment_data.tags.cfSpace}, 87 } 88 89 errCount := 0 90 for _, metric := range measurementContent { 91 err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(metric.measurement, fmt.Sprintf("%vs", metric.valType), metric.name), metric.value) 92 if err != nil { 93 log.Entry().WithError(err).Error("Error persisting influx environment.") 94 errCount++ 95 } 96 } 97 if errCount > 0 { 98 log.Entry().Error("failed to persist Influx environment") 99 } 100 } 101 102 // CloudFoundryDeployCommand Deploys an application to Cloud Foundry 103 func CloudFoundryDeployCommand() *cobra.Command { 104 const STEP_NAME = "cloudFoundryDeploy" 105 106 metadata := cloudFoundryDeployMetadata() 107 var stepConfig cloudFoundryDeployOptions 108 var startTime time.Time 109 var influx cloudFoundryDeployInflux 110 var logCollector *log.CollectorHook 111 var splunkClient *splunk.Splunk 112 telemetryClient := &telemetry.Telemetry{} 113 114 var createCloudFoundryDeployCmd = &cobra.Command{ 115 Use: STEP_NAME, 116 Short: "Deploys an application to Cloud Foundry", 117 Long: `Deploys an application to a test or production space within Cloud Foundry.`, 118 PreRunE: func(cmd *cobra.Command, _ []string) error { 119 startTime = time.Now() 120 log.SetStepName(STEP_NAME) 121 log.SetVerbose(GeneralConfig.Verbose) 122 123 GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens) 124 125 path, _ := os.Getwd() 126 fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path} 127 log.RegisterHook(fatalHook) 128 129 err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile) 130 if err != nil { 131 log.SetErrorCategory(log.ErrorConfiguration) 132 return err 133 } 134 log.RegisterSecret(stepConfig.DockerPassword) 135 log.RegisterSecret(stepConfig.DockerUsername) 136 log.RegisterSecret(stepConfig.Password) 137 log.RegisterSecret(stepConfig.Username) 138 139 if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 { 140 sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID) 141 log.RegisterHook(&sentryHook) 142 } 143 144 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 145 splunkClient = &splunk.Splunk{} 146 logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID} 147 log.RegisterHook(logCollector) 148 } 149 150 validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages()) 151 if err != nil { 152 return err 153 } 154 if err = validation.ValidateStruct(stepConfig); err != nil { 155 log.SetErrorCategory(log.ErrorConfiguration) 156 return err 157 } 158 159 return nil 160 }, 161 Run: func(_ *cobra.Command, _ []string) { 162 stepTelemetryData := telemetry.CustomData{} 163 stepTelemetryData.ErrorCode = "1" 164 handler := func() { 165 influx.persist(GeneralConfig.EnvRootPath, "influx") 166 config.RemoveVaultSecretFiles() 167 stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds()) 168 stepTelemetryData.ErrorCategory = log.GetErrorCategory().String() 169 stepTelemetryData.PiperCommitHash = GitCommit 170 telemetryClient.SetData(&stepTelemetryData) 171 telemetryClient.Send() 172 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 173 splunkClient.Send(telemetryClient.GetData(), logCollector) 174 } 175 } 176 log.DeferExitHandler(handler) 177 defer handler() 178 telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME) 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 } 186 cloudFoundryDeploy(stepConfig, &stepTelemetryData, &influx) 187 stepTelemetryData.ErrorCode = "0" 188 log.Entry().Info("SUCCESS") 189 }, 190 } 191 192 addCloudFoundryDeployFlags(createCloudFoundryDeployCmd, &stepConfig) 193 return createCloudFoundryDeployCmd 194 } 195 196 func addCloudFoundryDeployFlags(cmd *cobra.Command, stepConfig *cloudFoundryDeployOptions) { 197 cmd.Flags().StringVar(&stepConfig.APIEndpoint, "apiEndpoint", `https://api.cf.eu10.hana.ondemand.com`, "Cloud Foundry API endpoint") 198 cmd.Flags().StringVar(&stepConfig.AppName, "appName", os.Getenv("PIPER_appName"), "Defines the name of the application to be deployed to the Cloud Foundry space") 199 cmd.Flags().StringVar(&stepConfig.ArtifactVersion, "artifactVersion", os.Getenv("PIPER_artifactVersion"), "The artifact version, used for influx reporting") 200 cmd.Flags().StringVar(&stepConfig.CommitHash, "commitHash", os.Getenv("PIPER_commitHash"), "The commit hash, used for influx reporting") 201 cmd.Flags().StringVar(&stepConfig.CfHome, "cfHome", os.Getenv("PIPER_cfHome"), "The cf home folder used by the cf cli. If not provided the default assumed by the cf cli is used.") 202 cmd.Flags().StringVar(&stepConfig.CfNativeDeployParameters, "cfNativeDeployParameters", os.Getenv("PIPER_cfNativeDeployParameters"), "Additional parameters passed to cf native deployment command") 203 cmd.Flags().StringVar(&stepConfig.CfPluginHome, "cfPluginHome", os.Getenv("PIPER_cfPluginHome"), "The cf plugin home folder used by the cf cli. If not provided the default assumed by the cf cli is used.") 204 cmd.Flags().StringVar(&stepConfig.DeployDockerImage, "deployDockerImage", os.Getenv("PIPER_deployDockerImage"), "Docker image deployments are supported (via manifest file in general)[https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#docker]. If no manifest is used, this parameter defines the image to be deployed. The specified name of the image is passed to the `--docker-image` parameter of the cf CLI and must adhere it's naming pattern (e.g. REPO/IMAGE:TAG). See (cf CLI documentation)[https://docs.cloudfoundry.org/devguide/deploy-apps/push-docker.html] for details. Note: The used Docker registry must be visible for the targeted Cloud Foundry instance.") 205 cmd.Flags().StringVar(&stepConfig.DeployTool, "deployTool", os.Getenv("PIPER_deployTool"), "Defines the tool which should be used for deployment.") 206 cmd.Flags().StringVar(&stepConfig.BuildTool, "buildTool", os.Getenv("PIPER_buildTool"), "Defines the tool which is used for building the artifact. If provided, `deployTool` is automatically derived from it. For MTA projects, `deployTool` defaults to `mtaDeployPlugin`. For other projects `cf_native` will be used.") 207 cmd.Flags().StringVar(&stepConfig.DeployType, "deployType", `standard`, "Defines the type of deployment, either `standard` deployment which results in a system downtime or a zero-downtime `blue-green` deployment.If 'cf_native' as deployType and 'blue-green' as deployTool is used in combination, your manifest.yaml may only contain one application. If this application has the option 'no-route' active the deployType will be changed to 'standard'.") 208 cmd.Flags().StringVar(&stepConfig.DockerPassword, "dockerPassword", os.Getenv("PIPER_dockerPassword"), "If the specified image in `deployDockerImage` is contained in a Docker registry, which requires authorization, this defines the password to be used.") 209 cmd.Flags().StringVar(&stepConfig.DockerUsername, "dockerUsername", os.Getenv("PIPER_dockerUsername"), "If the specified image in `deployDockerImage` is contained in a Docker registry, which requires authorization, this defines the username to be used.") 210 cmd.Flags().BoolVar(&stepConfig.KeepOldInstance, "keepOldInstance", false, "In case of a `blue-green` deployment the old instance will be deleted by default. If this option is set to true the old instance will remain stopped in the Cloud Foundry space.") 211 cmd.Flags().StringVar(&stepConfig.LoginParameters, "loginParameters", os.Getenv("PIPER_loginParameters"), "Addition command line options for cf login command. No escaping/quoting is performed. Not recommended for productive environments.") 212 cmd.Flags().StringVar(&stepConfig.Manifest, "manifest", os.Getenv("PIPER_manifest"), "Defines the manifest to be used for deployment to Cloud Foundry.") 213 cmd.Flags().StringSliceVar(&stepConfig.ManifestVariables, "manifestVariables", []string{}, "Defines a list of variables in the form `key=value` which are used for variable substitution within the file given by manifest.") 214 cmd.Flags().StringSliceVar(&stepConfig.ManifestVariablesFiles, "manifestVariablesFiles", []string{`manifest-variables.yml`}, "path(s) of the Yaml file(s) containing the variable values to use as a replacement in the manifest file. The order of the files is relevant in case there are conflicting variable names and values within variable files. In such a case, the values of the last file win.") 215 cmd.Flags().StringVar(&stepConfig.MtaDeployParameters, "mtaDeployParameters", `-f`, "Additional parameters passed to mta deployment command") 216 cmd.Flags().StringVar(&stepConfig.MtaExtensionDescriptor, "mtaExtensionDescriptor", os.Getenv("PIPER_mtaExtensionDescriptor"), "Defines additional extension descriptor file for deployment with the mtaDeployPlugin") 217 218 cmd.Flags().StringVar(&stepConfig.MtaPath, "mtaPath", os.Getenv("PIPER_mtaPath"), "Defines the path to *.mtar for deployment with the mtaDeployPlugin") 219 cmd.Flags().StringVar(&stepConfig.Org, "org", os.Getenv("PIPER_org"), "Cloud Foundry target organization.") 220 cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password") 221 cmd.Flags().StringVar(&stepConfig.SmokeTestScript, "smokeTestScript", `blueGreenCheckScript.sh`, "Allows to specify a script which performs a check during blue-green deployment. The script gets the FQDN as parameter and returns `exit code 0` in case check returned `smokeTestStatusCode`. More details can be found [here](https://github.com/bluemixgaragelondon/cf-blue-green-deploy#how-to-use). Currently this option is only considered for deployTool `cf_native`.") 222 cmd.Flags().IntVar(&stepConfig.SmokeTestStatusCode, "smokeTestStatusCode", 200, "Expected status code returned by the check.") 223 cmd.Flags().StringVar(&stepConfig.Space, "space", os.Getenv("PIPER_space"), "Cloud Foundry target space") 224 cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User name used for deployment") 225 226 cmd.MarkFlagRequired("apiEndpoint") 227 cmd.MarkFlagRequired("org") 228 cmd.MarkFlagRequired("password") 229 cmd.MarkFlagRequired("space") 230 cmd.MarkFlagRequired("username") 231 } 232 233 // retrieve step metadata 234 func cloudFoundryDeployMetadata() config.StepData { 235 var theMetaData = config.StepData{ 236 Metadata: config.StepMetadata{ 237 Name: "cloudFoundryDeploy", 238 Aliases: []config.Alias{}, 239 Description: "Deploys an application to Cloud Foundry", 240 }, 241 Spec: config.StepSpec{ 242 Inputs: config.StepInputs{ 243 Secrets: []config.StepSecrets{ 244 {Name: "cfCredentialsId", Description: "Jenkins 'Username with password' credentials ID containing user and password to authenticate to the Cloud Foundry API.", Type: "jenkins", Aliases: []config.Alias{{Name: "cloudFoundry/credentialsId", Deprecated: true}}}, 245 {Name: "dockerCredentialsId", Description: "Jenkins 'Username with password' credentials ID containing user and password to authenticate to the Docker registry.", Type: "jenkins"}, 246 }, 247 Parameters: []config.StepParameters{ 248 { 249 Name: "apiEndpoint", 250 ResourceRef: []config.ResourceReference{}, 251 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 252 Type: "string", 253 Mandatory: true, 254 Aliases: []config.Alias{{Name: "cfApiEndpoint"}, {Name: "cloudFoundry/apiEndpoint", Deprecated: true}}, 255 Default: `https://api.cf.eu10.hana.ondemand.com`, 256 }, 257 { 258 Name: "appName", 259 ResourceRef: []config.ResourceReference{}, 260 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 261 Type: "string", 262 Mandatory: false, 263 Aliases: []config.Alias{{Name: "cfAppName"}, {Name: "cloudFoundry/appName", Deprecated: true}}, 264 Default: os.Getenv("PIPER_appName"), 265 }, 266 { 267 Name: "artifactVersion", 268 ResourceRef: []config.ResourceReference{ 269 { 270 Name: "commonPipelineEnvironment", 271 Param: "artifactVersion", 272 }, 273 }, 274 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 275 Type: "string", 276 Mandatory: false, 277 Aliases: []config.Alias{}, 278 Default: os.Getenv("PIPER_artifactVersion"), 279 }, 280 { 281 Name: "commitHash", 282 ResourceRef: []config.ResourceReference{ 283 { 284 Name: "commonPipelineEnvironment", 285 Param: "git/headCommitId", 286 }, 287 }, 288 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 289 Type: "string", 290 Mandatory: false, 291 Aliases: []config.Alias{}, 292 Default: os.Getenv("PIPER_commitHash"), 293 }, 294 { 295 Name: "cfHome", 296 ResourceRef: []config.ResourceReference{}, 297 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 298 Type: "string", 299 Mandatory: false, 300 Aliases: []config.Alias{}, 301 Default: os.Getenv("PIPER_cfHome"), 302 }, 303 { 304 Name: "cfNativeDeployParameters", 305 ResourceRef: []config.ResourceReference{}, 306 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 307 Type: "string", 308 Mandatory: false, 309 Aliases: []config.Alias{}, 310 Default: os.Getenv("PIPER_cfNativeDeployParameters"), 311 }, 312 { 313 Name: "cfPluginHome", 314 ResourceRef: []config.ResourceReference{}, 315 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 316 Type: "string", 317 Mandatory: false, 318 Aliases: []config.Alias{}, 319 Default: os.Getenv("PIPER_cfPluginHome"), 320 }, 321 { 322 Name: "deployDockerImage", 323 ResourceRef: []config.ResourceReference{}, 324 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 325 Type: "string", 326 Mandatory: false, 327 Aliases: []config.Alias{}, 328 Default: os.Getenv("PIPER_deployDockerImage"), 329 }, 330 { 331 Name: "deployTool", 332 ResourceRef: []config.ResourceReference{}, 333 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 334 Type: "string", 335 Mandatory: false, 336 Aliases: []config.Alias{}, 337 Default: os.Getenv("PIPER_deployTool"), 338 }, 339 { 340 Name: "buildTool", 341 ResourceRef: []config.ResourceReference{ 342 { 343 Name: "commonPipelineEnvironment", 344 Param: "buildTool", 345 }, 346 }, 347 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 348 Type: "string", 349 Mandatory: false, 350 Aliases: []config.Alias{}, 351 Default: os.Getenv("PIPER_buildTool"), 352 }, 353 { 354 Name: "deployType", 355 ResourceRef: []config.ResourceReference{}, 356 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 357 Type: "string", 358 Mandatory: false, 359 Aliases: []config.Alias{}, 360 Default: `standard`, 361 }, 362 { 363 Name: "dockerPassword", 364 ResourceRef: []config.ResourceReference{ 365 { 366 Name: "dockerCredentialsId", 367 Param: "password", 368 Type: "secret", 369 }, 370 }, 371 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 372 Type: "string", 373 Mandatory: false, 374 Aliases: []config.Alias{}, 375 Default: os.Getenv("PIPER_dockerPassword"), 376 }, 377 { 378 Name: "dockerUsername", 379 ResourceRef: []config.ResourceReference{ 380 { 381 Name: "dockerCredentialsId", 382 Param: "username", 383 Type: "secret", 384 }, 385 }, 386 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 387 Type: "string", 388 Mandatory: false, 389 Aliases: []config.Alias{}, 390 Default: os.Getenv("PIPER_dockerUsername"), 391 }, 392 { 393 Name: "keepOldInstance", 394 ResourceRef: []config.ResourceReference{}, 395 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 396 Type: "bool", 397 Mandatory: false, 398 Aliases: []config.Alias{}, 399 Default: false, 400 }, 401 { 402 Name: "loginParameters", 403 ResourceRef: []config.ResourceReference{}, 404 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 405 Type: "string", 406 Mandatory: false, 407 Aliases: []config.Alias{}, 408 Default: os.Getenv("PIPER_loginParameters"), 409 }, 410 { 411 Name: "manifest", 412 ResourceRef: []config.ResourceReference{}, 413 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 414 Type: "string", 415 Mandatory: false, 416 Aliases: []config.Alias{{Name: "cfManifest"}, {Name: "cloudFoundry/manifest", Deprecated: true}}, 417 Default: os.Getenv("PIPER_manifest"), 418 }, 419 { 420 Name: "manifestVariables", 421 ResourceRef: []config.ResourceReference{}, 422 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 423 Type: "[]string", 424 Mandatory: false, 425 Aliases: []config.Alias{{Name: "cfManifestVariables"}, {Name: "cloudFoundry/manifestVariables", Deprecated: true}}, 426 Default: []string{}, 427 }, 428 { 429 Name: "manifestVariablesFiles", 430 ResourceRef: []config.ResourceReference{}, 431 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 432 Type: "[]string", 433 Mandatory: false, 434 Aliases: []config.Alias{{Name: "cfManifestVariablesFiles"}, {Name: "cloudFoundry/manifestVariablesFiles", Deprecated: true}}, 435 Default: []string{`manifest-variables.yml`}, 436 }, 437 { 438 Name: "mtaDeployParameters", 439 ResourceRef: []config.ResourceReference{}, 440 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 441 Type: "string", 442 Mandatory: false, 443 Aliases: []config.Alias{}, 444 Default: `-f`, 445 }, 446 { 447 Name: "mtaExtensionDescriptor", 448 ResourceRef: []config.ResourceReference{}, 449 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 450 Type: "string", 451 Mandatory: false, 452 Aliases: []config.Alias{{Name: "cloudFoundry/mtaExtensionDescriptor", Deprecated: true}}, 453 Default: os.Getenv("PIPER_mtaExtensionDescriptor"), 454 }, 455 { 456 Name: "mtaExtensionCredentials", 457 ResourceRef: []config.ResourceReference{}, 458 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 459 Type: "map[string]interface{}", 460 Mandatory: false, 461 Aliases: []config.Alias{{Name: "cloudFoundry/mtaExtensionCredentials", Deprecated: true}}, 462 }, 463 { 464 Name: "mtaPath", 465 ResourceRef: []config.ResourceReference{ 466 { 467 Name: "commonPipelineEnvironment", 468 Param: "mtarFilePath", 469 }, 470 }, 471 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 472 Type: "string", 473 Mandatory: false, 474 Aliases: []config.Alias{}, 475 Default: os.Getenv("PIPER_mtaPath"), 476 }, 477 { 478 Name: "org", 479 ResourceRef: []config.ResourceReference{}, 480 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 481 Type: "string", 482 Mandatory: true, 483 Aliases: []config.Alias{{Name: "cfOrg"}, {Name: "cloudFoundry/org", Deprecated: true}}, 484 Default: os.Getenv("PIPER_org"), 485 }, 486 { 487 Name: "password", 488 ResourceRef: []config.ResourceReference{ 489 { 490 Name: "cfCredentialsId", 491 Param: "password", 492 Type: "secret", 493 }, 494 495 { 496 Name: "cloudfoundryVaultSecretName", 497 Type: "vaultSecret", 498 Default: "cloudfoundry-$(org)-$(space)", 499 }, 500 }, 501 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 502 Type: "string", 503 Mandatory: true, 504 Aliases: []config.Alias{}, 505 Default: os.Getenv("PIPER_password"), 506 }, 507 { 508 Name: "smokeTestScript", 509 ResourceRef: []config.ResourceReference{}, 510 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 511 Type: "string", 512 Mandatory: false, 513 Aliases: []config.Alias{}, 514 Default: `blueGreenCheckScript.sh`, 515 }, 516 { 517 Name: "smokeTestStatusCode", 518 ResourceRef: []config.ResourceReference{}, 519 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 520 Type: "int", 521 Mandatory: false, 522 Aliases: []config.Alias{}, 523 Default: 200, 524 }, 525 { 526 Name: "space", 527 ResourceRef: []config.ResourceReference{}, 528 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 529 Type: "string", 530 Mandatory: true, 531 Aliases: []config.Alias{{Name: "cfSpace"}, {Name: "cloudFoundry/space", Deprecated: true}}, 532 Default: os.Getenv("PIPER_space"), 533 }, 534 { 535 Name: "username", 536 ResourceRef: []config.ResourceReference{ 537 { 538 Name: "cfCredentialsId", 539 Param: "username", 540 Type: "secret", 541 }, 542 543 { 544 Name: "cloudfoundryVaultSecretName", 545 Type: "vaultSecret", 546 Default: "cloudfoundry-$(org)-$(space)", 547 }, 548 }, 549 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 550 Type: "string", 551 Mandatory: true, 552 Aliases: []config.Alias{}, 553 Default: os.Getenv("PIPER_username"), 554 }, 555 }, 556 }, 557 Containers: []config.Container{ 558 {Name: "cfDeploy", Image: "ppiper/cf-cli:6"}, 559 }, 560 Outputs: config.StepOutputs{ 561 Resources: []config.StepResources{ 562 { 563 Name: "influx", 564 Type: "influx", 565 Parameters: []map[string]interface{}{ 566 {"name": "deployment_data", "fields": []map[string]string{{"name": "artifactUrl"}, {"name": "deployTime"}, {"name": "commitHash"}, {"name": "jobTrigger"}}, "tags": []map[string]string{{"name": "artifactVersion"}, {"name": "deployUser"}, {"name": "deployResult"}, {"name": "cfApiEndpoint"}, {"name": "cfOrg"}, {"name": "cfSpace"}}}, 567 }, 568 }, 569 }, 570 }, 571 }, 572 } 573 return theMetaData 574 }