Skip to content

Commit

Permalink
Add groovy wrapper for malwarescanning (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusholl authored Apr 30, 2020
1 parent 3f1a9d0 commit 30850ae
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
28 changes: 28 additions & 0 deletions documentation/docs/steps/malwareExecuteScan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# ${docGenStepName}

## ${docGenParameters}

## ${docGenConfiguration}

## ${docJenkinsPluginDependencies}

## Exceptions

None

## Examples

```groovy
malwareExecuteScan script: this
```

configuration

```
steps:
malwareExecuteScan:
file: myFile.zip
host: https://malwarescanner.example.sap.com
credentialsId: MALWARESCAN
```
1 change: 1 addition & 0 deletions documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ nav:
- karmaExecuteTests: steps/karmaExecuteTests.md
- kubernetesDeploy: steps/kubernetesDeploy.md
- mailSendNotification: steps/mailSendNotification.md
- malwareExecuteScan: steps/malwareExecuteScan.md
- mavenExecute: steps/mavenExecute.md
- mavenExecuteStaticCodeChecks: steps/mavenExecuteStaticCodeChecks.md
- mtaBuild: steps/mtaBuild.md
Expand Down
2 changes: 2 additions & 0 deletions test/groovy/CommonStepsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class CommonStepsTest extends BasePiperTest{
'prepareDefaultValues',
'setupCommonPipelineEnvironment',
'buildSetResult',
'malwareExecuteScan', // go pattern, script not needed
'mavenExecuteStaticCodeChecks',
'cloudFoundryCreateServiceKey',
'gctsCreateRepository'
Expand Down Expand Up @@ -133,6 +134,7 @@ public class CommonStepsTest extends BasePiperTest{
'cloudFoundryDeleteService', //implementing new golang pattern without fields
'cloudFoundryCreateServiceKey', //implementing new golang pattern without fields
'npmExecuteScripts', //implementing new golang pattern without fields
'malwareExecuteScan', //implementing new golang pattern without fields
'mavenBuild', //implementing new golang pattern without fields
'mavenExecute', //implementing new golang pattern without fields
'mavenExecuteStaticCodeChecks', //implementing new golang pattern without fields
Expand Down
17 changes: 17 additions & 0 deletions vars/malwareExecuteScan.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import groovy.transform.Field

@Field String STEP_NAME = getClass().getName()

void call(Map parameters = [:]) {

handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) {

def cred = [
type: 'usernamePassword',
id: 'malwareScanCredentialsId',
env: ['PIPER_user', 'PIPER_password']
]

piperExecuteBin parameters, STEP_NAME, "metadata/${STEP_NAME}.yaml", [cred]
}
}

0 comments on commit 30850ae

Please sign in to comment.