mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-11-28 08:49:44 +02:00
add telemetry reporting to steps (#243)
add telemetry to all steps using ConfigurationHelper. Other steps need to be switched to ConfigurationHelper first. update docs
This commit is contained in:
parent
5ea6eac6ed
commit
71f7f05427
@ -32,7 +32,7 @@ Following data (non-personal) is collected for example:
|
||||
**We store the telemetry data for not longer than 6 months on premises of SAP SE.**
|
||||
|
||||
!!! note "Disable collection of telemetry data"
|
||||
If you do not want to send telemetry data which helps this open source project to improve you can easily deactivate this.
|
||||
If you do not want to send telemetry data you can easily deactivate this.
|
||||
|
||||
This is done with either of the following two ways:
|
||||
|
||||
|
@ -46,6 +46,9 @@ class ConfigurationHelper implements Serializable {
|
||||
if (parameters.size() > 0 && compatibleParameters.size() > 0) {
|
||||
parameters = ConfigurationMerger.merge(handleCompatibility(step, compatibleParameters, parameters), null, parameters)
|
||||
}
|
||||
if (filter) {
|
||||
filter.add('collectTelemetryData')
|
||||
}
|
||||
config = ConfigurationMerger.merge(parameters, filter, config)
|
||||
return this
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ class ConfigurationHelperTest {
|
||||
public void testWithMandoryWithTrueConditionMissingValue() {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR missingKey')
|
||||
|
||||
|
||||
new ConfigurationHelper([verify: true])
|
||||
.withMandatoryProperty('missingKey', null, { c -> return c.get('verify') })
|
||||
}
|
||||
@ -269,4 +269,14 @@ class ConfigurationHelperTest {
|
||||
new ConfigurationHelper([existingKey: 'anyValue', verify: true])
|
||||
.withMandatoryProperty('existingKey', null, { c -> return c.get('verify') })
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTelemetryConfigurationAvailable() {
|
||||
Set filter = ['test']
|
||||
def configuration = new ConfigurationHelper([test: 'testValue'])
|
||||
.mixin([collectTelemetryData: false], filter)
|
||||
.use()
|
||||
|
||||
Assert.assertThat(configuration, hasEntry('collectTelemetryData', false))
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import groovy.transform.Field
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
|
||||
@Field String STEP_NAME = 'artifactSetVersion'
|
||||
@Field Set GENERAL_CONFIG_KEYS = ['collectTelemetryData']
|
||||
@Field Map CONFIG_KEY_COMPATIBILITY = [gitSshKeyCredentialsId: 'gitCredentialsId']
|
||||
@Field Set STEP_CONFIG_KEYS = [
|
||||
'artifactType',
|
||||
@ -60,7 +59,7 @@ def call(Map parameters = [:], Closure body = null) {
|
||||
.withMandatoryProperty('gitSshUrl')
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME, stepParam1: config.buildTool], config)
|
||||
new Utils().pushToSWA([step: STEP_NAME, stepParam1: config.buildTool, stepParam2: config.artifactType], config)
|
||||
|
||||
def artifactVersioning = ArtifactVersioning.getArtifactVersioning(config.buildTool, script, config)
|
||||
def currentVersion = artifactVersioning.getVersion()
|
||||
|
@ -1,4 +1,5 @@
|
||||
import com.sap.piper.GitUtils
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
import hudson.AbortException
|
||||
|
||||
@ -48,6 +49,8 @@ def call(parameters = [:]) {
|
||||
|
||||
Map configuration = configHelper.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], configuration)
|
||||
|
||||
def changeId = configuration.changeDocumentId
|
||||
|
||||
if(changeId?.trim()) {
|
||||
|
@ -46,6 +46,8 @@ def call(Map parameters = [:]) {
|
||||
.withMandatoryProperty('cloudFoundry/credentialsId')
|
||||
.use()
|
||||
|
||||
utils.pushToSWA([step: STEP_NAME, stepParam1: config.deployTool, stepParam2: config.deployType], config)
|
||||
|
||||
echo "[${STEP_NAME}] General parameters: deployTool=${config.deployTool}, deployType=${config.deployType}, cfApiEndpoint=${config.cloudFoundry.apiEndpoint}, cfOrg=${config.cloudFoundry.org}, cfSpace=${config.cloudFoundry.space}, cfCredentialsId=${config.cloudFoundry.credentialsId}, deployUser=${config.deployUser}"
|
||||
|
||||
utils.unstash 'deployDescriptor'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
|
||||
@ -22,11 +22,14 @@ def call(Map parameters = [:]) {
|
||||
// load default & individual configuration
|
||||
Map config = ConfigurationHelper
|
||||
.loadStepDefaults(this)
|
||||
.mixinGeneralConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
||||
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
||||
.mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, STEP_CONFIG_KEYS)
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], config)
|
||||
|
||||
List collectionList = findFiles(glob: config.newmanCollection)?.toList()
|
||||
|
||||
if (!config.dockerImage.isEmpty()) {
|
||||
|
@ -31,6 +31,8 @@ def call(Map parameters = [:]) {
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], config)
|
||||
|
||||
// store files to be checked with checkmarx
|
||||
if (config.runCheckmarx) {
|
||||
utils.stash(
|
||||
|
@ -30,6 +30,8 @@ def call(Map parameters = [:]) {
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], config)
|
||||
|
||||
if (config.runOpaTests){
|
||||
utils.stash('opa5', config.stashIncludes?.get('opa5')?config.stashIncludes.opa5:'**/*.*', config.stashExcludes?.get('opa5')?config.stashExcludes.opa5:'')
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ import com.sap.piper.ConfigurationHelper
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field String STEP_NAME = 'setupPipelineEnvironment'
|
||||
@Field String STEP_NAME = 'setupCommonPipelineEnvironment'
|
||||
@Field Set GENERAL_CONFIG_KEYS = ['collectTelemetryData']
|
||||
|
||||
def call(Map parameters = [:]) {
|
||||
|
||||
handlePipelineStepErrors (stepName: 'setupCommonPipelineEnvironment', stepParameters: parameters) {
|
||||
handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) {
|
||||
|
||||
def script = parameters.script
|
||||
|
||||
@ -22,7 +22,7 @@ def call(Map parameters = [:]) {
|
||||
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], config)
|
||||
new Utils().pushToSWA([step: STEP_NAME, stepParam4: parameters.customDefaults?'true':'false'], config)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@ def call(Map parameters = [:]) {
|
||||
.withMandatoryProperty('snykCredentialsId')
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], config)
|
||||
|
||||
utils.unstashAll(config.stashContent)
|
||||
|
||||
switch(config.scanType) {
|
||||
|
@ -3,7 +3,7 @@ import com.cloudbees.groovy.cps.NonCPS
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
import com.sap.piper.ConfigurationMerger
|
||||
import com.sap.piper.MapUtils
|
||||
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field List TOOLS = [
|
||||
@ -30,10 +30,13 @@ def call(Map parameters = [:]) {
|
||||
// load default & individual configuration
|
||||
Map configuration = ConfigurationHelper
|
||||
.loadStepDefaults(this)
|
||||
.mixinGeneralConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
||||
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], configuration)
|
||||
|
||||
// UNIT TESTS
|
||||
publishJUnitReport(configuration.get('junit'))
|
||||
// CODE COVERAGE
|
||||
|
@ -1,4 +1,5 @@
|
||||
import com.sap.piper.GitUtils
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
@ -44,6 +45,8 @@ def call(parameters = [:]) {
|
||||
|
||||
Map configuration = configHelper.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], configuration)
|
||||
|
||||
def changeDocumentId = configuration.changeDocumentId
|
||||
|
||||
if(changeDocumentId?.trim()) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import com.sap.piper.GitUtils
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
@ -45,6 +46,8 @@ def call(parameters = [:]) {
|
||||
|
||||
Map configuration = configHelper.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], configuration)
|
||||
|
||||
def transportRequestId = configuration.transportRequestId
|
||||
|
||||
if(transportRequestId?.trim()) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import com.sap.piper.GitUtils
|
||||
import com.sap.piper.Utils
|
||||
import groovy.transform.Field
|
||||
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
@ -50,6 +51,8 @@ def call(parameters = [:]) {
|
||||
|
||||
Map configuration = configHelper.use()
|
||||
|
||||
new Utils().pushToSWA([step: STEP_NAME], configuration)
|
||||
|
||||
def changeDocumentId = configuration.changeDocumentId
|
||||
|
||||
if(changeDocumentId?.trim()) {
|
||||
|
Loading…
Reference in New Issue
Block a user