1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/vars/piperPipelineStagePost.groovy
Christopher Fenner 5bf7cda940
add new step piperPublishNotifications (#652)
* add new step for notification publication

* add test cases

* add helper method

* correct import

* Update pom.xml

* add step to post section

* add step piperPublishNotifications

* move step to end of pipeline to gather all findings

* use handlePipelineStepErrors step

* use commonPipelineEnvironment

* correct reporting

* add configuration

* fix typos

* fix rule setup

* remove test scope

* add method to fetch full build log

* add methods for warnings-ng parser creation

* remove warnings plugin coding

* add default parser settings

* change parameter handling for parser creation

* adapt step

* fix parser creation

* use ParserConfig.contains

* use correct parameter name

* correct parser regex

* change issue creation

* use classloader

* fix typo

* Revert "fix typo"

This reverts commit 446a201ae4.

* Revert "use classloader"

This reverts commit a896487032.

* rename step to piperPublishWarnings

* extract recordIssuesSettings to defaults

* make addWarningsNGParser non-static

* remove node

* adjust test case

* add docs

* rename log file

* fix tests

* fix typos

* rename parameter

* add import for IOUtils

* check plugin activation

* add comment for class loader usage
2019-07-18 12:09:54 +02:00

54 lines
2.0 KiB
Groovy

import com.sap.piper.ConfigurationHelper
import com.sap.piper.GenerateDocumentation
import com.sap.piper.Utils
import groovy.transform.Field
import static com.sap.piper.Prerequisites.checkScript
@Field String STEP_NAME = getClass().getName()
@Field Set GENERAL_CONFIG_KEYS = []
@Field STAGE_STEP_KEYS = []
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus(STAGE_STEP_KEYS)
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
/**
* In this stage reporting actions like mail notification or telemetry reporting are executed.
*
* This stage contains following steps:
* - [influxWriteData](./influxWriteData.md)
* - [mailSendNotification](./mailSendNotification.md)
*
* !!! note
* This stage is meant to be used in a [post](https://jenkins.io/doc/book/pipeline/syntax/#post) section of a pipeline.
*/
@GenerateDocumentation
void call(Map parameters = [:]) {
def script = checkScript(this, parameters) ?: this
def utils = parameters.juStabUtils ?: new Utils()
def stageName = parameters.stageName?:env.STAGE_NAME
// ease handling extension
stageName = stageName.replace('Declarative: ', '')
Map config = ConfigurationHelper.newInstance(this)
.loadStepDefaults()
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STEP_CONFIG_KEYS)
.mixin(parameters, PARAMETER_KEYS)
.use()
piperStageWrapper (script: script, stageName: stageName, stageLocking: false) {
// telemetry reporting
utils.pushToSWA([step: STEP_NAME], config)
influxWriteData script: script
if(env.BRANCH_NAME == parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch) {
if(parameters.script.commonPipelineEnvironment.configuration.runStep?.get('Post Actions')?.slackSendNotification) {
slackSendNotification script: parameters.script
}
}
mailSendNotification script: script
piperPublishWarnings script: script
}
}