1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-11-24 08:32:32 +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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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))
.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 currentVersion = artifactVersioning.getVersion()
@ -87,7 +95,7 @@ void call(Map parameters = [:], Closure body = null) {
:script.commonPipelineEnvironment.getGitSshUrl())
.withMandatoryProperty('gitSshUrl')
.use()
def gitConfig = []
if(config.gitUserEMail) gitConfig.add("-c user.email=\"${config.gitUserEMail}\"")

View File

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

View File

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

View File

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

View File

@ -54,7 +54,15 @@ void call(Map parameters = [:]) {
.withMandatoryProperty('cloudFoundry/credentialsId')
.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}"
@ -159,7 +167,7 @@ def deployCfNative (config) {
}
sh """#!/bin/bash
set +x
set +x
set -e
export HOME=${config.dockerWorkspace}
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')
.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)
config.dockerEnvVars.TARGET_SERVER_URL = config.testServerUrl

View File

@ -44,8 +44,11 @@ void call(Map parameters = [:]) {
.addIfNull('customDataMapTags', script.commonPipelineEnvironment.getInfluxCustomDataMapTags())
.use()
new Utils().pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], config)
new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
if (!config.artifactVersion) {
//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)
.use()
new Utils().pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], configuration)
new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
String command = "mvn"

View File

@ -36,8 +36,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS)
.use()
new Utils().pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], configuration)
new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], configuration)
dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) {
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([
step: STEP_NAME,
stepParamKey1: 'deployMode',
stepParam1: configuration.deployMode == 'mta'?'mta':'war', // ['mta', 'warParams', 'warPropertiesFile']
stepParamKey2: 'warAction',
stepParam2: configuration.warAction == 'rolling-update'?'blue-green':'standard', // ['deploy', 'deploy-mta', 'rolling-update']
stepParamKey3: 'scriptMissing',
stepParam3: parameters?.script == null,
stepParamKey4: 'legacyConfig',
stepParam4: ! stepCompatibilityConfiguration.isEmpty(),
], configuration)

View File

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

View File

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

View File

@ -32,8 +32,11 @@ void call(Map parameters = [:]) {
.mixin(parameters, PARAMETER_KEYS)
.use()
new Utils().pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], config)
new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
if (config.runOpaTests){
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()
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')
.use()
utils.pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], config)
utils.pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
dockerExecute(
script: script,

View File

@ -24,9 +24,13 @@ void call(Map parameters = [:]) {
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
.use()
(parameters.utils ?: new Utils())
.pushToSWA([step: STEP_NAME, stepParam4: parameters.customDefaults?'true':'false',
stepParam5: Boolean.toString( ! (script?.commonPipelineEnvironment?.getConfigProperties() ?: [:]).isEmpty())], config)
(parameters.utils ?: new Utils()).pushToSWA([
step: STEP_NAME,
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')
.use()
new Utils().pushToSWA([step: STEP_NAME,
stepParam1: parameters?.script == null], config)
new Utils().pushToSWA([
step: STEP_NAME,
stepParamKey1: 'scriptMissing',
stepParam1: parameters?.script == null
], config)
utils.unstashAll(config.stashContent)

View File

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

View File

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

View File

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

View File

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