Commit Graph
78 Commits
Author SHA1 Message Date
Stephan AßmusandGitHub 5338ea1476 fortifyExecuteScan: Make URL parameters more robust (#1900) 2020-08-11 18:07:06 +02:00
Stephan AßmusandGitHub 54444c7e33 fortifyExecuteScan: Fix polling project status (#1908) 2020-08-11 15:29:00 +02:00
Stephan AßmusandGitHub b8f5fd9b28 fortifyExecuteScan: Pass on maven options to versioning (#1895) 2020-08-07 10:31:15 +02:00
Stephan AßmusandGitHub ec779a719b Checkmarx: honor "preset" parameter also for existing projects (#1893) 2020-08-06 17:20:26 +02:00
Stephan AßmusandGitHub c54a55287a checkmarxExecuteScan: Add two (deprecated) aliases (#1883) 2020-08-05 14:15:24 +02:00
Stephan AßmusandGitHub aa9c88cef9 Do not collect test results in wrapper (#1869)
This is supposed to happen at the end of a stage
2020-07-30 16:10:20 +02:00
Stephan AßmusandGitHub 9009c831fb Declare non-optional server URLs mandatory (#1866)
* Declare non-optional server URLs mandatory
2020-07-30 09:13:46 +02:00
a61798ccbf New step mavenExecuteIntegration (#1829)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-07-29 19:51:27 +02:00
Stephan AßmusandGitHub 40440f8f01 Bugfix: Convert int/float parameters (2nd try) (#1851)
* If a step declares a parameter of type string, depending on how the config is written, it is no longer ignored, if it is interpreted by the yaml parser as integer or float value.
* If an expected parameter is present in the configuration, step execution will consistently fail if the parameter has the wrong type, no sensible conversion can take place, and it is known that the parameter will be ignored.
* For all type-mismatches that have no implemented conversion, a warning is logged. (It isn't known whether the conversion actually works, since it depends on both the yaml and json packages and future changes there.)
* Entries in the evaluated config with a value of nil are ignored.
2020-07-29 09:22:10 +02:00
Stephan AßmusandGitHub 0134332a6e Revert "Bugfix: Convert int/float parameters (#1837)" (#1849)
This reverts commit 7f4fab762d.
2020-07-27 11:13:13 +02:00
Stephan AßmusandGitHub 7f4fab762d Bugfix: Convert int/float parameters (#1837) 2020-07-27 08:30:02 +02:00
Stephan AßmusandGitHub 61fed83475 Improve self-consistency of file system mock (#1815) 2020-07-20 14:23:33 +02:00
Stephan AßmusandGitHub dc99676c8d Init container map via YAML resource (#1695) 2020-06-24 17:04:58 +02:00
Stephan AßmusandGitHub 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
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
Stephan AßmusandGitHub c693c4c7dc Increase default transport timeout to 3 mins (#1648) 2020-06-10 11:14:55 +02:00
Stephan AßmusandGitHub 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
Stephan AßmusandGitHub f90a4f9eae Provide an ExecRunner implementation for running commands in docker (#1606)
* ExecRunner implementation for executing commands within docker
* Add whole-file example as documentation
2020-06-02 14:24:06 +02:00
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
c5f3b85037 Strip "./" from artifacts (#1611)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-29 10:59:55 +02:00
Stephan AßmusandGitHub 6a96629d65 Provide a timeout of 20m for the go Integration Tests (#1613)
* Provide a timeout of 20m for the go IT
Default is 10m, see https://golang.org/cmd/go/#hdr-Testing_flags
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-28 18:28:38 +02:00
Stephan AßmusandGitHub e6f5544601 Implement YAMLfile.GetCooridnates() (#1604) 2020-05-27 17:20:34 +02:00
Stephan AßmusandGitHub ac122a84e7 Fix mtarName config param handling (#1570) 2020-05-19 22:02:47 +02:00
Stephan AßmusandGitHub 7d3f201609 Ignore invalid entries in custom defaults (#1558)
Extend tests, ignore invalid custom defaults entries
2020-05-18 10:59:02 +02:00
Stephan AßmusandGitHub 5f48d4d767 Execute test in temp folder (#1561) 2020-05-18 10:31:38 +02:00
Stephan AßmusandGitHub 22fe087598 Fix name of credentials ID param (#1552) 2020-05-14 19:17:47 +02:00
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
Stephan AßmusandGitHub 80d53dae79 Reading defaults in go: Make sure all io.ReadClosers are closed (#1529) 2020-05-12 15:46:47 +02:00
Stephan AßmusandGitHub 75100ecbb3 Merge duplicated jenkinsKubernetes keys in defaults (#1514) 2020-05-07 09:31:52 +02:00
Stephan AßmusandGitHub 082b249cc0 Fix logrus buffer issue (#1511) 2020-05-06 13:35:40 +02:00
Stephan AßmusandGitHub dd94ba7213 TransportTimeout now refers to any state (#1467)
The TransportTimeout value is now applied to the "response header
timeout" and "expect continue timeout" as is. Previously there
was a hard limit of 10 seconds and 1 second respectively (originating
from the article I based the previous PR on). While this doesn't
allow for fine-grained control, it is reasonable to apply the meaning
of "transport timeout" to any state or phase of a HTTP connection.
This change should solve the needs of some Piper clients to configure
very long response header timeouts of 5 minutes and above.
2020-04-28 21:48:00 +02:00
Stephan AßmusandGitHub 8e871e5c38 Begin documenting best practices for go development (#1447)
Just a start for now, to be extended
2020-04-24 18:53:04 +02:00
a09482a14f Convert invalid config value types (#1408)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-04-17 10:29:18 +02:00
Stephan AßmusandGitHub ded6152b56 nexusUpload: Remove config processing from Groovy layer (#1364) 2020-04-04 11:44:02 +02:00
Stephan AßmusandGitHub 7dbf3ba5bf Generate documentation for nexusUpload (#1356) 2020-04-01 23:48:51 +02:00
Stephan AßmusandGitHub 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
Stephan AßmusandGitHub 96030304a1 Restore possibility to run piper without config file (#1345) 2020-03-31 16:06:27 +02:00
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
0c6dabbd1e Pass custom config and default configs also to getConfig (#1346)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-03-31 13:10:02 +02:00
Stephan AßmusandGitHub 527baf28fd Future proof the http-timeout test for go 1.14 (#1321)
Fix flaky test expectations. The exact error message has changed in go 1.14.
2020-03-31 09:18:09 +02:00
Stephan AßmusandGitHub 03096b5d05 Pass custom default-config files and custom project config from Jenkins side to piper (#1333) 2020-03-30 14:31:24 +02:00
Stephan AßmusandGitHub 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ßmusandGitHub 4f7955bede Fix CLI exec call building for keytool (#1307) 2020-03-23 13:29:42 +01:00
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
Stephan AßmusandGitHub e51cfe276c Fix copy-paste-bug for downloading settings (#1284)
* Fix copy-paste-bug for downloading settings
* Extend unit tests accordingly.
* Fix some expected versus actual mixup
2020-03-17 08:33:35 +01:00
Stephan AßmusandGitHub e0c789a791 Add Evaluate() method to maven package (#1268)
Useful for evaluating properties from pom files using the Maven evaluate plugin.
2020-03-13 14:54:49 +01:00
Stephan AßmusandGitHub 84f3e10e3b Implementation of Nexus upload as Go package (#1250)
The nexus package implements uploading artifacts to a Nexus repository manager version 2 or 3 via HTTP. It also generates the MD5 and SHA1 hash files for the uploaded artifacts in the Nexus repository.
2020-03-06 23:10:10 +01:00
Stephan AßmusandGitHub 2014a8b4ae Utils.evaluateFromMavenPom(): Handle errors (#1192)
Handle error to evaluate by throwing an exception
2020-02-25 21:02:04 +01:00
Stephan AßmusandGitHub 9658f3b480 writeFile() cannot be passed a Map (#1163)
* writeFile() cannot be passed a Map

I've changed the return type of DebugReport.generateReport() from
String to Map in order to get the generated file name as part of the
return value instead of getting it from a field of DebugReport. The
UnitTest checks whether writeFile() creates the debug_report file
successfully and whether it has the expected contents. The effect
of passing the Map instead of map.contents to writeFile() should
have been an unnecessary wrapping via Map.toString() as in the test,
but in the execution context of Jenkins, this throws an
IllegalArgumentException: Could not instantiate {... and then the
results of map.toString().

* Improve JenkinsWriteFileRule compatibility

Calling m.text.toString() is wrong, since the type stored at m.text
already needs to be a String (or GString). Expecting valid parameters
here makes sure problems are detected by tests already. (All tests
pass as before.)
2020-02-10 12:25:33 +01:00
Stephan AßmusandGitHub 71766be2f5 Pass stageName to dockerExecuteOnKubernetes (#1162)
This fixes configuring sidecars for the given stage when Jenkins runs
on Kubernetes and the surounding stage has passed a stageName via parameters which is different from env.STAGE_NAME.
2020-02-08 12:57:55 +01:00
Stephan AßmusandGitHub c628d208c7 Implement archiving the debug report as step (#1152)
* Implement archiving the debug report as step
2020-02-07 16:30:08 +01:00
Stephan AßmusandGitHub ad7256a56e Merge pull request #1146 from SAP/extension-error-handling
Executing extensions in handlePipelineStepErrors
2020-02-04 14:28:09 +01:00
Stephan Aßmus 164c12b9f0 Executing extensions in handlePipelineStepErrors
The code of extensions was not executed within the try-catch-block of
handlePipelineStepErrors. The main benefit of this change is better
logging and re-using the 'unstable' feature also for
extended/overwritten steps.
2020-02-04 12:33:13 +01:00
Stephan AßmusandGitHub d1b94a8f29 Merge pull request #1143 from SAP/env-utils
Added EnvironmentUtils needed by DebugReport (#1126)
2020-02-04 06:35:43 +01:00
Stephan Aßmus 1d9ecdb999 Added EnvironmentUtils needed by DebugReport
This should have been added along with DebugReport. For context:
EnvironmentUtils used to be a class alongside DebugReport and thus
there was no 'import' directive. Working with Jenkins DSL stuff
has numbed my ability to pay attention to the IDE indicating errors.
2020-02-03 17:07:56 +01:00
Stephan AßmusandGitHub f6da8c6f3c Merge pull request #1126 from SAP/debug-report
Add DebugReport facility
2020-02-03 14:05:53 +01:00
Stephan Aßmus c06d4c95d6 Add pipelineStageWrapper test for global extension 2020-02-03 12:37:20 +01:00
Stephan Aßmus 0c2fb3181a Test DebugReport usage in piperStageWrapper 2020-02-03 12:37:20 +01:00
Stephan Aßmus 3010cb0c10 Test DebugReport usage in handlePipelineStepErrors 2020-02-03 12:37:20 +01:00
Stephan Aßmus fbcae5be53 Exchange wrong TODO with NOTE about what actually happens 2020-02-03 12:37:20 +01:00
Stephan Aßmus 942e6dd18a Don't check for isResilient, use failOnError 2020-02-03 12:37:20 +01:00
Stephan Aßmus 4420c34e4f Integrate DebugReport with handlePipelineStepErrors 2020-02-03 12:37:20 +01:00
Stephan Aßmus 8e953715a0 DebugReport: Log failure to retrieve Jenkins plugins 2020-02-03 12:37:20 +01:00
Stephan Aßmus 6c9e23db40 Feed DebugReport from piperStageWrapper
Information about overwritten/extended stages is stored in DebugReport (as done before in SDK Pipeline's runAsStage).
2020-02-03 12:37:20 +01:00
Stephan Aßmus 6e551dfc79 Add DebugReport facility
The DebugReport is a global instance where steps can store information relevant for diagnosing failed pipelines. In the SDK Pipeline, this is used to generate a debug report within the postActionArchiveDebugLog step. The reason for adding this to Piper is to feed information about extended or overwritten stages in piperStageWrapper into the DebugReport, as was done before in the SDK Pipeline's equivalent runAsStage step.
2020-02-03 12:37:20 +01:00
Stephan AßmusandGitHub 1f2ae0fcef Merge pull request #1122 from SAP/stashing-steps
Move stage stashing functionality into Utils
2020-01-29 21:57:09 +01:00
Stephan AßmusandGitHub c20dba2744 Merge branch 'master' into stashing-steps 2020-01-29 20:57:28 +01:00
Stephan AßmusandGitHub a7543fd19b Merge branch 'master' into stashing-steps 2020-01-29 16:19:17 +01:00
Stephan Aßmus 479123a800 Remove try-blocks in new stashing methods 2020-01-29 15:13:21 +01:00
Stephan AßmusandGitHub 948d07ce7d Merge branch 'master' into stashing-steps 2020-01-29 14:38:53 +01:00
Stephan AßmusandGitHub 282934d70a Merge branch 'master' into stashing-steps 2020-01-29 13:51:48 +01:00
Stephan AßmusandGitHub 40121f3fa0 Merge branch 'master' into stashing-steps 2020-01-29 13:36:29 +01:00
Stephan Aßmus 53833eaae9 Move stage stashing functionality into Utils
* No functional change intended
 * Steps in the SDK pipeline may use Utils for stashing,
   as separate stashFiles and unstashFiles steps are eliminated.
2020-01-29 12:30:07 +01:00
Stephan AßmusandGitHub 7ead134d68 Introduce support for different"interceptor APIs" in extensions 2020-01-24 14:06:09 +01:00
Stephan Aßmus 878e09abbb Adopt work-around for Jenkins on Kubernetes regarding deleteDir()...
... from SDK pipeline.
2020-01-24 11:29:35 +01:00
Stephan Aßmus ddd10683c4 Added support for old "interceptor API" for extensions
This is part of the effort to get rid of the "runAsStage" step in the SDK pipeline, and use piperStageWrapper directly. The SDK pipeline currently needs to support for loading "old" extensions where the call() method had different parameters. The support for the exact API can and should be removed, however, having a mechanism for supporting old extension APIs seems beneficial in general.

Another crucial change is the deleteDir() call before unstashing at the beginning of the stage. Without this, the SDK pipeline fails to unstash, since apparently the workspace may not always be clean at that point.
2020-01-24 11:29:35 +01:00
Stephan Aßmus f59d9f9d49 Added Unit-Test for extensions using an older API 2020-01-24 11:29:35 +01:00
Stephan Aßmus 88a2600d2d Removed ',' pointed out as syntax error by IDE 2020-01-24 11:29:34 +01:00