1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
Commit Graph

388 Commits

Author SHA1 Message Date
Dominik Lendle
509607f69f
Host parameter fix (#1752) 2020-07-07 16:19:57 +02:00
Marcus Holl
4f2ba73314
[refactoring] move the shell/command related interfaces into pkg/command (#1737)
* [refactoring] move the shell/command related interfaces into pkg/command

otherwise we are not able to use the corresponding mocks for the items contained in pkg since
these interfaces are not visible from the pkg folder

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-07-01 11:28:16 +02:00
Jordan Levin
34967c502c
Whitesource scan (MVP) (#1658)
* Whitesource MVP for Gradle, Golang, and NPM/Yarn

* Refactoring

* Refactor and cleanup, better error checking

* publish stepResults, use pkg/versioning, bubble up errors, add gomod versioning support

* Run gofmt and cleanup comments

* Resolve PR comments

* Update resources/metadata/whitesource.yaml

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Only determine project coordinates if they are missing

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* Gradle versioning artifact

* fix gradle artifact version regexp and refactor

* Fix token extraction from output buffer

* Fix some issues with pip and jsonfile versioning logic

* Remove useless spacing

* Remove unnecessary test file and fix naming style for JSONDescriptor

* Automatically download wss-unified-agent if file does not exist

* adds downloadVulnerabilityReport, checkSecurityViolations, minor refactoring

* adds config.ReportDirectoryName, improves readability

* Version-wide reporting for vulnerabilities and list of libraries.

* Refactor and improve build accuracy

* fix sed command

* Add includes file pattern config option

* Adds --exclude command line flag

* run go mod tidy and regenerate step framework

* Fix unit tests

* revert changes

* poll project status before downloading reports

* merge with master

* go mod tidy, go fmt, and fix whitesource unit test

* sync go.mod

* sync go.mod again

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-07-01 07:54:13 +02:00
MuellerHenrik
de3afe9476
Change parameters/alias for CfServiceKeyName (#1726)
* Fix alias cfServiceKeyName

* Adapt documentation

* Fix alias use in go files

Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com>
2020-06-30 15:46:07 +02:00
Oliver Nocon
ac5ae40ecb
kubernetesDeploy: categorize known errors & fix #1732 (#1727)
* kubernetesDeploy: categorize known errors

* hide Docker secret in log output
2020-06-30 10:48:30 +02:00
Oliver Nocon
54850d2ca0
sonarExecuteScan: add error categorization (#1715) 2020-06-26 07:38:27 +02:00
Oliver Nocon
bb8cd30c4c
Extend resource references to cater for secrets (#1718)
* Add secret references to step metadata

* Update references

* update generated files
2020-06-25 16:33:38 +02:00
andre2007
f0babcade1
feat(sonar): upgrade sonar-scanner-cli to 4.4.0.2170 (#1710)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-25 13:53:22 +02:00
Oliver Nocon
eafe383d54
Add error category parsing to cmd execution (#1703)
* Add error category parsing to cmd execution

It is now possible to define `ErrorCategoryMapping` as a `map[string][]string` on a `Command`.
The format contains the category as key which has a list of error patterns assigned.
Example:

```
cmd := Command{
  ErrorCategoryMapping: map[string][]string
    "build": {"build failed"},
    "compliance": {"vulnerabilities found", "outdated components found"},
    "test": {"some tests failed"},
  },
}
```

Setting this map triggers console log parsing when executing a command.
If a match is found the error category is stored and
it will automatically be added to the `errorDetails.json`.

* clean up go.mod

* fix test

* fix test

* Update DEVELOPMENT.md

* fix tests

* address long console content without line breaks

* scan condition update

* fix test

* add missing comment for exported function

* Update pkg/command/command.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-24 10:04:05 +02:00
Christopher Fenner
c42553593e
fix: remove unused variables from generated step coding (#1698)
* remove unused parameters from generated code

* update steps

* update steps

* correct golden files

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-23 18:05:21 +02:00
Florian Wilhelm
60eefabb20
Install dev deps in mta build (#1685)
Ensure npm dev dependencies are available after mtaBuild as they are required by certain tests.
Co-authored-by: Kevin Hudemann <kevin.hudemann@sap.com>
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-06-22 10:39:52 +02:00
Kevin Hudemann
60fa1d5bbf
Add Java-/Typescript linting capabilities (#1636)
This change adds linting support for Java-/TypeScript projects based on the checkDefaultLint and checkUserLint steps from Cloud SDK Pipeline.

Following options are supported:

1. Define a linting script named ci-lint in the package.json file(s) of the project
2. Provide a configuration for ESLint as part of the project
3. If none of the above: ESLint is executed with a general purpose configuration.

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-06-22 10:12:28 +02:00
Oliver Nocon
d8444d51f2
Add possibility to add category to failures (#1692)
* Add possibility to add category to failures

It is now possible to set the error category within the flow.
When exiting the program the error category can be used.

There is  a convenience function available for exiting with a previously set category,
for example

```
log.SetErrorCategory(log.ErrorCompliance)
...
log.FatalError(err, "configuration error")
```

* extend test

* go mod tidy

* add missing comment

* update information about error categories

* Update DEVELOPMENT.md
2020-06-22 08:21:38 +02:00
Daniel Kurzynski
8f9ed0766c
Let json patcher fail if file not found (#1694)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-19 20:13:20 +02:00
Daniel Kurzynski
7c441f552f
Make version command a high level command like get-config without resolving the configuration (#1689) 2020-06-19 14:39:19 +02:00
Kevin Hudemann
ceb3dd0a04
Refactor pkg/npm and npmExecuteScripts (#1684)
This change refactors the npm pkg and npmExecuteScripts implementations
to be reusable for future steps, e.g., npmExecuteLint.

In addition, it fixes few small bugs related to unit test execution on
Windows and the fileUtils mocking implementation.

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-18 17:30:17 +02:00
Daniel Kurzynski
be01dd3869
Add schema patch step in go (#1683)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-18 14:50:46 +02:00
Chris Bo
e9ad8c5e9c
Introducing new step 'gctsCloneRepository' (#1468)
* added new step gctsCloneRepository

* enhanced docu

* adjusted test case name

* enhanced docu

* refined error messages

* regenerated & remove unused Groovy imports

* small change

* remove execRunner

* Update documentation/docs/steps/gctsCloneRepository.md

* regenerated

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-06-18 07:45:22 +02:00
Daniel Kurzynski
743fca43e1
Remove projectVersion from fortify documentation (#1628)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-17 17:47:59 +02:00
Daniel Kurzynski
0222bf83d1
Run npm scripts in virtual frame buffer and extend command.go to run executable asynchronously (#1669)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-06-16 11:42:51 +02:00
Dominik Lendle
0fd9c4be84
cf create/delete service: Changing to workingDir (#1560)
* minor changes

* Changed yaml with aliases

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* Changed yaml aliases

* Adapted naming conventions

* Removed error code at the end

* Adapted configuration

* Minor changes

* Minor changes

* Minor changes

* Removed spaces

* Removed docker-related config from groovy file

* Minor changes

* Minor changes

* Removed container config

* Corrected testing function name

* Deleted unnecessary parts

* Changed service deletion message

* Changed service deletion message

* Logging out before throwing error service deletion step fails

* Minor changes

* Minor changes

* Minor changes

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Minor changes

* Minor changes

* Minor changes

* Added newline at end of file

* Added newline at end of file

* Changes for Pull request optimization

* added documentaion

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Added CFDeleteServiceKeys

* Added ServiceKey deletion tests

* added cfServiceKeys flag explanation to documentation

* removed trailing spaces from documentation

* resolving conflicts

* Changed deletion message an variable naming

* Changed tests

* Changed tests

* Changed tests

* Changed tests

* Changed CloudFoundryDeleteServiceOptions to options

* Changed CloudFoundryDeleteServiceOptions to options

* Minor changes

* Minor changes

* Changed variable naming

* Changed error handling

* Changed error handling and logging

* Changed documentation

* Simplified code

* Fixed CodeClimate issues

* Changed from returning err to nil where no errur returned needed

* Add cloudFoundryCreateServiceKey Go Step

* Changed Groovy File

* Changed aliases

* Removed unneccessary parts

* Minor changes

* Minor changes

* Adapted documentation

* Adapted tests

* Adapted Groovy File

* Changed Groovy file

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed Groovy Tests for cfCreateServiceKey

* Minor changes

* Added ATC Check YAML

* Added ATC Check generated files

* Added test class

* Added abapEnvironmentRunATCCheck

* Minor changes

* Minor changes

* Changed groovy

* Minor changes

* Changed groovy

* Changed groovy

* Minor changes

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy

* Getting ATC results

* Changed error message

* changed groovy

* removed trailing spaces

* Added login check

* Minor changes

* Added step to whitelistScriptReference

* Added ATC error message handling

* Added groovy file

* Added step to groovy tests

* corrected metadata file

* Debugging

* Debugging

* Added yaml config parameter for ATC run

* Adapted file location of ATC run config to jenkins specific location

* Implementing universal pipeline logic for finding yaml config regardless of pipeline

* Changed error handling for reading config yaml file

* Changed atcrunconfig alias

* minor changes

* Minor changes

* Minor changes

* Changed back to dynamic file reading

* Minor changes

* filepath changes

* Removing CF Login

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed whitespaces

* Added CF functions unit tests

* Added invalid parameter handling

* Removed package and SC flag

* Minor changes

* Changed tests

* Changed tests

* Changed tests

* Minor changes

* Changed tests

* removed unnecessary logout

* Added documentation

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaces

* Added newline at end of file

* code climate fixes

* code climate fixes

* code climate fixes

* Minor changes

* Minor changes

* Minor changes

* Changed tests

* Test changes

* Splitted Cloud Foundry functions into two classes

* Removed two steps from whtielistScriptReference

* removed atcrunConfig alias

* issue fixes

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaced from docu

* Changed docu

* Go generator run

* Issue fixes

* Remove unnecessary imports

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Update whitelistScript

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Adding piperutils for writing xml file

* Persisting ATC Results with piperutils

* Set failonMissingReports to true

* Refactoring for CodeClimate

* Changed result file name

* Changed credentials aliases

* changing secret name

* Removing trailing spaces

* Added secret name and alias to docu

* Changing to workingDir

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-15 21:31:50 +02:00
lndrschlz
48f6a08433
GithubPublishRelease: Add "pre-release" flag (#1654)
* githubPublishRelease: added prerelease tag

* test case added

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-15 21:05:08 +02:00
Florian Wilhelm
0fcf1654fe
Install maven artifacts after mta build (#1641)
Extend mta build step to install maven artefacts after build to allow re-using them in later stages (additional unit or integration tests which might not be running as part of the "build" life-cycle).
2020-06-15 12:46:54 +02:00
Stephan Aßmus
f855658e06
Enhance piperutils.Files and mock.FilesMock (#1664)
* Flesh out piperutils.Files and mock.FilesMock functionality
* Avoid a lot of code-duplication via embedding
2020-06-15 09:47:33 +02:00
Daniel Kurzynski
41c1653a06
Fix checkmarx (#1655) 2020-06-12 09:22:22 +02:00
Stephan Aßmus
d558db9106
Refactor maven.Evaluate() to take options (#1659)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-06-11 14:02:54 +02:00
Christopher Fenner
8e78199cce
chore: emit used project config & defaults to log (#1633)
* print used project config

* print used project defaults
2020-06-10 09:39:29 +02:00
Stephan Aßmus
56699ab019
Run artifactPrepareVersion in maven container if necessary (#1634)
* The metadata for artifactPrepareVersion-go specifies a container for when the buildTool is maven.
* The alias to 'mavenExecute' was removed. The problem with this is that when a section containers is included in the metadata, dockerImage will always be picked up from mavenExecute, the conditional dependency on buildTool will not even be considered. Parameters such as m2Path, projectSettingsFile and globalSettingsFile should be configured in general/maven if necessary.
* When the step ends up being executed within dockerExecuteOnKubernetes, we need to preserve the .git folder. This folder would normally be excluded by the default excludes of the stash step. There was already a comment that suppressing this behavior by passing useDefaultExcludes: false was problematic (unfortunately without going into details), so I've added a new parameter to dockerExecute and dockerExecuteOnKubernetes named stashNoDefaultExcludes (note the reverted meaning to ease preserving the default behavior when this parameter is not provided). This parameter is passed to piperExecuteBin from the artifactPreferVersion groovy wrapper.
2020-06-08 17:08:05 +02:00
Marcus Holl
0ad38b8621
Timeout for malwarescan (#1623)
Provide a timeout parameters to malwarescan step. This is forwarded to the piper http layer. The default used there is 10 seconds with is not useable for that use case for larger files.
2020-06-03 11:08:34 +02:00
Daniel Kurzynski
cf9a41850e
Needed CLI separator for Fortify tools depends on platform (#1616)
* Update fortify.yaml
* src, exclude and pythonAdditionalPaths are now lists of strings
* Re-implement pythonIncludes and pythonExcludes as aliases of src and exclude
* Fix using the correct separator (; on windows, : on everything else)
* Tokenize also python "includes"
* mvnCustomArgs was removed

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-02 13:47:07 +02:00
Stephan Aßmus
a24a7aad23
Fortify: Using mvn to auto-resolve classpath needs additional params (#1607)
* also reduce code duplication in token fetching
* concatenate classpaths from multi-maven projects

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-29 15:42:35 +02:00
Daniel Mieg
6db5beb2ec
Increase timeout (#1609)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-05-28 13:08:26 +02:00
Daniel Kurzynski
0a4309a2c2
Add build project name (#1610)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-28 10:45:06 +02:00
Maximilian Lenkeit
10e5bf98f8
artifactPrepareVersion: remember original artifact version (#1600)
* Update resources.go

* expose originalArtifactVersion parameter

* re-generate steps

* adjust golden files for generator changes
2020-05-28 10:05:22 +02:00
Florian Wilhelm
0857c9a3c6
Allow custom options for src, exclude in fortify translate (#1592)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Kevin Hudemann <kevin.hudemann@sap.com>
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-27 11:45:01 +02:00
Oliver Nocon
d5d510719d
piperExecuteBin - prevent non-speaking exit code 1 error (#1584)
* piperExecuteBin - prevent non-speaking exit code 1 error

Make sure that error during context resolution gets more context.

* properly provide golang errors

* improve error message, when no details are available

* Add error category

* Update getConfig.go
2020-05-26 07:58:03 +02:00
lndrschlz
80f70aba4a
Error reporting: change category to standard term (#1587)
* streamlined error category with standard term

* remove unused import from test

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-05-25 22:38:26 +02:00
Sven Merk
af2a01c064
Fortify implementation in golang (#1428) 2020-05-25 19:48:59 +02:00
Oliver Nocon
f92771003c
detectExecuteScan - switch off phone home (#1582) 2020-05-25 09:44:42 +02:00
Florian Wilhelm
bd1e0a1071
Fix npm registry config (#1564) 2020-05-20 13:41:23 +02:00
Oliver Nocon
a0ded365c5
Fix container condition handling (#1562)
* Add additional tests
* Update handling of containers
* Properly consider existing config at root level
* Fix parameter filtering
* Fix tests for adapted filter handling
2020-05-20 10:50:35 +02:00
Stephan Aßmus
ac122a84e7
Fix mtarName config param handling (#1570) 2020-05-19 22:02:47 +02:00
Florian Wilhelm
550651187d
Configure alias for extension (#1569)
Restore compatibility with old parameter name to avoid breaking changes.



Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-19 17:05:11 +02:00
Marcus Holl
f47f2e6e90
Use mtaBuild step from go (#1536)
Co-authored-by: Your Name <kevin.hudemann@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-05-19 08:51:18 +02:00
Oliver Nocon
7f7d0bce89
Piper steps: Issue SUCCESS message (#1478)
* Piper steps: Issue SUCCESS message

Log `SUCCESS` message in all steps by default if no error occured

* Update additional generated steps

* Update generated step
2020-05-18 21:52:54 +02:00
Chris Bo
abdc3f736b
Introducing new step 'gctsDeployCommit' (#1476)
* added new step gctsDeployCommit

* suggested PR fixes applied

* fixed test

* Remove unused imports

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* added URL encoding for 'request' parameter

* regenerate after change

* minor changes

* renamed step to 'gctsDeploy'

* changed name

* remove space

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-05-18 21:39:35 +02:00
Dominik Lendle
4a82eb5aaa
Docu changes to abapEnvironmentRunATCCheck step (#1557)
* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* Changed yaml aliases

* Adapted naming conventions

* Removed error code at the end

* Adapted configuration

* Minor changes

* Minor changes

* Minor changes

* Removed spaces

* Removed docker-related config from groovy file

* Minor changes

* Minor changes

* Removed container config

* Corrected testing function name

* Deleted unnecessary parts

* Changed service deletion message

* Changed service deletion message

* Logging out before throwing error service deletion step fails

* Minor changes

* Minor changes

* Minor changes

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Minor changes

* Minor changes

* Minor changes

* Added newline at end of file

* Added newline at end of file

* Changes for Pull request optimization

* added documentaion

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Added CFDeleteServiceKeys

* Added ServiceKey deletion tests

* added cfServiceKeys flag explanation to documentation

* removed trailing spaces from documentation

* resolving conflicts

* Changed deletion message an variable naming

* Changed tests

* Changed tests

* Changed tests

* Changed tests

* Changed CloudFoundryDeleteServiceOptions to options

* Changed CloudFoundryDeleteServiceOptions to options

* Minor changes

* Minor changes

* Changed variable naming

* Changed error handling

* Changed error handling and logging

* Changed documentation

* Simplified code

* Fixed CodeClimate issues

* Changed from returning err to nil where no errur returned needed

* Add cloudFoundryCreateServiceKey Go Step

* Changed Groovy File

* Changed aliases

* Removed unneccessary parts

* Minor changes

* Minor changes

* Adapted documentation

* Adapted tests

* Adapted Groovy File

* Changed Groovy file

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed Groovy Tests for cfCreateServiceKey

* Minor changes

* Added ATC Check YAML

* Added ATC Check generated files

* Added test class

* Added abapEnvironmentRunATCCheck

* Minor changes

* Minor changes

* Changed groovy

* Minor changes

* Changed groovy

* Changed groovy

* Minor changes

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy

* Getting ATC results

* Changed error message

* changed groovy

* removed trailing spaces

* Added login check

* Minor changes

* Added step to whitelistScriptReference

* Added ATC error message handling

* Added groovy file

* Added step to groovy tests

* corrected metadata file

* Debugging

* Debugging

* Added yaml config parameter for ATC run

* Adapted file location of ATC run config to jenkins specific location

* Implementing universal pipeline logic for finding yaml config regardless of pipeline

* Changed error handling for reading config yaml file

* Changed atcrunconfig alias

* minor changes

* Minor changes

* Minor changes

* Changed back to dynamic file reading

* Minor changes

* filepath changes

* Removing CF Login

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed whitespaces

* Added CF functions unit tests

* Added invalid parameter handling

* Removed package and SC flag

* Minor changes

* Changed tests

* Changed tests

* Changed tests

* Minor changes

* Changed tests

* removed unnecessary logout

* Added documentation

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaces

* Added newline at end of file

* code climate fixes

* code climate fixes

* code climate fixes

* Minor changes

* Minor changes

* Minor changes

* Changed tests

* Test changes

* Splitted Cloud Foundry functions into two classes

* Removed two steps from whtielistScriptReference

* removed atcrunConfig alias

* issue fixes

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaced from docu

* Changed docu

* Go generator run

* Issue fixes

* Remove unnecessary imports

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Update whitelistScript

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Adding piperutils for writing xml file

* Persisting ATC Results with piperutils

* Set failonMissingReports to true

* Refactoring for CodeClimate

* Changed result file name

* Changed credentials aliases

* changing secret name

* Removing trailing spaces

* Added secret name and alias to docu

* Docu changes

* CodeClimate fixes

* Minor docu changes

* Correct syntax highlighting

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Daniel Mieg <daniel.mieg@sap.com>
2020-05-18 12:49:52 +02:00
Stephan Aßmus
5f48d4d767
Execute test in temp folder (#1561) 2020-05-18 10:31:38 +02:00
Oliver Nocon
d5bff20b10
Create step to save container image (#1554)
* Create step to save container image

* add error handling for directory creation

* Update permissions

* remove indirection and add tests

* finalize tests

* Fix test to also run on linux environments

* Update cmd/containerSaveImage.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* Update resources/metadata/savecontainer.yaml

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* Update cmd/containerSaveImage.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* Update cmd/containerSaveImage_test.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* Update generated file

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-18 08:55:25 +02:00
Florian Wilhelm
d151550554
Allow to configure sap npm registry in mta builder (#1550) 2020-05-15 14:20:37 +02:00
Christopher Fenner
f9be21900e
fix(versioning): commit only modified files (#1549)
* add only modified files

* adjust tests

* remove mock add
2020-05-14 17:20:13 +02:00
Daniel Mieg
194d711e84
Adapt config for abapEnvironmentPullGitRepo, cloudFoundryCreateServiceKey and cloudFoundryDeleteService (#1520)
* Enable multiple repositories

* Improve readability

* Adapt documentation

* rerun generator

* Add initial info line

* Improve logging

* Enable configuration in GENERAL section

* Adapt yml abapEnvironmentPullGitRepo

* Add aliases for crendetialsId

* Change order of credentialsId aliases

* Change prio of different names of credentialsId

* Add docu to sidebar
2020-05-14 14:48:12 +02:00
Christopher Fenner
27c6320474
feat(sonar): write flag for sonar execution to influx (#1534)
* write flag for sonar execution to influx

* add missing step metadata file

* first attempt to read influx from disk

* add missing import

* correct glob pattern

* use file path

* correct type names

* cleanup

* fix code climate issue

* fix typo

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>

* add test case

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-14 13:46:40 +02:00
Stephan Aßmus
5ab4dedcb2
Optionally ignore custom defaults (#1538)
* Add parameter "--ignoreCustomDefaults"
* Pass to piper customDefaults from config also via --defaultConfig
... and add "--ignoreCustomDefaults".
* Log output when ignoring customDefaults

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-14 10:50:58 +02:00
dominiklendle
ac732b3065
Add abapEnvironmentRunATCCheck step (#1454)
* Minor changes

* Changed groovy file

* Changed generated file

* Changed yaml with container config

* Changed groovy config

* minor changes

* minor changes

* Changed yaml with aliases

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* minor changes

* Changed yaml aliases

* Adapted naming conventions

* Removed error code at the end

* Adapted configuration

* Minor changes

* Minor changes

* Minor changes

* Removed spaces

* Removed docker-related config from groovy file

* Minor changes

* Minor changes

* Removed container config

* Corrected testing function name

* Deleted unnecessary parts

* Changed service deletion message

* Changed service deletion message

* Logging out before throwing error service deletion step fails

* Minor changes

* Minor changes

* Minor changes

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Minor changes

* Minor changes

* Minor changes

* Added newline at end of file

* Added newline at end of file

* Changes for Pull request optimization

* added documentaion

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Adapted documentation

* Added CFDeleteServiceKeys

* Added ServiceKey deletion tests

* added cfServiceKeys flag explanation to documentation

* removed trailing spaces from documentation

* resolving conflicts

* Changed deletion message an variable naming

* Changed tests

* Changed tests

* Changed tests

* Changed tests

* Changed CloudFoundryDeleteServiceOptions to options

* Changed CloudFoundryDeleteServiceOptions to options

* Minor changes

* Minor changes

* Changed variable naming

* Changed error handling

* Changed error handling and logging

* Changed documentation

* Simplified code

* Fixed CodeClimate issues

* Changed from returning err to nil where no errur returned needed

* Add cloudFoundryCreateServiceKey Go Step

* Changed Groovy File

* Changed aliases

* Removed unneccessary parts

* Minor changes

* Minor changes

* Adapted documentation

* Adapted tests

* Adapted Groovy File

* Changed Groovy file

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed Groovy Tests for cfCreateServiceKey

* Minor changes

* Added ATC Check YAML

* Added ATC Check generated files

* Added test class

* Added abapEnvironmentRunATCCheck

* Minor changes

* Minor changes

* Changed groovy

* Minor changes

* Changed groovy

* Changed groovy

* Minor changes

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy imports

* Adapted Groovy

* Getting ATC results

* Changed error message

* changed groovy

* removed trailing spaces

* Added login check

* Minor changes

* Added step to whitelistScriptReference

* Added ATC error message handling

* Added groovy file

* Added step to groovy tests

* corrected metadata file

* Debugging

* Debugging

* Added yaml config parameter for ATC run

* Adapted file location of ATC run config to jenkins specific location

* Implementing universal pipeline logic for finding yaml config regardless of pipeline

* Changed error handling for reading config yaml file

* Changed atcrunconfig alias

* minor changes

* Minor changes

* Minor changes

* Changed back to dynamic file reading

* Minor changes

* filepath changes

* Removing CF Login

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Removed whitespaces

* Added CF functions unit tests

* Added invalid parameter handling

* Removed package and SC flag

* Minor changes

* Changed tests

* Changed tests

* Changed tests

* Minor changes

* Changed tests

* removed unnecessary logout

* Added documentation

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaces

* Added newline at end of file

* code climate fixes

* code climate fixes

* code climate fixes

* Minor changes

* Minor changes

* Minor changes

* Changed tests

* Test changes

* Splitted Cloud Foundry functions into two classes

* Removed two steps from whtielistScriptReference

* removed atcrunConfig alias

* issue fixes

* Changed docu

* Changed docu

* Changed docu

* Removed trailing spaced from docu

* Changed docu

* Go generator run

* Issue fixes

* Remove unnecessary imports

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Update whitelistScript

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Adding piperutils for writing xml file

* Persisting ATC Results with piperutils

* Set failonMissingReports to true

* Refactoring for CodeClimate

* Changed result file name

* Changed credentials aliases

* changing secret name

* Removing trailing spaces

* Added secret name and alias to docu

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-05-13 14:51:48 +02:00
Daniel Mieg
02ede6d28b
feat!: Mass enable abapEnvironmentPullGitRepo (#1516)
* Enable multiple repositories

* Improve readability

* Adapt documentation

* rerun generator

* Add initial info line

* Improve logging
2020-05-07 15:51:11 +02:00
Sven Merk
911b8bfb26
Add resolution and storage of commit message (#1515)
* Add commit message

* Add ToDo for later refctoring
2020-05-07 11:21:29 +02:00
Oliver Nocon
f7fdd79fa7
artifactPrepareVersion: additional options (#1512)
* artifactPrepareVersion: additional options

it is now possible to use
* a Unix timestamp number
* a short commit hash

* Add dedicated Docker versioning scheme
2020-05-06 22:07:27 +02:00
Florian Wilhelm
eaf5479e9c
Fix maven parameter handling (#1493)
Avoid maven error `Unknown lifecycle phase \"-\"` when the value of a define contains `-`.

Don't split and trim maven arguments. Expect they come in as a list, keep them as list.

This is a breaking change compared to the old Groovy implementation which relied on using a shell for calling maven.

As an example, consider this diff:

```diff
-        goals: 'org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate',
-        defines: "-Dexpression=$pomPathExpression -DforceStdout -q",
+        goals: ['org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate'],
+        defines: ["-Dexpression=$pomPathExpression", "-DforceStdout", "-q"],
```
2020-05-06 17:43:32 +02:00
Christopher Fenner
e4f827118b
refactor(protecode): handle DOCKER_CONFIG in go (#1502)
* handle DOCKER_CONFIG in go

* cleanup

* always use parent dir

* take care of errors
2020-05-06 16:07:10 +02:00
Stephan Aßmus
082b249cc0
Fix logrus buffer issue (#1511) 2020-05-06 13:35:40 +02:00
Florian Wilhelm
0a196af04c
Allow configuration of log format, change default to fixed-width (#1432) 2020-05-06 12:17:56 +02:00
Marcus Holl
2c7c165e62
Malware scan metadata update (#1483) 2020-05-06 08:52:26 +02:00
Oliver Nocon
033ff8da6f
go: align used yaml package (#1504) 2020-05-05 15:54:50 +02:00
lndrschlz
39e30ff1b4
Added hook configuration; added sentry hook and tests (#1497)
* Added hook configuration; added sentry hook and tests
* steps generated by step framework
* added comments and renamed correlationID
* formatted comment on NewSentryHook method
* fix generator step tests
2020-05-05 08:36:24 +02:00
Hans Schulz
7c503d784b
fix dockerVersionSource not being used (#1492) 2020-04-30 17:32:18 +02:00
Chris Bo
6c32df0b89
Minor improvements to gctsCreateRepository step docu and metadata (#1469)
* fix docu

* enhanced step docu and metadata

* regenerate after changing metadata

* small wording change

Co-authored-by: Marcus Holl <marcus.holl@sap.com>
2020-04-29 16:21:55 +02:00
Oliver Nocon
363f69da29
Handle illegal verbose value (#1485)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-04-29 15:05:00 +02:00
dominiklendle
b8eaa47230
Removing JSON config for Service Key Creation as in-line parameter (#1434)
* Issue fixes

* Removed Logging
2020-04-29 13:11:06 +02:00
Florian Wilhelm
7bbdaf783c
Dont dedup mvn flags (#1479) 2020-04-28 20:38:36 +02:00
Oliver Nocon
43947e6ef5
Pass golang error details to Jenkins pipeline (#1443)
Do not exit with os.Exit(1) but using log.Entry().Fatal() instead
* Golang: forward error details
* extend groovy wrapper to provide proper error message
* create closure for error handling
2020-04-28 07:42:02 +02:00
Kevin Hudemann
0be3225a3c
Enable the use of artifactPrepareVersion instead of artifactSetVersion (#1455)
This change enables the use of the artifactPrepareVersion go step instead
of the deprecated artifactSetVersion groovy implementation for the Cloud
SDK Pipeline. The groovy wrapper for the artifactPrepareVersion step now
enables the use of the download cache and minor issues are fixed.
2020-04-27 09:56:58 +02:00
Oliver Nocon
a728416e12
artifactPrepareVersion: define versioning scheme (#1457) 2020-04-24 20:52:16 +02:00
Florian Wilhelm
3f5b9cc555
Implement npmExecuteScripts step (#1422) 2020-04-24 18:29:30 +02:00
Chris Bo
fb4cfd84ec
Introducing new step: "gctsCreateRepository" (#1424)
With the step gctsCreateRepository it is possible to create a local gCTS repository on an ABAP server

Co-authored-by: Marcus Holl <marcus.holl@sap.com>
2020-04-24 15:31:41 +02:00
Daniel Kurzynski
974327d16e
Use mavenExecute from go (#1388)
Also establish mavenExecute() via new JenkinsMavenExecuteRule in Groovy Unit Tests.

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-04-24 10:41:49 +02:00
Arthur Lenz
b335387eac
feat(k8s): Add basic support for Helm 3 in kubernetesDeploy step (#1438)
* Extends kubernetesDeploy step to support Helm 3

Currently, the kubernetesDeploy step has no support to Helm 3 due to the fact that:
- the initialization command used works only for Helm 2
- the image used when running the helm CLI is based on Helm 2

The need for Helm 3 support comes from the fact that Helm 3 introduces major architectural changes,
more specifically, the removal of its server-side agent called Tiller - thus, being incompatible with
one another.

This commit adds this support by introducing a new configuration field (helmVersion).
By default, its values is set to 2 (Helm 2) to avoid breaking any existing functionalities.

* Use deployTool field to decide between Helm 2 or 3

* Remove helm init and replace wait for atomic in v3

* Update cmd/kubernetesDeploy.go

Nice catch!

Co-Authored-By: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Add documentation for kubernetesDeploy step

* Add helm3 example for kubernetesDeploy step using mandatory fields

* Add new line at the end of kubernetesDeploy documentation

* Link kubernetesDeploy step with docs generator

* Add possible values for deployTool in kubernetesDeploy

* dummy change

* Revert "dummy change"

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-04-24 09:37:11 +02:00
Marcus Holl
b25079f862
Provide tooling for malware scanning (#1329)
Tooling for malwareScanning.

Co-authored-by: Stengel <r.stengel@sap.com>
2020-04-23 09:12:10 +02:00
Christopher Fenner
f655c07a92
fix(sonar): do not fail on missing task report file (#1436)
* fix(sonar): do not fail on missing task report file

* fix format
2020-04-21 22:47:38 +02:00
Christopher Fenner
989c47db2c
feat(sonar): extract sonar project link to report JSON (#1390)
* add test cases for sonar pkg

* add sonar pkg

* read task report and write reports JSON

* use alias

* rename type

* set read permission on created files

* archive reports

* handle empty report lists

* use filepath

* simplify report creation

* improve error message

* Revert "archive reports"

This reverts commit ba4b56fec1.

* improve test cases

* Add descriptions

Co-Authored-By: Stephan Aßmus <stephan.assmus@sap.com>

* improve tests

Co-Authored-By: Stephan Aßmus <stephan.assmus@sap.com>

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-04-21 15:45:52 +02:00
Oliver Nocon
75a10742d3
Step generator: correct error handling (#1429)
Do not exit with os.Exit(1) but using log.Entry().Fatal() instead
2020-04-20 16:52:57 +02:00
Oliver Nocon
3a9bc54711
protecodeExecuteScan - align user parameter (#1426)
align parameter name for scan user with other steps
2020-04-20 16:44:01 +02:00
Roland Stengel
5e2b2481c3
tests(sonar): fix test cases for windows (#1407)
* sonar: fix test cases

some unit tests uses path.Joint() instead of filepath.Join()
as the code does. on window these unit tests fail.

* missing newline

* Update cmd/sonarExecuteScan_test.go

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-04-17 15:01:22 +02:00
Stephan Aßmus
a09482a14f
Convert invalid config value types (#1408)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-04-17 10:29:18 +02:00
Daniel Kurzynski
ce4be51362
Mask secrets (#1382) 2020-04-16 14:37:45 +02:00
Oliver Nocon
b9781ce50c
artifactPrepareVersioning: support more buildTools (#1367)
* artifactPrepareVersioning: support more buildTools
2020-04-15 13:12:43 +02:00
Christopher Fenner
70c000338f
fix: read config.yaml and config.yml in getConfig command (#1400) 2020-04-14 18:10:56 +02:00
Florian Wilhelm
b71ff0a055
Extend nexusUpload to also handle npm (#1379) 2020-04-11 12:56:44 +02:00
dominiklendle
66636d68f9
Hotfix for ServiceKey config parameter (#1377)
Changed from passing config as an array that was implemented badly to correct implementation that JSON config gets passed with ' '

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-04-09 16:57:50 +02:00
Christopher Fenner
c190deee44
refactor(sonar): switch to Sonar scan in GO (#1320)
* use sonar go in groovy

* use SONAR_TOKEN

* only use owner/repo if both are set

* trim version to major version digit

* fix code climate issues

* remove Sonar defaults

* use sonar go step

* use SONAR_TOKEN

* use certs from parameters

* use docker workspace & options

* add instance parameter

* implement branchName

* implement branchName

* remove duplicate default

* update docs

* fix TODOs

* remove merge mess

* fix code climate issue

* address comments

* respect custom defaults and custom config file name

* fix typo

* remove obsolete test cases

* disable CommonStepChecks

* check step config instead of context config

* remove TODOs

* respect jenkins PR envvars

* use value from stepConfig

* Update vars/sonarExecuteScan.groovy

* rename options to config

* correct type for options

* add test cases

* log sonar.options in debug message

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-04-08 12:55:46 +02:00
Daniel Mieg
bbaaef97ea
Include Transport & Execution Log in abapEnvironmentPullGitRepo() (#1347)
* Add logs and ABAP error messages

* Improve functions and tests

* Add improvements

* Further improvements

* Check for empty string for repositoryName

* Small adaptions

* Fix tests

* Add comments

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-04-08 12:43:41 +02:00
Oliver Nocon
ef99f710ae
artifactPrepareVersion: documentation (#1365)
* artifactPrepareVersion: documentation

* Fix CodeClimate finding

* Update generated file

* Update versioning.yaml

* Update docs wrt PR 1374

* update generated step

* Update resources/metadata/versioning.yaml

Co-Authored-By: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* Update resources/metadata/versioning.yaml

Co-Authored-By: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

* update generated file

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-04-08 09:28:03 +02:00
Oliver Nocon
909c77045d
artifactPrepareVersion: new versioning option (#1374) 2020-04-07 13:27:36 +02:00
Florian Wilhelm
9372aa1f43
Relax requirements for maven projects in nexus upload (#1348)
* iterate over found pom.xml files for maven projects, deploy found artifacts
* classifiers are found by testing prefix/suffix of artifact
* Remove additionalClassifiers option
* Improve documentation
* Fix fallback for finalBuildName
* Ignore mvn modules with packaging != pom but no target dir
* Fail when main artifact is missing, add more tests

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-04-03 21:32:38 +02:00
Oliver Nocon
999197b919
Add step to prepare the version for an artifact (#1343) 2020-04-03 16:34:40 +02:00
Christopher Fenner
2fb304588e
fix(sonar): use SONAR_TOKEN in Sonar go (#1357) 2020-04-02 10:44:22 +02:00
Stephan Aßmus
da0f25fd7b
Piper-Go: Allow aliases also for inputs of type "secret" (#1355)
* Fix typos

* Support aliases also for secrets

* Adapt & extend Unit Tests

* Output deprecation warning for param/secret aliases

... if the alias is marked as 'deprecated'.
2020-04-01 20:46:33 +02:00
Dominik Lendle
5fba815fe8
Transformation of cfCreateServiceKey to Golang (#1253) 2020-04-01 11:45:31 +02:00
Stephan Aßmus
96030304a1
Restore possibility to run piper without config file (#1345) 2020-03-31 16:06:27 +02:00
Stephan Aßmus
0b8b6f2b0c
Migrate stage artifact deployment from Cloud SDK Pipeline-Lib (#1324)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
Co-authored-by: Florian Geckeler <f.geckeler@sap.com>
2020-03-31 15:16:18 +02:00
Florian Geckeler
bb72c38413
Add documentation for mavenExecuteStaticCodeChecks groovy part (#1339)
* Add documentation for mavenExecuteStaticCodeChecks groovy part

* Add import

* Remove wrong default

* Add markdown file

* Add mkdocs

* Update vars/mavenExecuteStaticCodeChecks.groovy

Co-Authored-By: Daniel Kurzynski <daniel.kurzynski@sap.com>

* remove import

* remove import

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-03-31 11:29:44 +02:00
Daniel Mieg
86dd37c035
Increase timeout (#1319)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-03-31 10:56:57 +02:00
Oliver Nocon
91b6b0900f
Config and Defaults via http(s) (#1302)
* Config and Defaults via http(s)

Add the possibility to use http(s) urls as path to
* config.yml
* defaults

* Remove comment

* Addressing PR feedback

* Fix error handling
2020-03-31 08:47:09 +02:00
Florian Geckeler
bd92804745
Add static code checks stage (#1308)
* Add static code checks stage
* Rework go step to accept thresholds for the checks and fail maven build if above the thresholds
2020-03-30 15:59:59 +02:00
Stephan Aßmus
03096b5d05
Pass custom default-config files and custom project config from Jenkins side to piper (#1333) 2020-03-30 14:31:24 +02:00
Daniel Kurzynski
a40ac015a8
Add tests for maven build (#1276) 2020-03-26 08:23:21 +01:00
Stephan Aßmus
804bd8e3e0
http.go: Set fine-grained timeouts (#1257)
* Replace the default maximum request deadline with a default timeout on the transport level.
* Keep the possibility to set a maximum request deadline.
2020-03-23 15:02:22 +01:00
Stephan Aßmus
4f7955bede
Fix CLI exec call building for keytool (#1307) 2020-03-23 13:29:42 +01:00
Christopher Fenner
60b7d3a8df
refactor(sonar): implement Sonar step in GO (#1042)
* refactor(sonar): add initial metadata file for GO-based sonar step

* refactor(sonar): add initial generated files for GO-based sonar step

* refactor(sonar): add initial step file for GO-based sonar step

* refactor(sonar): add sonar cmd to executable

* refactor(sonar): cleanup metadata file

* fix(go): use capital TLS in golang names

* add download of Sonar scanner cli

* move download & unzip methods to FileUtils

* download certificate files

* use http.Downloader

* update generated code

* add slice prefix function

* update sonar step

* add test cases

* update docs

* use node:lts image

* use latest sonar-scanner

* add test cases

* use latest sonar-scanner

* fix test case

* change things

* return errors on functions

* limit changeID visibility

* use lowercase scm provider

* add test case for legacy PRs

* add test case

* update docs

* use local temp dir

* extend parameter visibility to GENERAL

* use SONAR_AUTH_TOKEN

* remove comments

* update generated code

* Apply suggestions from code review

* change to private fields

* use setter for sonar options & environment

* remove obsolete return statement

* add comment about Downloader mock

* add test case for custom options

* handle custom options

* refactor slice functions

* fix go fmt

* fix generated step code

* update docs
2020-03-23 10:38:31 +01:00
Stephan Aßmus
20b65d5a2e
Implement nexusUpload command and tests (#1255)
Artifacts to upload are assembled for MTA projects and Maven projects with optional application sub-module. Then maven deploy:deploy-file is used as backend to upload bundles of artifacts plus sub-artifacts.

Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-03-20 18:20:52 +01:00
Oliver Nocon
8fbeddb26c
Golang step metadata: Config aliases for steps (#1293)
* Golang step metadata: Config aliases for steps

This will ease following scenarios:
* config migration due to step name changes
* re-use of more general config, e.g. `mavenExecute` in `mavenBuild`

* fix CodeClimate finding

* Fix panic if original stage config does not exist yet
2020-03-19 17:24:35 +01:00
Daniel Kurzynski
4e9e31810c
Config maven in general 2020-03-17 12:09:08 +01:00
Daniel Mieg
81708648e4
Improve error handling (#1263) 2020-03-17 10:54:48 +01:00
Daniel Kurzynski
a923e4cfc2
Add maven build/install step (#1245) 2020-03-13 13:32:37 +01:00
Florian Geckeler
9a28e12d5d
Add groovy wrapper for mavenExecuteStaticCodeChecks and rename go step 2020-03-12 15:45:57 +01:00
Christopher Fenner
922a1796e0
fix(mta): add os.Environ() only once to command (#1260)
* add os.Environ() only once

* correct imports
2020-03-11 15:15:00 +01:00
Florian Geckeler
ed7f4831fb
Fix typo in mavenStaticCodeChecks.yaml 2020-03-10 09:59:22 +01:00
Florian Geckeler
de2909e64b
Add Maven static code checks
* add static code checks for maven based projects as:
  * pmd plugin
  * spotBugs plugin
* test modules as unit-tests and integration-tests will be ignored by default. Additional modules to ignore are configurable
* for pmd: rulesets and excludes are configurable
* for spotBugs: includeFilter and excludeFilter are configurable
2020-03-09 08:58:59 +01:00
Oliver Nocon
622d559eae
Add ServiceKey deletion to cloudFoundryDeleteService step (#1177) 2020-03-05 15:35:43 +01:00
Marcus Holl
2918ee52cc
Eliminte envMockRunner (#1233)
ExecMockRunner and ShellMockRunner both needs an environment. "Extending"
here leads to "subclasses" for both cases. That is more long-winded since
it could be.
2020-03-03 10:26:34 +01:00
Marcus Holl
52b0991a36
Get rid of two dimensional env array (#1235)
I don't understand why there should be a two dimensional array.
When dealing with envs we have normally a list containing entries like

[]string{"DEBUG=true", "HOME=/home/me"}

Having two dimensional env arrays would mean to have several alternate
environment in the tests at the same time. Don't think there is a need
for that.
2020-03-03 09:26:32 +01:00
Florian Geckeler
783d955654
Add mavenExecute to go lib 2020-02-28 13:09:46 +01:00
Marcus Holl
95a1a4d928
xsDeploy: simplifiy assertions in tests (#1211) 2020-02-28 11:20:17 +01:00
Marcus Holl
e10a7f20c7
xs deploy cpe inputs and outputs (#1111)
Use inputs and outputs from commonPipelineEnvironment

* mtaPath is read as input
* operationId is provided as output and read as input
2020-02-28 11:01:09 +01:00
Marcus Holl
161e0b5d3b
xsDeploy: check for operationId in go layer and return error in case it is missing (#1109) 2020-02-28 09:40:22 +01:00
Florian Geckeler
ef330e1eee
Move mock capabilities to pkg/mock/runner and adapt all tests 2020-02-27 12:11:22 +01:00
Christopher Fenner
3794371be3
fix typo (#1224)
Co-authored-by: Marcus Holl <marcus.holl@sap.com>
2020-02-26 16:21:40 +01:00
Marcus Holl
190a4708a2
go: mta build (#1128)
move mtaBuild step from groovy to go.

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-02-25 14:33:34 +01:00
Florian Geckeler
48fa0a7521
Add 'Code generated by' header to stepGoTemplate 2020-02-21 12:56:09 +01:00
Marcus Holl
d04edd5e8d
unify mocking for shell and exec runner (#1120)
* same behaviour for shellRunner and execRunner wrt errors and stdout

* replace shouldFail with shouldFailOnCommand

* [formatting only] format struct

* Move to regex for execptions and stdout

* shrink code
2020-02-21 10:56:53 +01:00
redehnroV
716ac7735d
Fixed error handling gitHubPublishRelease (#1184) 2020-02-14 14:56:23 +01:00
redehnroV
be03b3dfc1
Adjust documentation for Protecode (#1175) 2020-02-12 15:57:39 +01:00
Marcus Holl
38652eed04
[refactoring] Condence common functions for execRunner and shellRunner into runner interface (#1127)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-02-12 10:12:58 +01:00
dominiklendle
2007a94174
Add step cloudFoundryDeleteService (#1097) 2020-02-10 14:53:12 +01:00
redehnroV
c37df0d55e
Adjust protecode influx parameter (#1161) 2020-02-07 14:12:40 +01:00
redehnroV
2ebf2010b7
Protecode as GoLang (#1119)
* Protecode as go implementation

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-02-06 16:16:34 +01:00
Sven Merk
3139255312
Fix chars in checkmarx test, improve development.md (#1154)
* Fix chars in test

* Update DEVELOPMENT.md

* Update DEVELOPMENT.md

* Update DEVELOPMENT.md
2020-02-06 09:43:19 +01:00
Oliver Nocon
cead027bfb
Support yml and yaml extension of config files (#1153)
* Support yml and yaml extension of config files
* Update cmd/piper.go

Co-Authored-By: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-02-06 09:08:15 +01:00
Daniel Mieg
2e742c7ed3
Fix formatting of documentation (#1151)
* Fix formatting of documentation

* Regenerate go files
2020-02-05 15:46:14 +01:00
Daniel Mieg
6f0bde154b
Go implementation for abapEnvironmentPullGitRepo() (#1107) 2020-02-04 11:43:27 +01:00
Oliver Nocon
9c1bd04752
Streamline step generation (#1142)
* Streamline step generation
* Include PR feedback, update DEVELOPMENT.md

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-02-04 10:46:43 +01:00
Sven Merk
36423eb78d
Avoid potential collisions among steps (#1141)
* Avoid potential collisions amongst steps

* Improve code, move to JenkinsUtils

* Improve code

* Improve tests

* Fix test

* Add scope on golang side
2020-02-03 15:25:49 +01:00
Oliver Nocon
b542d15998
Enhance telemetry reporting (#1133)
* Enhance telemetry reporting
* Use central telemetry data object
* Add duration

Co-Authored-By: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-01-31 14:06:08 +01:00
Oliver Nocon
152c4dc9d2
Pass container image via CPE (#1113)
* Pass container image via CPE
* Update generated step
* update map name to better represent content
2020-01-29 16:03:18 +01:00
Marcus Holl
40f0a17b45
re-use execRunner for envExecRunner (#1117)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-01-29 14:22:43 +01:00
Christopher Fenner
aa3fb8adb4
feat(go): add telemetry reporting (#1100)
* Add telemetry support

* First round telemetry

* Add telemetry flag

* fix: move files to avoid import cycles

* add noTelemetry as global config option

* Respect telemetry configuration for reporting

* add site id, swa endpoint

* correct logger initialization

* add http logic

* rename init method

* rename consts & types

* convert struct to payload

* convert data to payload string

* move activation flag out of data structure

* extract types to own file

* build query using net/url

* correct field mapping

* extract notify coding to own file

* cleanup parameter mapping

* preare base data

* fix codeclimate issue

* correct test case

* fill values from env

* test all fields

* untrack notify.go

* ignore empty custom values

* cleanup data.go

* add test cases

* cleanup

* add usage reporting to karma step

* add usage reporting to step generator

* externalise siteID

* correct custom field names

* test env handling

* simplify method signature

* revert parameter negation

* correct import

* adjust golden file

* inclease log level

* ignore test case

* Revert "inclease log level"

This reverts commit 70cae0e029.

* add test case for envvars

* remove duplicate reporting

* remove duplicate reporting

* correct format

* regenerate checkmarx file

* add log message on deactivation

* rename function

* add comments to understand SWA mapping

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-01-29 13:17:54 +01:00
Christopher Fenner
92441577d8
fix(NPM): change NodeJS image to LTS (#1069)
* change NodeJS image to current LTS

* Update default_pipeline_environment.yml

* Update SonarExecuteScanTest.groovy

* use node:lts-stretch image
2020-01-29 11:17:56 +01:00
Sven Merk
cbe368fe36
Checkmarx as golang (#1075)
* 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
2020-01-27 23:40:53 +01:00
Oliver Nocon
73ab887f25
Add kubernetesDeploy step (#1073)
* Add kubernetesDeploy step

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-01-24 14:30:27 +01:00
Oliver Nocon
a46b57e6b4
Persisted pipeline environment for golang library (#1091)
* Use commonPipelineEnvironment in go binary

* Update groovy part incl. tests

* Rework structure and naming

* Support influx resources in steps

* Update tests and some cleanups

* Add correct defer handling

* Address PR feedback

* Fix test

* Update resources.go

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-01-15 12:16:25 +01:00
Oliver Nocon
7597c7d228
Add step githubCreatePullRequest (#1068)
* Add step githubCreatePullRequest
2019-12-16 16:34:12 +00:00
Oliver Nocon
4f57738888
Detect: Add golang implementation (#1049)
Add detect golang implementation
2019-12-13 09:55:45 +00:00
Marcus Holl
9cd4950437
Don't swallow error raised from file exists helper method (#1019)
* Don't swallow error raised from file exists helper method

* streamline
2019-12-11 10:13:23 +01:00
Marcus Holl
9ee2926018
xs deploy go (#931)
introduce xs deploy
2019-12-05 14:22:38 +01:00
Oliver Nocon
8e29b70ea2
Fix parameters for githubPublishrelease (#1004) 2019-11-22 15:58:24 +01:00
Marcus Holl
0abda0c67b
Remove redundancy: no duplicate stepName (#998)
* Remove redundancy: no duplicate stepName

Up to now: provided explicity via command line argument and also contained in the
step metadata (which are as a file also provided as command line argument).

Now it is retrieved from the metadata file.

* Step name is not a required parameter anymore

Since the step name is derived from the config file

* Adjust method signature in test
2019-11-22 10:14:21 +01:00
Oliver Nocon
e671094308
Use piper binary for githubPublishRelease (#990)
* Use piper binary for githubPublishRelease
2019-11-21 16:34:22 +01:00
Oliver Nocon
0f33f7a2ef
Consider custom defaults in config.yml (#995)
* Consider custom defaults in config.yml
2019-11-21 16:09:57 +01:00
Marcus Holl
e6f9d541ca
Add stdout/stderr to the interfaces (shellRunner, execRunner) (#948)
Otherwise we cannot set the streams on the level of the interfaces.
2019-11-19 14:29:53 +01:00
Marcus Holl
c9883bf5b0
Pr/read project config only if it exists (#959)
* Read the project config only if it exists

This avoid trying reading the file and have the control flow based
on errors. Beside that it helps troubleshooting when we have some
logging (debug level only).

* formatting only

* Adjust log level
2019-11-11 09:52:44 +01:00
Marcus Holl
f4aa5fc377
Let the mocks fail if error is provided from a test (#940)
There was some command parsing with failure in case it started with fail. That is
IMO less transparent. Now we prepare more explicit with a failure from outside. This
enables us to prepare an error like we expect it in the free wild.
2019-11-07 09:02:11 +01:00
Marcus Holl
7c5a8a73bc
Helper for fileExists (#954)
Since we need it at several places (next use case will be step xsDeploy) we should
have a helper for that.
2019-11-07 08:17:42 +01:00
Oliver Nocon
ede322c8bb
Export general configuration - part 2 (#957)
* Export general configuration - part 2

First part in #956 missed to export the elements of the struct ...

* Add comment for exported struct

* Add function for opening config files
2019-11-06 16:22:50 +01:00
Oliver Nocon
bb230d3b9b
Export general configuration (#956)
Allow for package external access to general configuration.

Use-case: re-use individual steps
2019-11-06 14:07:41 +01:00
Christopher Fenner
ae221a8ea7
Merge branch 'master' into goGithub 2019-11-06 12:28:48 +01:00
Sven Merk
6721c59a30
Merge branch 'master' into cfg-hierarchical-defaults 2019-11-06 12:13:15 +01:00
Oliver Nocon
d9a7faed0f
Merge branch 'master' into goGithub 2019-11-06 10:32:22 +01:00
Marcus Holl
a456282d6a
fix: getting config should also work in case there is no project config (#951) 2019-11-06 10:28:15 +01:00
OliverNocon
deb965e2b4 Fix CodeClimate finding with generator update 2019-11-06 09:12:50 +01:00
OliverNocon
5c87d4775c Ensure asset update for latest release only 2019-11-06 09:05:07 +01:00
Oliver Nocon
147bc745af
Merge branch 'master' into cfg-hierarchical-defaults 2019-11-05 21:52:47 +01:00
Marcus Holl
58128be970 apply formatter (#950) 2019-11-05 21:51:44 +01:00
OliverNocon
48bfc10956 Address PR feedback 2019-11-05 17:33:00 +01:00
OliverNocon
1a034aea4c Update parameter names 2019-11-05 15:13:04 +01:00
OliverNocon
50153f42c7 Add tests 2019-11-05 14:37:44 +01:00
Sven Merk
0ba9baab6a
Merge branch 'master' into cfg-hierarchical-defaults 2019-11-04 16:31:02 +01:00
Sven Merk
c241066e21 Add capability for hierarchical defaults in golang 2019-11-04 16:29:39 +01:00
OliverNocon
4302066327 Merge master 2019-11-04 16:11:13 +01:00
OliverNocon
6256a0b9aa Update githubPublishRelease 2019-11-04 16:07:30 +01:00
Christopher Fenner
742a67fc60 Add GO logging with logrus (#938)
* add log package
* add logrus dependency
* add logging to karma step
* add log stepName to generator, respect verbose flag
2019-11-04 14:43:33 +01:00
Marcus Holl
5b2d3a1663
Version command for piper go (#922) 2019-10-31 13:57:29 +01:00
Oliver Nocon
101ccaf7f6
Add karma command (#937) 2019-10-30 10:08:41 +01:00
OliverNocon
803d9ccbef Merge branch 'master' of https://github.com/SAP/jenkins-library 2019-10-30 10:05:16 +01:00
Marcus Holl
74dd263834 Prepare testing command/shell executions (#930)
* Move shell call related mocks to piper_test.go
2019-10-30 09:52:41 +01:00
OliverNocon
b6884832ba Add karma command 2019-10-30 09:20:25 +01:00
Oliver Nocon
e01b3327fd
Go configuration - add aliasing functionality (#925)
* Go configuration - add aliasing functionality

This assists in backward compatibility cases.
It is now possible to define per parameter aliases.
2019-10-29 10:58:24 +01:00
Oliver Nocon
d053653a93
Add golang implementation for karma tests (#919)
* Provide golang based karma step
2019-10-25 14:58:59 +02:00
Oliver Nocon
1f34511407
Provide golang based Piper library (#915)
* Provide golang based Piper  library

This includes the main command
and a sub command for config resolution
2019-10-24 10:59:58 +02:00