mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
cbe368fe36
* Added base functionality for checkmarx interaction * Extend http client with file upload capabilities * Latest changes * Add debug logging * Introduce Uploader interface * Add tests for checkmarx client * Hook new checkmarx command * Improve coverage * Add tests * Improved test coverage and fixed code * Add influx reporting * Add alternation capabilities * Add groovy step * Try fix cmd * Enhancements * Fix report generation * Final performance improvements * Fix code * Structure code, cleanup * Improvements * Fix codeclimate issue * Update groovy * Adapt latest changes to http * Fix test * Fix http tests * Fix test * Fix test * Fix test 2 * Fix code * Fix code 2 * Fix code * Code * Fix * Fix * Add report and link handling * Fix returns, add groovy test * Review comments * Added doc template * Docs update * Remove SAP internals * Better status display * Add name to link * Fix test * Fix * Fix verbose handling * Fix verbose handling 2 * Fix verbose handling 3 * Fix * Tiny improvements * Regenerate * Fix test * Fix test code * Fix verbosity issue * Fix test * Fix test * Fix test
59 lines
2.1 KiB
Groovy
59 lines
2.1 KiB
Groovy
import com.sap.piper.PiperGoUtils
|
|
import com.sap.piper.Utils
|
|
import com.sap.piper.JenkinsUtils
|
|
import groovy.transform.Field
|
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
@Field String STEP_NAME = getClass().getName()
|
|
@Field String METADATA_FILE = 'metadata/checkmarx.yaml'
|
|
|
|
//Metadata maintained in file project://resources/metadata/checkmarx.yaml
|
|
|
|
void call(Map parameters = [:]) {
|
|
handlePipelineStepErrors(stepName: STEP_NAME, stepParameters: parameters) {
|
|
|
|
def script = checkScript(this, parameters) ?: this
|
|
|
|
Map config
|
|
def utils = parameters.juStabUtils ?: new Utils()
|
|
parameters.juStabUtils = null
|
|
def jenkinsUtils = parameters.jenkinsUtilsStub ?: new JenkinsUtils()
|
|
parameters.jenkinsUtilsStub = null
|
|
|
|
new PiperGoUtils(this, utils).unstashPiperBin()
|
|
utils.unstash('pipelineConfigAndTests')
|
|
script.commonPipelineEnvironment.writeToDisk(script)
|
|
|
|
writeFile(file: METADATA_FILE, text: libraryResource(METADATA_FILE))
|
|
|
|
withEnv([
|
|
"PIPER_parametersJSON=${groovy.json.JsonOutput.toJson(parameters)}",
|
|
]) {
|
|
// get context configuration
|
|
config = readJSON (text: sh(returnStdout: true, script: "./piper getConfig --contextConfig --stepMetadata '${METADATA_FILE}'"))
|
|
|
|
// execute step
|
|
withCredentials([usernamePassword(
|
|
credentialsId: config.checkmarxCredentialsId,
|
|
passwordVariable: 'PIPER_password',
|
|
usernameVariable: 'PIPER_username'
|
|
)]) {
|
|
sh "./piper checkmarxExecuteScan"
|
|
}
|
|
|
|
def reports = readJSON (file: 'reports.json')
|
|
for (report in reports) {
|
|
archiveArtifacts artifacts: report['target'], allowEmptyArchive: !report['mandatory']
|
|
}
|
|
|
|
if (fileExists(file: 'links.json')) {
|
|
def links = readJSON(file: 'links.json')
|
|
for (link in links) {
|
|
jenkinsUtils.addRunSideBarLink(link['target'], link['name'], "images/24x24/graph.png")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|