Commit Graph
100 Commits
Author SHA1 Message Date
Stephan Aßmus 23d378d4ce Conditions for npmExecuteScripts in Additional Unit Tests (#2357) 2020-11-12 12:41:11 +01:00
Stephan Aßmus 115cfb5bae Run nexusUpload in stage Promote (#2349) 2020-11-11 16:32:23 +01:00
Stephan Aßmus 87e8d5d160 Extend the legacy config check for "required" config keys (#2332) 2020-11-10 14:18:37 +01:00
Stephan Aßmus eff38f6c9d whitesourcExecuteScan-go: Additional fixes (#2315)
* Make sure the UA scan is known to the scan object. Fixes downloading reports later on.
* Move polling into pkg/whitesource, add test for e2e scan
* Remove conditions from stash config resource
* Don't use version stored in CPE. This will prevent the versioningModel from being applied.
2020-11-10 09:09:51 +01:00
Stephan Aßmus 14d7196495 Accumulate config validation errors (#2323)
* Instead of letting the pipeline fail for the first config validation error, accumulate all errors and output them to the log, then fail.
* Beginnings of a resource for validating a config.yml migrated to the GPP. Can be configured in the general section:
```yaml
general:
  legacyConfigSettings: 'com.sap.piper/pipeline/cloudSdkToGppConfigSettings.yml'
```
2020-11-06 10:17:26 +01:00
Stephan Aßmus e5c4bd6ba3 Add "checkGatling" to deprecated steps (#2309) 2020-11-04 10:53:38 +01:00
Stephan AßmusandDaniel Kurzynski 8007a1a6c6 New step gatlingExecuteTests, used in Performance stage (#2298)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-11-03 17:42:02 +01:00
Stephan AßmusandOliver Nocon b070d2f4ed fortifyExecuteScan: fix quoting of default values for "src" (#2297)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-02 17:21:14 +01:00
Stephan AßmusandChristopher Fenner 582419e2f5 Up for discussion: Embed best practices (?) in generated steps (#1913)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-10-29 17:29:07 +01:00
Stephan Aßmus 86f335811c whitesourceExecuteScan-go: Implement parameters "timeout", "createProductFromPipeline" (#2246) 2020-10-29 09:21:01 +01:00
Stephan Aßmus d1fedd9ba8 Remove "onlyInProductiveBranch" check (#2253) 2020-10-28 17:08:38 +01:00
Stephan Aßmus 2f83ba56da Make sure detect.sh is removed after use (#2238)
Should avoid issues with this file being owned by root (perhaps via running in docker container), preventing the workspace from being cleaned properly.
2020-10-27 14:29:22 +01:00
Stephan Aßmus 260ca2c5a5 whitesourceExecuteScan: Re-organize code between step and whitesource package (#2207) 2020-10-20 09:49:26 +02:00
Stephan Aßmus ed97142f6d Pass correct module path to npm.InstallAllDependencies() (#2144)
We are already in the module's directory.
2020-10-09 08:33:36 +02:00
Stephan Aßmus 6379c25409 Forward config-related params to setupCommonPipelineEnvironment (#2117) 2020-10-05 12:12:06 +02:00
Stephan Aßmus fc55d02230 Fix conditions for whitesourceExecuteScan (#2097) 2020-09-30 12:37:01 +02:00
Stephan AßmusandFlorian Wilhelm 54ea3ed51a whitesourceExecuteScan: bypass UA for mta, maven, npm and yarn (#1879)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-09-29 12:44:31 +02:00
Stephan Aßmus 33e6e13787 Refactor whitesourceExecuteScan, fix polling, error handling (#2036) 2020-09-18 11:54:45 +02:00
Stephan Aßmus c1852dbc17 Document use of 'compliance' stage by Cloud SDK pipeline (#2020) 2020-09-15 09:38:10 +02:00
Stephan Aßmus 6a0d694d0c Revert adding JaCoCo report paths to options (#2017) 2020-09-14 17:40:02 +02:00
eb09f2d902 Extend sonarExecuteScan parameters (#1982)
* Add projectKey and coverageExclusions params
* Also add binary, coverage exclusions and jacoco related options to sonar execution.

Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
Co-authored-by: Kevin Hudemann <kevin.hudemann@sap.com>
2020-09-11 13:39:17 +02:00
Stephan Aßmus 30fc9b24ec Add mavenExecuteIntegration to documented steps (#2003) 2020-09-10 16:18:23 +02:00
Stephan Aßmus dc9a6d7b2b SonarQube: Remove check for non-productive branch (#1998) 2020-09-10 10:09:17 +02:00
Stephan Aßmus c95f2d10ca Check env.BRANCH_NAME before using (#1992) 2020-09-09 12:38:38 +02:00
Stephan Aßmus e6534d0400 Run SonarQube scan in Compliance stage (#1974) 2020-09-08 17:28:29 +02:00
Stephan Aßmus a44fa4ccda Make protecodeExecuteScan tests run in temp dir (#1966)
Fixes left-over files in cmd/
2020-08-31 08:45:00 +02:00
Stephan Aßmus 7811def7c6 Add technical stage names behind feature toggle (#1933) 2020-08-28 16:11:35 +02:00
Stephan AßmusandChristopher Fenner 8169d56ef7 Groovy: Load step defaults also from stages section in defaults (#1943)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-08-26 15:32:58 +02:00
Stephan AßmusandKevin Hudemann 46284d8f34 Add optional wrapper for cloudFoundryDeploy go-implementation (#1952)
Co-authored-by: Kevin Hudemann <kevin.hudemann@sap.com>
2020-08-24 18:10:45 +02:00
Stephan Aßmus 07b5142417 Fix cloudFoundryCreateService parameter scopes (#1935) 2020-08-19 19:20:52 +02:00
Stephan Aßmus b1a0cb089c piper: Use stageName from parametersJSON, log value and source (#1920)
stageName from parametersJSON was ignored up until now and there was a TODO in the code. The precedence from the TODO is not clear to me. It said "first env.STAGE_NAME, second: parametersJSON, third: flag". So maybe I implemented it wrongly, but it would be easy to change. Right now, STAGE_NAME is always in the ENV when piper is called from Jenkins, but to mimic the behavior of being able to pass `stageName` in the parameters and override the ENV value, this is what happens in go as well now.

The reason why `stageName` needs to be evaluated before other step parameters is that it affects config evaluation. So I've added a function which is called first in `PrepareConfig()`.
2020-08-13 17:55:12 +02:00
Stephan Aßmus 6a71feeafd Align stage name (#1922)
* Set env.STAGE_NAME to stageName from params
* Revert #1796
2020-08-13 17:01:22 +02:00
Stephan Aßmus 5338ea1476 fortifyExecuteScan: Make URL parameters more robust (#1900) 2020-08-11 18:07:06 +02:00
Stephan Aßmus 54444c7e33 fortifyExecuteScan: Fix polling project status (#1908) 2020-08-11 15:29:00 +02:00
Stephan Aßmus b8f5fd9b28 fortifyExecuteScan: Pass on maven options to versioning (#1895) 2020-08-07 10:31:15 +02:00
Stephan Aßmus ec779a719b Checkmarx: honor "preset" parameter also for existing projects (#1893) 2020-08-06 17:20:26 +02:00
Stephan Aßmus c54a55287a checkmarxExecuteScan: Add two (deprecated) aliases (#1883) 2020-08-05 14:15:24 +02:00
Stephan Aßmus 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ßmus 9009c831fb Declare non-optional server URLs mandatory (#1866)
* Declare non-optional server URLs mandatory
2020-07-30 09:13:46 +02:00
Stephan AßmusandFlorian Wilhelm a61798ccbf New step mavenExecuteIntegration (#1829)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-07-29 19:51:27 +02:00
Stephan Aßmus 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ßmus 0134332a6e Revert "Bugfix: Convert int/float parameters (#1837)" (#1849)
This reverts commit 7f4fab762d.
2020-07-27 11:13:13 +02:00
Stephan Aßmus 7f4fab762d Bugfix: Convert int/float parameters (#1837) 2020-07-27 08:30:02 +02:00
Stephan Aßmus 61fed83475 Improve self-consistency of file system mock (#1815) 2020-07-20 14:23:33 +02:00
Stephan Aßmus dc99676c8d Init container map via YAML resource (#1695) 2020-06-24 17:04:58 +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
Stephan AßmusandFlorian Wilhelm 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ßmus c693c4c7dc Increase default transport timeout to 3 mins (#1648) 2020-06-10 11:14:55 +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
Stephan Aßmus 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
Stephan AßmusandDaniel Kurzynski 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
Stephan AßmusandDaniel Kurzynski c5f3b85037 Strip "./" from artifacts (#1611)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-05-29 10:59:55 +02:00
Stephan Aßmus 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ßmus e6f5544601 Implement YAMLfile.GetCooridnates() (#1604) 2020-05-27 17:20:34 +02:00
Stephan Aßmus ac122a84e7 Fix mtarName config param handling (#1570) 2020-05-19 22:02:47 +02:00
Stephan Aßmus 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ßmus 5f48d4d767 Execute test in temp folder (#1561) 2020-05-18 10:31:38 +02:00
Stephan Aßmus 22fe087598 Fix name of credentials ID param (#1552) 2020-05-14 19:17:47 +02:00
Stephan AßmusandDaniel Kurzynski 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ßmus 80d53dae79 Reading defaults in go: Make sure all io.ReadClosers are closed (#1529) 2020-05-12 15:46:47 +02:00
Stephan Aßmus 75100ecbb3 Merge duplicated jenkinsKubernetes keys in defaults (#1514) 2020-05-07 09:31:52 +02:00
Stephan Aßmus 082b249cc0 Fix logrus buffer issue (#1511) 2020-05-06 13:35:40 +02:00
Stephan Aßmus 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ßmus 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
Stephan AßmusandDaniel Kurzynski 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ßmus ded6152b56 nexusUpload: Remove config processing from Groovy layer (#1364) 2020-04-04 11:44:02 +02:00
Stephan Aßmus 7dbf3ba5bf Generate documentation for nexusUpload (#1356) 2020-04-01 23:48:51 +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
Stephan Aßmus 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
Stephan AßmusandDaniel Kurzynski 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ßmus 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ß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
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
Stephan AßmusandFlorian Wilhelm 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ßmus 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ßmus 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ßmus 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ßmus 2014a8b4ae Utils.evaluateFromMavenPom(): Handle errors (#1192)
Handle error to evaluate by throwing an exception
2020-02-25 21:02:04 +01:00
Stephan Aßmus 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ßmus 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ßmus 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ßmus 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ßmus 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ßmus 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ßmus 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ßmus c20dba2744 Merge branch 'master' into stashing-steps 2020-01-29 20:57:28 +01:00
Stephan Aßmus a7543fd19b Merge branch 'master' into stashing-steps 2020-01-29 16:19:17 +01:00