2020-07-31 12:38:00 +02:00
// Code generated by piper's step-generator. DO NOT EDIT.
package cmd
import (
"fmt"
"os"
"path/filepath"
"time"
"github.com/SAP/jenkins-library/pkg/config"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperenv"
2021-05-17 12:14:04 +02:00
"github.com/SAP/jenkins-library/pkg/splunk"
2020-07-31 12:38:00 +02:00
"github.com/SAP/jenkins-library/pkg/telemetry"
2021-10-01 12:49:05 +02:00
"github.com/SAP/jenkins-library/pkg/validation"
2020-07-31 12:38:00 +02:00
"github.com/spf13/cobra"
)
type cloudFoundryDeployOptions struct {
2021-01-12 10:39:04 +02:00
APIEndpoint string ` json:"apiEndpoint,omitempty" `
AppName string ` json:"appName,omitempty" `
ArtifactVersion string ` json:"artifactVersion,omitempty" `
2021-08-05 17:03:51 +02:00
CommitHash string ` json:"commitHash,omitempty" `
2021-01-12 10:39:04 +02:00
CfHome string ` json:"cfHome,omitempty" `
CfNativeDeployParameters string ` json:"cfNativeDeployParameters,omitempty" `
CfPluginHome string ` json:"cfPluginHome,omitempty" `
DeployDockerImage string ` json:"deployDockerImage,omitempty" `
DeployTool string ` json:"deployTool,omitempty" `
BuildTool string ` json:"buildTool,omitempty" `
DeployType string ` json:"deployType,omitempty" `
DockerPassword string ` json:"dockerPassword,omitempty" `
DockerUsername string ` json:"dockerUsername,omitempty" `
KeepOldInstance bool ` json:"keepOldInstance,omitempty" `
LoginParameters string ` json:"loginParameters,omitempty" `
Manifest string ` json:"manifest,omitempty" `
ManifestVariables [ ] string ` json:"manifestVariables,omitempty" `
ManifestVariablesFiles [ ] string ` json:"manifestVariablesFiles,omitempty" `
MtaDeployParameters string ` json:"mtaDeployParameters,omitempty" `
MtaExtensionDescriptor string ` json:"mtaExtensionDescriptor,omitempty" `
MtaExtensionCredentials map [ string ] interface { } ` json:"mtaExtensionCredentials,omitempty" `
MtaPath string ` json:"mtaPath,omitempty" `
Org string ` json:"org,omitempty" `
Password string ` json:"password,omitempty" `
SmokeTestScript string ` json:"smokeTestScript,omitempty" `
SmokeTestStatusCode int ` json:"smokeTestStatusCode,omitempty" `
Space string ` json:"space,omitempty" `
Username string ` json:"username,omitempty" `
2020-07-31 12:38:00 +02:00
}
type cloudFoundryDeployInflux struct {
deployment_data struct {
fields struct {
artifactURL string
deployTime string
2021-08-05 17:03:51 +02:00
commitHash string
2020-07-31 12:38:00 +02:00
jobTrigger string
}
tags struct {
artifactVersion string
deployUser string
deployResult string
cfAPIEndpoint string
cfOrg string
cfSpace string
}
}
}
func ( i * cloudFoundryDeployInflux ) persist ( path , resourceName string ) {
measurementContent := [ ] struct {
measurement string
valType string
name string
2020-10-05 15:33:28 +02:00
value interface { }
2020-07-31 12:38:00 +02:00
} {
{ valType : config . InfluxField , measurement : "deployment_data" , name : "artifactUrl" , value : i . deployment_data . fields . artifactURL } ,
{ valType : config . InfluxField , measurement : "deployment_data" , name : "deployTime" , value : i . deployment_data . fields . deployTime } ,
2021-08-05 17:03:51 +02:00
{ valType : config . InfluxField , measurement : "deployment_data" , name : "commitHash" , value : i . deployment_data . fields . commitHash } ,
2020-07-31 12:38:00 +02:00
{ valType : config . InfluxField , measurement : "deployment_data" , name : "jobTrigger" , value : i . deployment_data . fields . jobTrigger } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "artifactVersion" , value : i . deployment_data . tags . artifactVersion } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "deployUser" , value : i . deployment_data . tags . deployUser } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "deployResult" , value : i . deployment_data . tags . deployResult } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "cfApiEndpoint" , value : i . deployment_data . tags . cfAPIEndpoint } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "cfOrg" , value : i . deployment_data . tags . cfOrg } ,
{ valType : config . InfluxTag , measurement : "deployment_data" , name : "cfSpace" , value : i . deployment_data . tags . cfSpace } ,
}
errCount := 0
for _ , metric := range measurementContent {
err := piperenv . SetResourceParameter ( path , resourceName , filepath . Join ( metric . measurement , fmt . Sprintf ( "%vs" , metric . valType ) , metric . name ) , metric . value )
if err != nil {
log . Entry ( ) . WithError ( err ) . Error ( "Error persisting influx environment." )
errCount ++
}
}
if errCount > 0 {
2021-12-15 15:26:23 +02:00
log . Entry ( ) . Error ( "failed to persist Influx environment" )
2020-07-31 12:38:00 +02:00
}
}
2020-08-24 18:10:45 +02:00
// CloudFoundryDeployCommand Deploys an application to Cloud Foundry
2020-07-31 12:38:00 +02:00
func CloudFoundryDeployCommand ( ) * cobra . Command {
const STEP_NAME = "cloudFoundryDeploy"
metadata := cloudFoundryDeployMetadata ( )
var stepConfig cloudFoundryDeployOptions
var startTime time . Time
var influx cloudFoundryDeployInflux
2021-05-17 12:14:04 +02:00
var logCollector * log . CollectorHook
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
var splunkClient * splunk . Splunk
telemetryClient := & telemetry . Telemetry { }
2020-07-31 12:38:00 +02:00
var createCloudFoundryDeployCmd = & cobra . Command {
Use : STEP_NAME ,
2020-08-24 18:10:45 +02:00
Short : "Deploys an application to Cloud Foundry" ,
2020-07-31 12:38:00 +02:00
Long : ` Deploys an application to a test or production space within Cloud Foundry. ` ,
PreRunE : func ( cmd * cobra . Command , _ [ ] string ) error {
startTime = time . Now ( )
log . SetStepName ( STEP_NAME )
log . SetVerbose ( GeneralConfig . Verbose )
2021-07-08 15:26:07 +02:00
GeneralConfig . GitHubAccessTokens = ResolveAccessTokens ( GeneralConfig . GitHubTokens )
2020-07-31 12:38:00 +02:00
path , _ := os . Getwd ( )
fatalHook := & log . FatalHook { CorrelationID : GeneralConfig . CorrelationID , Path : path }
log . RegisterHook ( fatalHook )
err := PrepareConfig ( cmd , & metadata , STEP_NAME , & stepConfig , config . OpenPiperFile )
if err != nil {
log . SetErrorCategory ( log . ErrorConfiguration )
return err
}
log . RegisterSecret ( stepConfig . DockerPassword )
2020-10-06 08:59:20 +02:00
log . RegisterSecret ( stepConfig . DockerUsername )
2020-07-31 12:38:00 +02:00
log . RegisterSecret ( stepConfig . Password )
log . RegisterSecret ( stepConfig . Username )
if len ( GeneralConfig . HookConfig . SentryConfig . Dsn ) > 0 {
sentryHook := log . NewSentryHook ( GeneralConfig . HookConfig . SentryConfig . Dsn , GeneralConfig . CorrelationID )
log . RegisterHook ( & sentryHook )
}
2021-05-17 12:14:04 +02:00
if len ( GeneralConfig . HookConfig . SplunkConfig . Dsn ) > 0 {
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
splunkClient = & splunk . Splunk { }
2021-05-17 12:14:04 +02:00
logCollector = & log . CollectorHook { CorrelationID : GeneralConfig . CorrelationID }
log . RegisterHook ( logCollector )
}
2021-10-01 12:49:05 +02:00
validation , err := validation . New ( validation . WithJSONNamesForStructFields ( ) , validation . WithPredefinedErrorMessages ( ) )
if err != nil {
return err
}
if err = validation . ValidateStruct ( stepConfig ) ; err != nil {
log . SetErrorCategory ( log . ErrorConfiguration )
return err
}
2020-07-31 12:38:00 +02:00
return nil
} ,
Run : func ( _ * cobra . Command , _ [ ] string ) {
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
stepTelemetryData := telemetry . CustomData { }
stepTelemetryData . ErrorCode = "1"
2020-07-31 12:38:00 +02:00
handler := func ( ) {
influx . persist ( GeneralConfig . EnvRootPath , "influx" )
2021-12-15 16:07:47 +02:00
config . RemoveVaultSecretFiles ( )
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
stepTelemetryData . Duration = fmt . Sprintf ( "%v" , time . Since ( startTime ) . Milliseconds ( ) )
stepTelemetryData . ErrorCategory = log . GetErrorCategory ( ) . String ( )
stepTelemetryData . PiperCommitHash = GitCommit
telemetryClient . SetData ( & stepTelemetryData )
telemetryClient . Send ( )
2021-05-17 12:14:04 +02:00
if len ( GeneralConfig . HookConfig . SplunkConfig . Dsn ) > 0 {
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
splunkClient . Send ( telemetryClient . GetData ( ) , logCollector )
2021-05-17 12:14:04 +02:00
}
2020-07-31 12:38:00 +02:00
}
log . DeferExitHandler ( handler )
defer handler ( )
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
telemetryClient . Initialize ( GeneralConfig . NoTelemetry , STEP_NAME )
2021-05-17 12:14:04 +02:00
if len ( GeneralConfig . HookConfig . SplunkConfig . Dsn ) > 0 {
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
splunkClient . Initialize ( GeneralConfig . CorrelationID ,
2021-05-17 12:14:04 +02:00
GeneralConfig . HookConfig . SplunkConfig . Dsn ,
GeneralConfig . HookConfig . SplunkConfig . Token ,
GeneralConfig . HookConfig . SplunkConfig . Index ,
GeneralConfig . HookConfig . SplunkConfig . SendLogs )
}
Changes for Pipeline Reporting (#3213)
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetLog() function to orchestrator
* Fixes BUILD_NUMBER env variable
* Fixes correct env var for JENKINS_HOME
* Adds getEnv to read env variables with default value, adds test for jenkins GetLog() implementation
* Adds possibility to read errorJsons; updates splunk package for log files (WIP)
* Uncommenting dev code
* Adds GetRequest function which holds the response in memory (not saved to disk)
* Implements GetLog() function for ADO, adds function to read PipelineRuntime
* PAT has been revoked
* Changes http package, s.t. if password only is required basic auth works too
* Adds env variable for azure token, error handling in case of unauthenticated/nil response
* Adds logging output in case env variable can not be read and fallback variable needs to be used
* Adds usage of environment variables for auth, uses jenkins api
* Adds init functionality for orchestrators, updates GetLog() and GetPipelineStartTime() function
* Adds initaliziation function for orchestrator authetnication
* Adds settings struct for orchestrator authentication
* Adds function to whole logfile to Splunk
* Struct for pipeline related telemetry information
* Increase messagebatch size to 10k
* Changes splunk package to a pointer based implementation, updates generated files and corresponding template and tests for splunk
* Changes telemetry package to pointer based implementation to have multiple telemetry objects, adjusted tests and splunk implementation
* Changes content type to txt
* Send telemetry independent of logfiles, increases amount of messages per file
* Adds JobURL for orchestrators and UnknownOrchestrator as fallback
* telemetry makes use of orchestrator specific information
* Adds orchestrator independent correlationID
* Adds custom fields for pipeline status
* go fmt
* Removes env var test - no env variables are read anymore
* Use UnknownOrchestratorConfigProvider in case the orchestrator can not be initalized
* Removes Custom fields from telemetry as these can not be reflected in SWA
* Adds custom telemetry information (piperHash,..) to each step telemetry information
* Removes falltrough in case no orchestrator has been found
* Updates tests for orchestrator package
* Adds orchestrator import in generated files
* Updates generator files for internal library
* Adds orchestrator telemetry information to steps
* Updates generated files, fatalHook writes to cpe
* Go generate from master, go fmt
* Adds Custom Data field LastErrorCode
* Removes GetLog() test
* Update init_unix.go
* Update docker_integration_test_executor.go
* Update integration_api_cli_test.go
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Reverts go1.17 fmt formatting
* Renames customTelemetryData to stepTelemetryData
* Adjustments to orchestrator-package, cleanup, adds JobName
* Adjusts commonPipelineEnvironment path
* Adds pipelineTelemetry struct to telemetry package, removes pipeline telemetry structs from splunk package
* Go fmt
* Changes path for errorDetails, adds debug information
* Removes custom fields from step, adds orchestrator, commithash to baseMetadata
* Adjusts tests for telemetry package
* Adds tests for orchestrator
* Updates generated files, initalization of splunk client only if its available in the config
* Fixes typo in helper go
* Update pkg/http/downloader.go
* Update pkg/http/downloader.go
* Update pkg/log/fatalHook.go
* Update fatalHook.go
* Update pkg/splunk/splunk.go
* Update pkg/telemetry/data.go
* Adds GetBuildStatus() and GetAPIInformation() to orchestrators
* error formatting
* Bugfix: dont send telemetry data if disabled, adjusts test
* go fmt
* Use correct error handling
* Update pkg/telemetry/telemetry.go
* Fixes telemetry disabled in the tests
* Fixes http tests
* Log fatal errors to logFile
* Adds CustomReportingConfig to hooks
* Cleanup comments in splunk package
* Adds possibility to send telemetry to custom endpoint
* Adds debug output for the payload
* Debug output for the payload as a string
* Adds test cases for changes in telemetry package
* go fmt
* Adds generated files for new step
* Reverts changes for http tests, causing problems with go1.15, changes need to be applied for newer go version >=1.17
* Adjusts test for sonarExecuteScan
* Adjusts test for sonarExecuteScan
* Adds explanation for customreportingConfig
* Makes disableing of customSend more obvious
* Adds custom step reporting to each step, updates generated files, adjusts helper testdata
* fixes unit test wrong usage of logging
* Send pipeline data altough there has been no error, adjust test cases
* Reverts changes for customReporting
* Updates generated files, removes customReporting
* Removes writing errorDetails to CPE
* Reverts usage of customreporting
* go fmt
* reverts changes in http_test
* reverts changes in http_test
* Skips integration cnb test
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-11-18 18:50:03 +02:00
cloudFoundryDeploy ( stepConfig , & stepTelemetryData , & influx )
stepTelemetryData . ErrorCode = "0"
2020-07-31 12:38:00 +02:00
log . Entry ( ) . Info ( "SUCCESS" )
} ,
}
addCloudFoundryDeployFlags ( createCloudFoundryDeployCmd , & stepConfig )
return createCloudFoundryDeployCmd
}
func addCloudFoundryDeployFlags ( cmd * cobra . Command , stepConfig * cloudFoundryDeployOptions ) {
cmd . Flags ( ) . StringVar ( & stepConfig . APIEndpoint , "apiEndpoint" , ` https://api.cf.eu10.hana.ondemand.com ` , "Cloud Foundry API endpoint" )
cmd . Flags ( ) . StringVar ( & stepConfig . AppName , "appName" , os . Getenv ( "PIPER_appName" ) , "Defines the name of the application to be deployed to the Cloud Foundry space" )
cmd . Flags ( ) . StringVar ( & stepConfig . ArtifactVersion , "artifactVersion" , os . Getenv ( "PIPER_artifactVersion" ) , "The artifact version, used for influx reporting" )
2021-08-05 17:03:51 +02:00
cmd . Flags ( ) . StringVar ( & stepConfig . CommitHash , "commitHash" , os . Getenv ( "PIPER_commitHash" ) , "The commit hash, used for influx reporting" )
2020-07-31 12:38:00 +02:00
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." )
cmd . Flags ( ) . StringVar ( & stepConfig . CfNativeDeployParameters , "cfNativeDeployParameters" , os . Getenv ( "PIPER_cfNativeDeployParameters" ) , "Additional parameters passed to cf native deployment command" )
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." )
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." )
cmd . Flags ( ) . StringVar ( & stepConfig . DeployTool , "deployTool" , os . Getenv ( "PIPER_deployTool" ) , "Defines the tool which should be used for deployment." )
2020-08-24 18:10:45 +02:00
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." )
2020-07-31 12:38:00 +02:00
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'." )
2020-08-24 18:10:45 +02:00
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." )
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." )
2020-07-31 12:38:00 +02:00
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." )
2020-08-24 18:10:45 +02:00
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." )
2020-07-31 12:38:00 +02:00
cmd . Flags ( ) . StringVar ( & stepConfig . Manifest , "manifest" , os . Getenv ( "PIPER_manifest" ) , "Defines the manifest to be used for deployment to Cloud Foundry." )
2021-11-09 08:44:31 +02:00
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." )
2020-07-31 12:38:00 +02:00
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." )
cmd . Flags ( ) . StringVar ( & stepConfig . MtaDeployParameters , "mtaDeployParameters" , ` -f ` , "Additional parameters passed to mta deployment command" )
cmd . Flags ( ) . StringVar ( & stepConfig . MtaExtensionDescriptor , "mtaExtensionDescriptor" , os . Getenv ( "PIPER_mtaExtensionDescriptor" ) , "Defines additional extension descriptor file for deployment with the mtaDeployPlugin" )
2021-01-12 10:39:04 +02:00
2020-07-31 12:38:00 +02:00
cmd . Flags ( ) . StringVar ( & stepConfig . MtaPath , "mtaPath" , os . Getenv ( "PIPER_mtaPath" ) , "Defines the path to *.mtar for deployment with the mtaDeployPlugin" )
cmd . Flags ( ) . StringVar ( & stepConfig . Org , "org" , os . Getenv ( "PIPER_org" ) , "Cloud Foundry target organization." )
cmd . Flags ( ) . StringVar ( & stepConfig . Password , "password" , os . Getenv ( "PIPER_password" ) , "Password" )
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`." )
cmd . Flags ( ) . IntVar ( & stepConfig . SmokeTestStatusCode , "smokeTestStatusCode" , 200 , "Expected status code returned by the check." )
cmd . Flags ( ) . StringVar ( & stepConfig . Space , "space" , os . Getenv ( "PIPER_space" ) , "Cloud Foundry target space" )
cmd . Flags ( ) . StringVar ( & stepConfig . Username , "username" , os . Getenv ( "PIPER_username" ) , "User" )
cmd . MarkFlagRequired ( "apiEndpoint" )
cmd . MarkFlagRequired ( "org" )
cmd . MarkFlagRequired ( "password" )
cmd . MarkFlagRequired ( "space" )
cmd . MarkFlagRequired ( "username" )
}
// retrieve step metadata
func cloudFoundryDeployMetadata ( ) config . StepData {
var theMetaData = config . StepData {
Metadata : config . StepMetadata {
2020-11-20 09:13:59 +02:00
Name : "cloudFoundryDeploy" ,
Aliases : [ ] config . Alias { } ,
Description : "Deploys an application to Cloud Foundry" ,
2020-07-31 12:38:00 +02:00
} ,
Spec : config . StepSpec {
Inputs : config . StepInputs {
2021-06-16 08:43:30 +02:00
Secrets : [ ] config . StepSecrets {
{ 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 : false } } } ,
{ Name : "dockerCredentialsId" , Description : "Jenkins 'Username with password' credentials ID containing user and password to authenticate to the Docker registry." , Type : "jenkins" } ,
} ,
2020-07-31 12:38:00 +02:00
Parameters : [ ] config . StepParameters {
{
Name : "apiEndpoint" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : true ,
Aliases : [ ] config . Alias { { Name : "cfApiEndpoint" } , { Name : "cloudFoundry/apiEndpoint" } } ,
2021-06-16 08:43:30 +02:00
Default : ` https://api.cf.eu10.hana.ondemand.com ` ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "appName" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { { Name : "cfAppName" } , { Name : "cloudFoundry/appName" } } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_appName" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "artifactVersion" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "commonPipelineEnvironment" ,
Param : "artifactVersion" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_artifactVersion" ) ,
2020-07-31 12:38:00 +02:00
} ,
2021-08-05 17:03:51 +02:00
{
Name : "commitHash" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "commonPipelineEnvironment" ,
Param : "git/headCommitId" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
Default : os . Getenv ( "PIPER_commitHash" ) ,
} ,
2020-07-31 12:38:00 +02:00
{
Name : "cfHome" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_cfHome" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "cfNativeDeployParameters" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_cfNativeDeployParameters" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "cfPluginHome" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_cfPluginHome" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "deployDockerImage" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_deployDockerImage" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "deployTool" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
2020-08-24 18:10:45 +02:00
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_deployTool" ) ,
2020-08-24 18:10:45 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "buildTool" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "commonPipelineEnvironment" ,
Param : "buildTool" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_buildTool" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "deployType" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : ` standard ` ,
2020-07-31 12:38:00 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "dockerPassword" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "dockerCredentialsId" ,
Param : "password" ,
Type : "secret" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_dockerPassword" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "dockerUsername" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "dockerCredentialsId" ,
Param : "username" ,
Type : "secret" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_dockerUsername" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "keepOldInstance" ,
ResourceRef : [ ] config . ResourceReference { } ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" } ,
Type : "bool" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : false ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "loginParameters" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_loginParameters" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "manifest" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { { Name : "cfManifest" } , { Name : "cloudFoundry/manifest" } } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_manifest" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "manifestVariables" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "[]string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { { Name : "cfManifestVariables" } , { Name : "cloudFoundry/manifestVariables" } } ,
2021-06-16 08:43:30 +02:00
Default : [ ] string { } ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "manifestVariablesFiles" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "[]string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { { Name : "cfManifestVariablesFiles" } , { Name : "cloudFoundry/manifestVariablesFiles" } } ,
2021-06-16 08:43:30 +02:00
Default : [ ] string { ` manifest-variables.yml ` } ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "mtaDeployParameters" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : ` -f ` ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "mtaExtensionDescriptor" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { { Name : "cloudFoundry/mtaExtensionDescriptor" } } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_mtaExtensionDescriptor" ) ,
2020-07-31 12:38:00 +02:00
} ,
2021-01-12 10:39:04 +02:00
{
Name : "mtaExtensionCredentials" ,
ResourceRef : [ ] config . ResourceReference { } ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
Type : "map[string]interface{}" ,
Mandatory : false ,
2021-06-14 10:57:44 +02:00
Aliases : [ ] config . Alias { { Name : "cloudFoundry/mtaExtensionCredentials" } } ,
2021-01-12 10:39:04 +02:00
} ,
2020-07-31 12:38:00 +02:00
{
2020-09-16 14:50:09 +02:00
Name : "mtaPath" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "commonPipelineEnvironment" ,
Param : "mtarFilePath" ,
} ,
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_mtaPath" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "org" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : true ,
Aliases : [ ] config . Alias { { Name : "cfOrg" } , { Name : "cloudFoundry/org" } } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_org" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "password" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "cfCredentialsId" ,
Param : "password" ,
Type : "secret" ,
} ,
2020-10-13 14:14:47 +02:00
{
2021-09-21 13:06:32 +02:00
Name : "cloudfoundryVaultSecretName" ,
Type : "vaultSecret" ,
Default : "cloudfoundry-$(org)-$(space)" ,
2020-10-13 14:14:47 +02:00
} ,
2020-09-16 14:50:09 +02:00
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" } ,
Type : "string" ,
Mandatory : true ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_password" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "smokeTestScript" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : ` blueGreenCheckScript.sh ` ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "smokeTestStatusCode" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "int" ,
Mandatory : false ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : 200 ,
2020-07-31 12:38:00 +02:00
} ,
{
Name : "space" ,
ResourceRef : [ ] config . ResourceReference { } ,
2020-08-24 18:10:45 +02:00
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" , "GENERAL" } ,
2020-07-31 12:38:00 +02:00
Type : "string" ,
Mandatory : true ,
Aliases : [ ] config . Alias { { Name : "cfSpace" } , { Name : "cloudFoundry/space" } } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_space" ) ,
2020-07-31 12:38:00 +02:00
} ,
{
2020-09-16 14:50:09 +02:00
Name : "username" ,
ResourceRef : [ ] config . ResourceReference {
{
Name : "cfCredentialsId" ,
Param : "username" ,
Type : "secret" ,
} ,
2020-10-13 14:14:47 +02:00
{
2021-09-21 13:06:32 +02:00
Name : "cloudfoundryVaultSecretName" ,
Type : "vaultSecret" ,
Default : "cloudfoundry-$(org)-$(space)" ,
2020-10-13 14:14:47 +02:00
} ,
2020-09-16 14:50:09 +02:00
} ,
Scope : [ ] string { "PARAMETERS" , "STAGES" , "STEPS" } ,
Type : "string" ,
Mandatory : true ,
Aliases : [ ] config . Alias { } ,
2021-06-16 08:43:30 +02:00
Default : os . Getenv ( "PIPER_username" ) ,
2020-07-31 12:38:00 +02:00
} ,
} ,
} ,
2020-11-20 09:13:59 +02:00
Containers : [ ] config . Container {
2021-02-11 10:31:25 +02:00
{ Name : "cfDeploy" , Image : "ppiper/cf-cli:6" } ,
2020-11-20 09:13:59 +02:00
} ,
Outputs : config . StepOutputs {
Resources : [ ] config . StepResources {
{
Name : "influx" ,
Type : "influx" ,
Parameters : [ ] map [ string ] interface { } {
2021-12-15 10:40:50 +02:00
{ "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" } } } ,
2020-11-20 09:13:59 +02:00
} ,
} ,
} ,
} ,
2020-07-31 12:38:00 +02:00
} ,
}
return theMetaData
}