Skip to content

Commit e2aa36a

Browse files
committed
Merge remote-tracking branch 'origin' into whitesource-sbt-config-fix
* origin: Check for prefix instead of substring (SAP#5370) fix(docs): fix typo in link anchor (SAP#5369) bugfix(): Fix JNLP image in defaults (SAP#5367) Fix filterPattern processing (SAP#5364)
2 parents be7b366 + ccb90e5 commit e2aa36a

File tree

7 files changed

+47
-17
lines changed

7 files changed

+47
-17
lines changed

cmd/checkmarxOneExecuteScan.go

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,22 +1001,44 @@ func (c *checkmarxOneExecuteScanHelper) isFileNotMatchingPattern(patterns []stri
10011001
return false, nil
10021002
}
10031003

1004+
// Check if it is matched by at least one include pattern
1005+
includeMatch := false
1006+
for _, pattern := range patterns {
1007+
if strings.HasPrefix(pattern, "!") {
1008+
continue
1009+
}
1010+
match, err := utils.PathMatch(pattern, path)
1011+
if err != nil {
1012+
return false, errors.Wrapf(err, "Pattern %v could not get executed", pattern)
1013+
}
1014+
if match {
1015+
includeMatch = true
1016+
break
1017+
}
1018+
}
1019+
1020+
if !includeMatch {
1021+
return true, nil // if there is no include pattern matching, the file is necessarily excluded
1022+
}
1023+
1024+
// Check if it is matched by at least one exclude pattern
10041025
for _, pattern := range patterns {
1005-
negative := false
10061026
if strings.HasPrefix(pattern, "!") {
10071027
pattern = strings.TrimLeft(pattern, "!")
1008-
negative = true
1028+
} else {
1029+
continue
10091030
}
10101031
match, err := utils.PathMatch(pattern, path)
10111032
if err != nil {
10121033
return false, errors.Wrapf(err, "Pattern %v could not get executed", pattern)
10131034
}
10141035

1015-
if match {
1016-
return negative, nil
1036+
if match { // match with an exclude pattern, the file is excluded
1037+
return true, nil
10171038
}
10181039
}
1019-
return true, nil
1040+
1041+
return false, nil
10201042
}
10211043

10221044
func (c *checkmarxOneExecuteScanHelper) createToolRecordCx(results *map[string]interface{}) (string, error) {

cmd/mtaBuild_generated.go

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/npmExecuteScripts_generated.go

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/orchestrator/jenkins.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (j *jenkinsConfigProvider) GitReference() string {
247247
ref := getEnv("BRANCH_NAME", "n/a")
248248
if ref == "n/a" {
249249
return ref
250-
} else if strings.Contains(ref, "PR") {
250+
} else if strings.HasPrefix(ref, "PR-") {
251251
return "refs/pull/" + strings.Split(ref, "-")[1] + "/head"
252252
} else if strings.HasPrefix(ref, "refs/") {
253253
return ref

resources/default_pipeline_environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ general:
5252
gitSshKeyCredentialsId: '' #needed to allow sshagent to run with local ssh key
5353
globalExtensionsDirectory: '.pipeline/tmp/global_extensions/'
5454
jenkinsKubernetes:
55-
jnlpAgent: 'jenkins/inbound-agent:jdk11'
55+
jnlpAgent: 'eu.gcr.io/sap-scp-jaas-prod/jnlp:3283.v92c105e0f819-9'
5656
securityContext:
5757
# Setting security context globally is currently not working with jaas
5858
# runAsUser: 1000

resources/metadata/mtaBuild.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ metadata:
33
description: Performs an mta build
44
longDescription: |
55
Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
6-
### build with depedencies from a private repository
7-
1. For maven related settings refer [maven build dependencies](./mavenBuild.md#build-with-depedencies-from-a-private-repository)
8-
2. For NPM related settings refer [NPM build dependencies](./npmExecuteScripts.md#build-with-depedencies-from-a-private-repository)
6+
7+
### build with dependencies from a private repository
8+
9+
1. For Maven related settings refer [Maven build dependencies](./mavenBuild.md#build-with-dependencies-from-a-private-repository)
10+
2. For NPM related settings refer [NPM build dependencies](./npmExecuteScripts.md#build-with-dependencies-from-a-private-repository)
911
spec:
1012
inputs:
1113
params:

resources/metadata/npmExecuteScripts.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ metadata:
66
longDescription: |
77
Execute npm run scripts in all package json files, if they implement the scripts.
88
9-
### build with depedencies from a private repository
10-
if your build has scoped/unscoped dependencies from a private repository you can include a .npmrc into the source code
9+
### build with dependencies from a private repository
10+
11+
If your build has scoped/unscoped dependencies from a private repository you can include a `.npmrc` into the source code
1112
repository as below (replace the `@privateScope:registry` value(s) with a valid private repo url) :
1213
1314
```
@@ -17,6 +18,7 @@ metadata:
1718
//private.repository.com/:always-auth=true
1819
registry=https://registry.npmjs.org
1920
```
21+
2022
`PIPER_VAULTCREDENTIAL_USER` and `PIPER_VAULTCREDENTIAL_PASSWORD_BASE64` (Base64 encoded password) are the username and password for the private repository
2123
and are exposed are environment variables that must be present in the environment where the Piper step runs or alternatively can be created using :
2224
[vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)

0 commit comments

Comments
 (0)