mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-02-01 13:18:04 +02:00
Update Cloud SDK stage defaults (#1959)
This change updates the Cloud SDK stage defaults, makes the piperPipelineStageMavenStaticCodeChecks use the step condition and adds the onlyRunInProductiveBranch configuration option to npmExecuteEndToEndTests step.
This commit is contained in:
parent
139e34cd37
commit
a035690f3d
@ -1,4 +1,39 @@
|
|||||||
stages:
|
stages:
|
||||||
|
mavenStaticCodeChecks:
|
||||||
|
stepConditions:
|
||||||
|
mavenExecuteStaticCodeChecks:
|
||||||
|
filePattern: 'pom.xml'
|
||||||
|
lint:
|
||||||
|
extensionExists: true
|
||||||
|
stepConditions:
|
||||||
|
lint:
|
||||||
|
filePattern:
|
||||||
|
- '**/*.js'
|
||||||
|
- '**/*.jsx'
|
||||||
|
- '**/*.ts'
|
||||||
|
- '**/*.tsx'
|
||||||
|
backendIntegrationTests:
|
||||||
|
stepConditions:
|
||||||
|
npmExecuteScripts:
|
||||||
|
npmScripts:
|
||||||
|
- 'ci-it-backend'
|
||||||
|
mavenExecuteIntegration:
|
||||||
|
filePattern: 'integration-tests/pom.xml'
|
||||||
|
frontendIntegrationTests:
|
||||||
|
stepConditions:
|
||||||
|
npmExecuteScripts:
|
||||||
|
npmScripts:
|
||||||
|
- 'ci-it-frontend'
|
||||||
|
frontendUnitTests:
|
||||||
|
stepConditions:
|
||||||
|
frontendUnitTests:
|
||||||
|
npmScripts:
|
||||||
|
- 'ci-test'
|
||||||
|
- 'ci-frontend-unit-test'
|
||||||
|
npmAudit:
|
||||||
|
stepConditions:
|
||||||
|
npmAudit:
|
||||||
|
filePattern: '**/package.json'
|
||||||
endToEndTests:
|
endToEndTests:
|
||||||
stepConditions:
|
stepConditions:
|
||||||
multicloudDeploy:
|
multicloudDeploy:
|
||||||
@ -23,7 +58,48 @@ stages:
|
|||||||
npmExecuteEndToEndTests:
|
npmExecuteEndToEndTests:
|
||||||
configKeys:
|
configKeys:
|
||||||
- 'appUrls'
|
- 'appUrls'
|
||||||
|
performanceTests:
|
||||||
|
stepConditions:
|
||||||
|
performanceTests:
|
||||||
|
configKeys:
|
||||||
|
- 'cfTargets'
|
||||||
|
- 'neoTargets'
|
||||||
|
checkmarxScan:
|
||||||
|
onlyProductiveBranch: true
|
||||||
|
stepConditions:
|
||||||
|
checkmarxScan:
|
||||||
|
configKeys:
|
||||||
|
- 'groupId'
|
||||||
|
sonarQubeScan:
|
||||||
|
stepConditions:
|
||||||
|
sonarQubeScan:
|
||||||
|
configKeys:
|
||||||
|
- 'projectKey'
|
||||||
|
- 'instance'
|
||||||
|
additionalTools:
|
||||||
|
onlyProductiveBranch: true
|
||||||
|
extensionExists: true
|
||||||
|
whitesourceScan:
|
||||||
|
onlyProductiveBranch: true
|
||||||
|
stepConditions:
|
||||||
|
whitesourceScan:
|
||||||
|
configKeys:
|
||||||
|
- 'product'
|
||||||
|
- 'credentialsId'
|
||||||
|
fortifyScan:
|
||||||
|
onlyProductiveBranch: true
|
||||||
|
stepConditions:
|
||||||
|
fortifyScan:
|
||||||
|
configKeys:
|
||||||
|
- 'fortifyCredentialsId'
|
||||||
|
detectScan:
|
||||||
|
onlyProductiveBranch: true
|
||||||
|
stepConditions:
|
||||||
|
detectScan:
|
||||||
|
configKeys:
|
||||||
|
- 'detectTokenCredentialsId'
|
||||||
productionDeployment:
|
productionDeployment:
|
||||||
|
onlyProductiveBranch: true
|
||||||
stepConditions:
|
stepConditions:
|
||||||
multicloudDeploy:
|
multicloudDeploy:
|
||||||
configKeys:
|
configKeys:
|
||||||
@ -36,6 +112,11 @@ stages:
|
|||||||
neoDeploy:
|
neoDeploy:
|
||||||
configKeys:
|
configKeys:
|
||||||
- 'neo/account'
|
- 'neo/account'
|
||||||
|
tmsUpload:
|
||||||
|
configKeys:
|
||||||
|
- 'credentialsId'
|
||||||
|
- 'mtaPath'
|
||||||
|
- 'nodeName'
|
||||||
healthExecuteCheck:
|
healthExecuteCheck:
|
||||||
configKeys:
|
configKeys:
|
||||||
- 'testServerUrl'
|
- 'testServerUrl'
|
||||||
@ -45,13 +126,20 @@ stages:
|
|||||||
githubPublishRelease:
|
githubPublishRelease:
|
||||||
configKeys:
|
configKeys:
|
||||||
- 'githubTokenCredentialsId'
|
- 'githubTokenCredentialsId'
|
||||||
backendIntegrationTests:
|
artifactDeployment:
|
||||||
|
onlyProductiveBranch: true
|
||||||
stepConditions:
|
stepConditions:
|
||||||
npmExecuteScripts:
|
artifactDeployment:
|
||||||
npmScripts: 'ci-it-backend'
|
configKeys:
|
||||||
mavenExecuteIntegration:
|
- 'nexus'
|
||||||
filePattern: 'integration-tests/pom.xml'
|
postPipelineHook:
|
||||||
frontendIntegrationTests:
|
|
||||||
stepConditions:
|
stepConditions:
|
||||||
npmExecuteScripts:
|
postPipelineHook:
|
||||||
npmScripts: 'ci-it-frontend'
|
configKeys:
|
||||||
|
- 'enabled'
|
||||||
|
archiveReport:
|
||||||
|
stepConditions:
|
||||||
|
archiveReport:
|
||||||
|
filePattern:
|
||||||
|
- 'mta.yaml'
|
||||||
|
- 'pom.xml'
|
||||||
|
@ -11,7 +11,11 @@ import static com.sap.piper.Prerequisites.checkScript
|
|||||||
|
|
||||||
@Field Set GENERAL_CONFIG_KEYS = [
|
@Field Set GENERAL_CONFIG_KEYS = [
|
||||||
/** Executes the deployments in parallel.*/
|
/** Executes the deployments in parallel.*/
|
||||||
'parallelExecution'
|
'parallelExecution',
|
||||||
|
/**
|
||||||
|
* The branch used as productive branch, defaults to master.
|
||||||
|
*/
|
||||||
|
'productiveBranch'
|
||||||
]
|
]
|
||||||
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus([
|
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus([
|
||||||
/**
|
/**
|
||||||
@ -31,7 +35,13 @@ import static com.sap.piper.Prerequisites.checkScript
|
|||||||
/**
|
/**
|
||||||
* Script to be executed from package.json.
|
* Script to be executed from package.json.
|
||||||
*/
|
*/
|
||||||
'runScript'])
|
'runScript',
|
||||||
|
/**
|
||||||
|
* Boolean to indicate whether the step should only be executed in the productive branch or not.
|
||||||
|
* @possibleValues `true`, `false`
|
||||||
|
*/
|
||||||
|
'onlyRunInProductiveBranch'
|
||||||
|
])
|
||||||
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
||||||
|
|
||||||
@Field Map CONFIG_KEY_COMPATIBILITY = [parallelExecution: 'features/parallelTestExecution']
|
@Field Map CONFIG_KEY_COMPATIBILITY = [parallelExecution: 'features/parallelTestExecution']
|
||||||
@ -78,6 +88,10 @@ void call(Map parameters = [:]) {
|
|||||||
error "[${STEP_NAME}] No runScript was defined."
|
error "[${STEP_NAME}] No runScript was defined."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.onlyRunInProductiveBranch && (config.productiveBranch != env.BRANCH_NAME)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < config.appUrls.size(); i++) {
|
for (int i = 0; i < config.appUrls.size(); i++) {
|
||||||
List credentials = []
|
List credentials = []
|
||||||
def appUrl = config.appUrls[i]
|
def appUrl = config.appUrls[i]
|
||||||
@ -117,7 +131,7 @@ void call(Map parameters = [:]) {
|
|||||||
|
|
||||||
if (cucumberFiles.size() > 0) {
|
if (cucumberFiles.size() > 0) {
|
||||||
testsPublishResults script: script, cucumber: [active: true, archive: true]
|
testsPublishResults script: script, cucumber: [active: true, archive: true]
|
||||||
} else if (junitFiles.size() > 0){
|
} else if (junitFiles.size() > 0) {
|
||||||
testsPublishResults script: script, junit: [active: true, archive: true]
|
testsPublishResults script: script, junit: [active: true, archive: true]
|
||||||
} else {
|
} else {
|
||||||
echo "[${STEP_NAME}] No JUnit or cucumber report files found, skipping report visualization."
|
echo "[${STEP_NAME}] No JUnit or cucumber report files found, skipping report visualization."
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import com.sap.piper.ConfigurationLoader
|
import com.sap.piper.ConfigurationHelper
|
||||||
import com.sap.piper.GenerateStageDocumentation
|
import com.sap.piper.GenerateDocumentation
|
||||||
import com.sap.piper.QualityCheck
|
import com.sap.piper.Utils
|
||||||
import com.sap.piper.ReportAggregator
|
|
||||||
|
|
||||||
import static com.sap.piper.Prerequisites.checkScript
|
import static com.sap.piper.Prerequisites.checkScript
|
||||||
|
|
||||||
@ -9,20 +8,41 @@ import groovy.transform.Field
|
|||||||
|
|
||||||
@Field String STEP_NAME = getClass().getName()
|
@Field String STEP_NAME = getClass().getName()
|
||||||
|
|
||||||
|
@Field STAGE_STEP_KEYS = [
|
||||||
|
/** Executes static code checks for Maven based projects. The plugins SpotBugs and PMD are used. */
|
||||||
|
'mavenExecuteStaticCodeChecks'
|
||||||
|
]
|
||||||
@Field Set GENERAL_CONFIG_KEYS = []
|
@Field Set GENERAL_CONFIG_KEYS = []
|
||||||
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS
|
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus(STAGE_STEP_KEYS)
|
||||||
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute static code checks for Maven based projects. This stage enforces SAP Cloud SDK specific PND rulesets as well as SpotBugs include filter.
|
* Execute static code checks for Maven based projects. This stage enforces SAP Cloud SDK specific PND rulesets as well as SpotBugs include filter.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@GenerateStageDocumentation(defaultStageName = 'mavenExecuteStaticCodeChecks')
|
@GenerateDocumentation
|
||||||
void call(Map parameters = [:]) {
|
void call(Map parameters = [:]) {
|
||||||
String stageName = 'mavenExecuteStaticCodeChecks'
|
|
||||||
final script = checkScript(this, parameters) ?: null
|
final script = checkScript(this, parameters) ?: null
|
||||||
|
|
||||||
|
def utils = parameters.juStabUtils ?: new Utils()
|
||||||
|
|
||||||
|
def stageName = parameters.stageName?:env.STAGE_NAME
|
||||||
|
|
||||||
|
Map config = ConfigurationHelper.newInstance(this)
|
||||||
|
.loadStepDefaults()
|
||||||
|
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
|
||||||
|
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STEP_CONFIG_KEYS)
|
||||||
|
.mixin(parameters, PARAMETER_KEYS)
|
||||||
|
.addIfEmpty('mavenExecuteStaticCodeChecks', script.commonPipelineEnvironment.configuration.runStep?.get(stageName)?.mavenExecuteStaticCodeChecks)
|
||||||
|
.use()
|
||||||
|
|
||||||
piperStageWrapper(stageName: stageName, script: script) {
|
piperStageWrapper(stageName: stageName, script: script) {
|
||||||
|
|
||||||
|
// telemetry reporting
|
||||||
|
utils.pushToSWA([step: STEP_NAME], config)
|
||||||
|
|
||||||
|
if (config.mavenExecuteStaticCodeChecks) {
|
||||||
mavenExecuteStaticCodeChecks(script: script)
|
mavenExecuteStaticCodeChecks(script: script)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user