1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-07-15 01:34:38 +02:00

Analytics: add step parameter keys (#442)

* add stepParamKey values

* camelCase
This commit is contained in:
Christopher Fenner
2019-01-21 08:47:34 +01:00
committed by GitHub
parent e452f79368
commit 10267ce7d1
21 changed files with 129 additions and 40 deletions

View File

@ -61,7 +61,15 @@ void call(Map parameters = [:], Closure body = null) {
config = configHelper.addIfEmpty('timestamp', getTimestamp(config.timestampTemplate)) config = configHelper.addIfEmpty('timestamp', getTimestamp(config.timestampTemplate))
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, stepParam1: config.buildTool, stepParam2: config.artifactType, stepParam3: parameters?.script == null], config) new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'buildTool',
stepParam1: config.buildTool,
stepParamKey2: 'artifactType',
stepParam2: config.artifactType,
stepParamKey3: 'scriptMissing',
stepParam3: parameters?.script == null
], config)
def artifactVersioning = ArtifactVersioning.getArtifactVersioning(config.buildTool, script, config) def artifactVersioning = ArtifactVersioning.getArtifactVersioning(config.buildTool, script, config)
def currentVersion = artifactVersioning.getVersion() def currentVersion = artifactVersioning.getVersion()
@ -87,7 +95,7 @@ void call(Map parameters = [:], Closure body = null) {
:script.commonPipelineEnvironment.getGitSshUrl()) :script.commonPipelineEnvironment.getGitSshUrl())
.withMandatoryProperty('gitSshUrl') .withMandatoryProperty('gitSshUrl')
.use() .use()
def gitConfig = [] def gitConfig = []
if(config.gitUserEMail) gitConfig.add("-c user.email=\"${config.gitUserEMail}\"") if(config.gitUserEMail) gitConfig.add("-c user.email=\"${config.gitUserEMail}\"")

View File

@ -43,8 +43,11 @@ void call(Map parameters = [:]) {
.use() .use()
// report to SWA // report to SWA
utils.pushToSWA([step: STEP_NAME, utils.pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
script.commonPipelineEnvironment.setInfluxStepData('bats', false) script.commonPipelineEnvironment.setInfluxStepData('bats', false)

View File

@ -94,8 +94,11 @@ void call(parameters = [:]) {
*/ */
.withMandatoryProperty('changeManagement/endpoint') .withMandatoryProperty('changeManagement/endpoint')
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
def changeId = getChangeDocumentId(cm, script, configuration) def changeId = getChangeDocumentId(cm, script, configuration)

View File

@ -41,8 +41,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
// JAVA // JAVA
report('PmdPublisher', configuration.pmd, configuration.archive) report('PmdPublisher', configuration.pmd, configuration.archive)

View File

@ -54,7 +54,15 @@ void call(Map parameters = [:]) {
.withMandatoryProperty('cloudFoundry/credentialsId') .withMandatoryProperty('cloudFoundry/credentialsId')
.use() .use()
utils.pushToSWA([step: STEP_NAME, stepParam1: config.deployTool, stepParam2: config.deployType, stepParam3: parameters?.script == null], config) utils.pushToSWA([
step: STEP_NAME,
stepParamKey1: 'deployTool',
stepParam1: config.deployTool,
stepParamKey2: 'deployType',
stepParam2: config.deployType,
stepParamKey3: 'scriptMissing',
stepParam3: parameters?.script == null
], 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}" 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}"
@ -159,7 +167,7 @@ def deployCfNative (config) {
} }
sh """#!/bin/bash sh """#!/bin/bash
set +x set +x
set -e set -e
export HOME=${config.dockerWorkspace} export HOME=${config.dockerWorkspace}
cf login -u \"${username}\" -p '${password}' -a ${config.cloudFoundry.apiEndpoint} -o \"${config.cloudFoundry.org}\" -s \"${config.cloudFoundry.space}\" cf login -u \"${username}\" -p '${password}' -a ${config.cloudFoundry.apiEndpoint} -o \"${config.cloudFoundry.org}\" -s \"${config.cloudFoundry.space}\"

View File

@ -47,7 +47,13 @@ void call(Map parameters = [:]) {
.dependingOn('buildTool').mixin('testOptions') .dependingOn('buildTool').mixin('testOptions')
.use() .use()
utils.pushToSWA([step: STEP_NAME, stepParam1: config.buildTool, stepParam2: config.dockerName], config) utils.pushToSWA([
step: STEP_NAME,
stepParamKey1: 'buildTool',
stepParam1: config.buildTool,
stepParamKey2: 'dockerName',
stepParam2: config.dockerName
], config)
if(!config.dockerEnvVars.TARGET_SERVER_URL && config.testServerUrl) if(!config.dockerEnvVars.TARGET_SERVER_URL && config.testServerUrl)
config.dockerEnvVars.TARGET_SERVER_URL = config.testServerUrl config.dockerEnvVars.TARGET_SERVER_URL = config.testServerUrl

View File

@ -44,8 +44,11 @@ void call(Map parameters = [:]) {
.addIfNull('customDataMapTags', script.commonPipelineEnvironment.getInfluxCustomDataMapTags()) .addIfNull('customDataMapTags', script.commonPipelineEnvironment.getInfluxCustomDataMapTags())
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
if (!config.artifactVersion) { if (!config.artifactVersion) {
//this takes care that terminated builds due to milestone-locking do not cause an error //this takes care that terminated builds due to milestone-locking do not cause an error

View File

@ -37,8 +37,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
String command = "mvn" String command = "mvn"

View File

@ -36,8 +36,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) { dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) {
def java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1') def java = new ToolDescriptor('Java', 'JAVA_HOME', '', '/bin/', 'java', '1.8.0', '-version 2>&1')

View File

@ -104,9 +104,13 @@ void call(parameters = [:]) {
utils.pushToSWA([ utils.pushToSWA([
step: STEP_NAME, step: STEP_NAME,
stepParamKey1: 'deployMode',
stepParam1: configuration.deployMode == 'mta'?'mta':'war', // ['mta', 'warParams', 'warPropertiesFile'] stepParam1: configuration.deployMode == 'mta'?'mta':'war', // ['mta', 'warParams', 'warPropertiesFile']
stepParamKey2: 'warAction',
stepParam2: configuration.warAction == 'rolling-update'?'blue-green':'standard', // ['deploy', 'deploy-mta', 'rolling-update'] stepParam2: configuration.warAction == 'rolling-update'?'blue-green':'standard', // ['deploy', 'deploy-mta', 'rolling-update']
stepParamKey3: 'scriptMissing',
stepParam3: parameters?.script == null, stepParam3: parameters?.script == null,
stepParamKey4: 'legacyConfig',
stepParam4: ! stepCompatibilityConfiguration.isEmpty(), stepParam4: ! stepCompatibilityConfiguration.isEmpty(),
], configuration) ], configuration)

View File

@ -79,8 +79,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
config.stashContent = config.testRepository config.stashContent = config.testRepository
?[GitUtils.handleTestRepository(this, config)] ?[GitUtils.handleTestRepository(this, config)]

View File

@ -34,8 +34,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
// store files to be checked with checkmarx // store files to be checked with checkmarx
if (config.runCheckmarx) { if (config.runCheckmarx) {

View File

@ -32,8 +32,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
if (config.runOpaTests){ if (config.runOpaTests){
utils.stash('opa5', config.stashIncludes?.get('opa5')?config.stashIncludes.opa5:'**/*.*', config.stashExcludes?.get('opa5')?config.stashExcludes.opa5:'') utils.stash('opa5', config.stashIncludes?.get('opa5')?config.stashIncludes.opa5:'**/*.*', config.stashExcludes?.get('opa5')?config.stashExcludes.opa5:'')

View File

@ -103,6 +103,19 @@ private void executeStage(script, originalStage, stageName, config, utils) {
deleteDir() deleteDir()
def duration = System.currentTimeMillis() - startTime def duration = System.currentTimeMillis() - startTime
utils.pushToSWA([eventType: 'library-os-stage', stageName: stageName, stepParam1: "${script.currentBuild.currentResult}", stepParam2: "${startTime}", stepParam3: "${duration}", stepParam4: "${projectExtensions}", stepParam5: "${globalExtensions}"], config) utils.pushToSWA([
eventType: 'library-os-stage',
stageName: stageName,
stepParamKey1: 'buildResult',
stepParam1: "${script.currentBuild.currentResult}",
stepParamKey2: 'stageStartTime',
stepParam2: "${startTime}",
stepParamKey3: 'stageDuration',
stepParam3: "${duration}",
stepParamKey4: 'projectExtension',
stepParam4: "${projectExtensions}",
stepParamKey5: 'globalExtension',
stepParam5: "${globalExtensions}"
], config)
} }
} }

View File

@ -48,8 +48,11 @@ void call(Map parameters = [:], Closure body) {
.dependingOn('buildTool').mixin('dockerWorkspace') .dependingOn('buildTool').mixin('dockerWorkspace')
.use() .use()
utils.pushToSWA([step: STEP_NAME, utils.pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
dockerExecute( dockerExecute(
script: script, script: script,

View File

@ -24,9 +24,13 @@ void call(Map parameters = [:]) {
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS) .mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
.use() .use()
(parameters.utils ?: new Utils()) (parameters.utils ?: new Utils()).pushToSWA([
.pushToSWA([step: STEP_NAME, stepParam4: parameters.customDefaults?'true':'false', step: STEP_NAME,
stepParam5: Boolean.toString( ! (script?.commonPipelineEnvironment?.getConfigProperties() ?: [:]).isEmpty())], config) stepParamKey4: 'customDefaults',
stepParam4: parameters.customDefaults?'true':'false',
stepParamKey5: 'legacyConfig',
stepParam5: Boolean.toString( ! (script?.commonPipelineEnvironment?.getConfigProperties() ?: [:]).isEmpty())
], config)
} }
} }

View File

@ -38,8 +38,11 @@ void call(Map parameters = [:]) {
.withMandatoryProperty('snykCredentialsId') .withMandatoryProperty('snykCredentialsId')
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], config) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
utils.unstashAll(config.stashContent) utils.unstashAll(config.stashContent)

View File

@ -40,8 +40,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS) .mixin(parameters, PARAMETER_KEYS)
.use() .use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
// UNIT TESTS // UNIT TESTS
publishJUnitReport(configuration.get('junit')) publishJUnitReport(configuration.get('junit'))

View File

@ -63,8 +63,11 @@ void call(parameters = [:]) {
def changeDocumentId = null def changeDocumentId = null
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
if(backendType == BackendType.SOLMAN) { if(backendType == BackendType.SOLMAN) {

View File

@ -58,8 +58,11 @@ void call(parameters = [:]) {
configuration = configHelper.use() configuration = configHelper.use()
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: parameters?.script == null], configuration) step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
def changeDocumentId = null def changeDocumentId = null
def transportRequestId = getTransportRequestId(cm, script, configuration) def transportRequestId = getTransportRequestId(cm, script, configuration)

View File

@ -61,9 +61,13 @@ void call(parameters = [:]) {
.withMandatoryProperty('changeManagement/git/format') .withMandatoryProperty('changeManagement/git/format')
.withMandatoryProperty('filePath') .withMandatoryProperty('filePath')
new Utils().pushToSWA([step: STEP_NAME, new Utils().pushToSWA([
stepParam1: configuration.changeManagement.type, step: STEP_NAME,
stepParam2: parameters?.script == null], configuration) stepParamKey1: 'changeManagementType',
stepParam1: configuration.changeManagement.type,
stepParamKey2: 'scriptMissing',
stepParam2: parameters?.script == null
], configuration)
def changeDocumentId = null def changeDocumentId = null