1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

feat: add error pattern messages for build and scan steps

This commit is contained in:
Philip Germanov
2025-08-25 10:15:48 +03:00
parent b170943c81
commit 26a7bd4fdd
18 changed files with 219 additions and 0 deletions

View File

@@ -456,6 +456,28 @@ func checkmarxOneExecuteScanMetadata() config.StepData {
Name: "checkmarxOneExecuteScan", Name: "checkmarxOneExecuteScan",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "checkmarxOne is the recommended tool for security scans of JavaScript, iOS, Swift and Ruby code.", Description: "checkmarxOne is the recommended tool for security scans of JavaScript, iOS, Swift and Ruby code.",
Errors: []config.StepError{
{
Pattern: "Checkmarx One scan failed with the following error.*Scan Failed",
Message: "Checkmarx One scan failed during execution. Check scan configuration and project settings.",
Category: "scan",
},
{
Pattern: "project .* not compliant",
Message: "Project failed compliance checks. Review security findings and fix issues to meet compliance requirements.",
Category: "compliance",
},
{
Pattern: "failed to create Checkmarx One client.*No APIKey or client_id/client_secret provided",
Message: "Authentication failed. Verify APIKey or client credentials are properly configured in vault secrets.",
Category: "authentication",
},
{
Pattern: "failed to create zip file",
Message: "File preparation failed. Check workspace permissions and available disk space.",
Category: "configuration",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -382,6 +382,13 @@ func detectExecuteScanMetadata() config.StepData {
Name: "detectExecuteScan", Name: "detectExecuteScan",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "Executes BlackDuck Detect scan", Description: "Executes BlackDuck Detect scan",
Errors: []config.StepError{
{
Pattern: "FAILURE_POLICY_VIOLATION",
Message: "BlackDuck Detect found policy violations. Review security policies and fix compliance issues.",
Category: "compliance",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -297,6 +297,13 @@ func golangBuildMetadata() config.StepData {
Name: "golangBuild", Name: "golangBuild",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "This step will execute a golang build.", Description: "This step will execute a golang build.",
Errors: []config.StepError{
{
Pattern: "[build failed]",
Message: "Go build compilation failed. Check for syntax errors, missing dependencies, or import issues.",
Category: "build",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -315,6 +315,18 @@ func mavenBuildMetadata() config.StepData {
Name: "mavenBuild", Name: "mavenBuild",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}}, Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Description: "This step will install the maven project into the local maven repository.", Description: "This step will install the maven project into the local maven repository.",
Errors: []config.StepError{
{
Pattern: "BUILD FAILURE",
Message: "Maven build failed. Check build logs for compilation errors, test failures, or plugin execution issues.",
Category: "build",
},
{
Pattern: "Failed to execute goal.*exec-maven-plugin.*exec",
Message: "Maven exec plugin execution failed. Verify exec plugin configuration and command execution.",
Category: "plugin",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -294,6 +294,18 @@ func mtaBuildMetadata() config.StepData {
Name: "mtaBuild", Name: "mtaBuild",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "Performs an mta build", Description: "Performs an mta build",
Errors: []config.StepError{
{
Pattern: "cannot find symbol",
Message: "Java compilation failed due to missing symbol. Check imports and dependencies.",
Category: "compilation",
},
{
Pattern: "has been compiled by a more recent version of the Java Runtime.*class file version",
Message: "Java version incompatibility. Update Java runtime or use compatible dependency versions.",
Category: "version",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -318,6 +318,21 @@ func npmExecuteScriptsMetadata() config.StepData {
Message: "PNPM authentication failed. Check your credentials or token.", Message: "PNPM authentication failed. Check your credentials or token.",
Category: "authentication", Category: "authentication",
}, },
{
Pattern: "npm error ERESOLVE",
Message: "NPM dependency resolution failed. Review peer dependency conflicts.",
Category: "dependency",
},
{
Pattern: "npm error EINTEGRITY",
Message: "Package integrity check failed. Clear npm cache and retry installation.",
Category: "dependency",
},
{
Pattern: "npm error code ENOENT.*package.json",
Message: "Package.json file not found. Ensure package.json exists in the correct directory.",
Category: "configuration",
},
}, },
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{

View File

@@ -167,6 +167,38 @@ func shellExecuteMetadata() config.StepData {
Name: "shellExecute", Name: "shellExecute",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "Step executes defined script", Description: "Step executes defined script",
Errors: []config.StepError{
{
Pattern: "No such file or directory",
Message: "Required file not found. Check file paths and existence.",
Category: "file",
},
{
Pattern: "Permission denied",
Message: "Insufficient permissions. Check file/directory permissions and user access.",
Category: "permission",
},
{
Pattern: "exit status 1",
Message: "Script execution failed with general error. Check script logic and dependencies.",
Category: "execution",
},
{
Pattern: "exit status 2",
Message: "Script execution failed with invalid usage. Check command syntax and arguments.",
Category: "execution",
},
{
Pattern: "exit status 126",
Message: "Script not executable. Check file permissions and execute bit.",
Category: "permission",
},
{
Pattern: "exit status 127",
Message: "Command not found. Check if required commands/tools are installed and in PATH.",
Category: "environment",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -314,6 +314,18 @@ func sonarExecuteScanMetadata() config.StepData {
Name: "sonarExecuteScan", Name: "sonarExecuteScan",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "Executes the Sonar scanner", Description: "Executes the Sonar scanner",
Errors: []config.StepError{
{
Pattern: "QUALITY GATE STATUS: FAILED",
Message: "SonarQube quality gate failed. Review code quality issues and fix them to meet quality standards.",
Category: "quality",
},
{
Pattern: "Error during parsing of generic test execution report",
Message: "Test execution report parsing failed. Verify test report format matches SonarQube expectations.",
Category: "configuration",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -429,6 +429,23 @@ func whitesourceExecuteScanMetadata() config.StepData {
Name: "whitesourceExecuteScan", Name: "whitesourceExecuteScan",
Aliases: []config.Alias{}, Aliases: []config.Alias{},
Description: "Execute a Mend (formerly known as WhiteSource) scan", Description: "Execute a Mend (formerly known as WhiteSource) scan",
Errors: []config.StepError{
{
Pattern: "Open Source Software Security vulnerabilities with CVSS score greater or equal to .* detected in project",
Message: "Security vulnerabilities with high CVSS scores detected. Review and address the identified vulnerabilities to meet security requirements.",
Category: "security",
},
{
Pattern: "policy violation\\(s\\) found",
Message: "Policy violations detected in the scan. Review the violations and update dependencies or policies to resolve compliance issues.",
Category: "compliance",
},
{
Pattern: "running command 'java' failed",
Message: "Java command execution failed during WhiteSource scan. Verify Java installation, memory settings, and agent configuration.",
Category: "execution",
},
},
}, },
Spec: config.StepSpec{ Spec: config.StepSpec{
Inputs: config.StepInputs{ Inputs: config.StepInputs{

View File

@@ -1,6 +1,19 @@
metadata: metadata:
name: checkmarxOneExecuteScan name: checkmarxOneExecuteScan
description: checkmarxOne is the recommended tool for security scans of JavaScript, iOS, Swift and Ruby code. description: checkmarxOne is the recommended tool for security scans of JavaScript, iOS, Swift and Ruby code.
errors:
- pattern: "Checkmarx One scan failed with the following error.*Scan Failed"
message: "Checkmarx One scan failed during execution. Check scan configuration and project settings."
category: "scan"
- pattern: "project .* not compliant"
message: "Project failed compliance checks. Review security findings and fix issues to meet compliance requirements."
category: "compliance"
- pattern: "failed to create Checkmarx One client.*No APIKey or client_id/client_secret provided"
message: "Authentication failed. Verify APIKey or client credentials are properly configured in vault secrets."
category: "authentication"
- pattern: "failed to create zip file"
message: "File preparation failed. Check workspace permissions and available disk space."
category: "configuration"
longDescription: |- longDescription: |-
checkmarxOne is a Static Application Security Testing (SAST) platform to analyze i.e. Java or TypeScript, Swift, Golang, Ruby code, checkmarxOne is a Static Application Security Testing (SAST) platform to analyze i.e. Java or TypeScript, Swift, Golang, Ruby code,
and many other programming languages for security flaws based on a set of provided rules/queries that can be customized and extended. and many other programming languages for security flaws based on a set of provided rules/queries that can be customized and extended.

View File

@@ -1,6 +1,10 @@
metadata: metadata:
name: detectExecuteScan name: detectExecuteScan
description: Executes BlackDuck Detect scan description: Executes BlackDuck Detect scan
errors:
- pattern: "FAILURE_POLICY_VIOLATION"
message: "BlackDuck Detect found policy violations. Review security policies and fix compliance issues."
category: "compliance"
longDescription: | longDescription: |
This step executes [BlackDuck Detect](https://documentation.blackduck.com/bundle/detect/page/introduction.html) scans. This step executes [BlackDuck Detect](https://documentation.blackduck.com/bundle/detect/page/introduction.html) scans.
BlackDuck Detect command line utlity can be used to run various scans including BlackDuck scans. This step allows users to run BlackDuck scans by default. BlackDuck Detect command line utlity can be used to run various scans including BlackDuck scans. This step allows users to run BlackDuck scans by default.

View File

@@ -1,6 +1,10 @@
metadata: metadata:
name: golangBuild name: golangBuild
description: This step will execute a golang build. description: This step will execute a golang build.
errors:
- pattern: "[build failed]"
message: "Go build compilation failed. Check for syntax errors, missing dependencies, or import issues."
category: "build"
longDescription: | longDescription: |
This step will build a golang project. This step will build a golang project.
It will also execute golang-based tests using [gotestsum](https://github.com/gotestyourself/gotestsum) and with that allows for reporting test results and test coverage. It will also execute golang-based tests using [gotestsum](https://github.com/gotestyourself/gotestsum) and with that allows for reporting test results and test coverage.

View File

@@ -4,6 +4,13 @@ metadata:
- name: mavenExecute - name: mavenExecute
deprecated: false deprecated: false
description: This step will install the maven project into the local maven repository. description: This step will install the maven project into the local maven repository.
errors:
- pattern: "BUILD FAILURE"
message: "Maven build failed. Check build logs for compilation errors, test failures, or plugin execution issues."
category: "build"
- pattern: "Failed to execute goal.*exec-maven-plugin.*exec"
message: "Maven exec plugin execution failed. Verify exec plugin configuration and command execution."
category: "plugin"
longDescription: | longDescription: |
This step will install the maven project into the local maven repository. This step will install the maven project into the local maven repository.
It will also prepare jacoco to record the code coverage and It will also prepare jacoco to record the code coverage and

View File

@@ -1,6 +1,13 @@
metadata: metadata:
name: mtaBuild name: mtaBuild
description: Performs an mta build description: Performs an mta build
errors:
- pattern: "cannot find symbol"
message: "Java compilation failed due to missing symbol. Check imports and dependencies."
category: "compilation"
- pattern: "has been compiled by a more recent version of the Java Runtime.*class file version"
message: "Java version incompatibility. Update Java runtime or use compatible dependency versions."
category: "version"
longDescription: | longDescription: |
Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application. Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.

View File

@@ -22,6 +22,15 @@ metadata:
- pattern: "ERR_PNPM_FETCH_401" - pattern: "ERR_PNPM_FETCH_401"
message: "PNPM authentication failed. Check your credentials or token." message: "PNPM authentication failed. Check your credentials or token."
category: "authentication" category: "authentication"
- pattern: "npm error ERESOLVE"
message: "NPM dependency resolution failed. Review peer dependency conflicts."
category: "dependency"
- pattern: "npm error EINTEGRITY"
message: "Package integrity check failed. Clear npm cache and retry installation."
category: "dependency"
- pattern: "npm error code ENOENT.*package.json"
message: "Package.json file not found. Ensure package.json exists in the correct directory."
category: "configuration"
longDescription: > longDescription: >
### Lock file detection: ### Lock file detection:

View File

@@ -2,6 +2,28 @@ metadata:
name: shellExecute name: shellExecute
description: Step executes defined script description: Step executes defined script
longDescription: Step executes defined script provided in the 'sources' parameter longDescription: Step executes defined script provided in the 'sources' parameter
errors:
# File and permission errors
- pattern: "No such file or directory"
message: "Required file not found. Check file paths and existence."
category: "file"
- pattern: "Permission denied"
message: "Insufficient permissions. Check file/directory permissions and user access."
category: "permission"
# Exit code patterns
- pattern: "exit status 1"
message: "Script execution failed with general error. Check script logic and dependencies."
category: "execution"
- pattern: "exit status 2"
message: "Script execution failed with invalid usage. Check command syntax and arguments."
category: "execution"
- pattern: "exit status 126"
message: "Script not executable. Check file permissions and execute bit."
category: "permission"
- pattern: "exit status 127"
message: "Command not found. Check if required commands/tools are installed and in PATH."
category: "environment"
spec: spec:
inputs: inputs:
secrets: secrets:

View File

@@ -1,6 +1,13 @@
metadata: metadata:
name: sonarExecuteScan name: sonarExecuteScan
description: Executes the Sonar scanner description: Executes the Sonar scanner
errors:
- pattern: "QUALITY GATE STATUS: FAILED"
message: "SonarQube quality gate failed. Review code quality issues and fix them to meet quality standards."
category: "quality"
- pattern: "Error during parsing of generic test execution report"
message: "Test execution report parsing failed. Verify test report format matches SonarQube expectations."
category: "configuration"
longDescription: "The step executes the [sonar-scanner](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/) longDescription: "The step executes the [sonar-scanner](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/)
cli command to scan the defined sources and publish the results to a SonarQube instance. Check [source repository](https://github.com/SonarSource/sonar-scanner-cli) for more details." cli command to scan the defined sources and publish the results to a SonarQube instance. Check [source repository](https://github.com/SonarSource/sonar-scanner-cli) for more details."
spec: spec:

View File

@@ -1,6 +1,16 @@
metadata: metadata:
name: whitesourceExecuteScan name: whitesourceExecuteScan
description: Execute a Mend (formerly known as WhiteSource) scan description: Execute a Mend (formerly known as WhiteSource) scan
errors:
- pattern: "Open Source Software Security vulnerabilities with CVSS score greater or equal to .* detected in project"
message: "Security vulnerabilities with high CVSS scores detected. Review and address the identified vulnerabilities to meet security requirements."
category: "security"
- pattern: "policy violation\\(s\\) found"
message: "Policy violations detected in the scan. Review the violations and update dependencies or policies to resolve compliance issues."
category: "compliance"
- pattern: "running command 'java' failed"
message: "Java command execution failed during WhiteSource scan. Verify Java installation, memory settings, and agent configuration."
category: "execution"
longDescription: |- longDescription: |-
With this step [Mend](https://www.mend.io/) (formerly known as Whitesource) security and license compliance scans can be executed and assessed. With this step [Mend](https://www.mend.io/) (formerly known as Whitesource) security and license compliance scans can be executed and assessed.
Mend is a Software as a Service offering based on a so called unified agent that locally determines the dependency Mend is a Software as a Service offering based on a so called unified agent that locally determines the dependency