1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
Commit Graph

2022 Commits

Author SHA1 Message Date
TheFonz2017
41dcebb3a5 Variable Substitution in YAML Files (#852)
* Changes:
- New YamlSubstituteVariables step to substitute variables in YAML files with values from another YAML
- New Tests, that check the different substitution patterns.
- Added test resources, including various manifest and variables files.
- Improved usage of JenkinsLoggingRule
- Improved JenkinsReadYamlRule to properly reflect the mocked library's behaviour.
- Added a new JenkinsWriteYamlRule.

* Changes:
- added a Logger that checks a config.verbose flag before it logs debug messages.
- changed error handling to rethrow Yaml parsing exception in case of wrongly-formatted Yaml files.
- changed JenkinsWriteYamlRule to capture Yaml file details of every invocation of writeYaml. This allows sanity checks at end of tests, even if there were multiple invocations.
- adjusted tests.

* Changes:
- Removed javadoc-code blocks from API documentation since they are not supported.
- Removed skipDeletion boolean.
- Added a new deleteFile script which deletes a file if present.
- Added a new JenkinsDeleteFileRule to mock deleteFile script and optionally skip deletion for tests.
- Adjusted yamlSubstituteVariables script.
- Adjusted tests to include new JenkinsDeleteFileRule.
- Changed code that deletes an already existing output file to produce better logs.

* Changes:
- Turned yamlSubstituteVariables into a script that works purely based on Yaml data (not files).
- Added a new cfManifestSubstituteVariables that uses yamlSubstituteVariables under the hood but works based on files.
- Adjusted tests, and added new ones.

* Adjusted documentation and a few log statements.

* Changed documentation to no longer include javadoc code statements.

* Made mocking of deletion of a file a default. Adjusted tests.

* Changed signature of yamlSubstituteVariables' call method to return void.

* Changes:
- Fixed naming issues in deleteFile.
- Renamed Logger to DebugHelper.
- Fixed some documentation.

* Changed implementation of deleteFile not to use java.io.File - which is evil when using it for file operations.

* PROPERLY Changed implementation of deleteFile not to use java.io.File - which is evil when using it for file operations.

* Changes:
- Added tests for deleteFile script
- Changed JenkinsFileExistsRule to also keep track of which files have been queried for existence.

* Changes:
- Removed java.io.File usage from cfManifestSubstituteVariables and using fileExists instead now.
- Adjusted tests.

* Wrapped file path inside ticks to allow spaces in file path when calling deleteFile.

* Removed null checks of mandatory parameters, and resorted to ConfigurationHelper.withMandatoryProperty

* Fixed a NullPointer due to weird Jenkins / Groovy behaviour.

* Changes:
- Turned yamlSubstituteVariables step into a utils class.
- Added tests
- Adjusted cfManifestSubstituteVariables to use utils class instead of step.
- Adjusted tests
- Adjusted APIs of DebugHelper.

* Re-introduced log statement that shows what variables are being replaced and with what.

* Changing API of YamlUtils to take the script and config as input.

* Test

* Test

* Test

* Test

* Test

* Fixing issue.

* Fixing issue.

* Changes:
- Refactored DebugHelper and YamlUtils to make usage nicer and rely on dependency injection.
- Removed Field for DebugHelper and turned it into local variable.
- Adjusted classes using the above.
- Adjusted tests where necessary.

* Added link to CF standards to YamlUtils also.

* Add docu for step cfManifestSubstituteVariables.md

* Added documentation.

* Added missing script parameter to documentation. Some steps document it, some don't. Right now you need it, so we document it.

* Fixed some layouting and typos

* Beautified exception listing.

* Removed trailing whitespaces to make code climate checks pass.

* Trying to get documentation generated, with all the exceptions to markup one should not use.

* cosmetics.

* cosmetics, part 2

* Code climate changes...

* Inlined deleteFile step.

* Added two more tests to properly check file deletion and output handling.

* Changes:
- adjusted API to take a list of variables files, as does 'cf push --vars-file'
- adjusted API to allow for an optional list of variable key-value-maps as does 'cf push --vars'
- reproduced conflict resolution and overriding behavior of variables files and vars lists
- adjusted tests and documentation

* Added missing paramter to doc comment.

* Re-checked docs for missing paramters or params that have no counterpart in the method signature.

* Adjusted documentation.

* Removed absolute path usage from documentation.

* corrected documentation.

* Changed javadoc comment to plain comment.

* Turned all comments to plain comments.
2019-09-06 10:20:35 +02:00
Marcus Holl
211827ac93
Remove template docu page for piperPipelinStagePost (#863)
There are at the moment no stage docu pages. I guess this has been added too early
by mistake. Maybe we should remove this for now since it triggers a warning during docu generation.
2019-08-30 09:03:08 +02:00
Christoph Szymanski
b3764f4c1b
Link the SAP Cloud SDK (#861)
SAP Cloud SDK implements a more comprehensive CAP pipeline.

Co-Authored-By: Florian Wilhelm <florian.wilhelm02@sap.com>
2019-08-23 13:33:38 +02:00
Hans Schulz
8cb5779f5d Fix imagePullPolicy always being IfNotPresent when executing single container (#834)
* Update dockerExecuteOnKubernetes.groovy

* Update dockerExecuteOnKubernetes.groovy
2019-08-21 15:04:20 +02:00
Marcus Holl
d2d4232883
Remove useless utils from signature inside neoDeploy (#853) 2019-08-21 13:10:54 +02:00
Marcus Holl
8c966e41c4
more precise param handover (gitUrl) in piperPipelineStageInit (#848)
Before: complete scmInfo was handed over via method signature.

After: Only the relevant part (GIT_URL from scmInfo) is handed over.

All the other properties from scmInfo are not used in the method body.
With this appraoch it is more obvious what is used inside the method.
2019-08-20 09:08:42 +02:00
Florian Geckeler
f69eac6f5f Pass configured env vars to docker execution in existing container (#851) 2019-08-16 17:05:18 +02:00
Oliver Nocon
fa3b6b68db
githubPublishRelease - add templating capabilities (#849)
add templating capabilities for the header in the release information
2019-08-15 15:26:08 +02:00
Oliver Nocon
023f35c0a8
dockerExecuteOnKubernetes - add stashBack configuration (#808)
* dockerExecuteOnKubernetes - add stashBack configuration

For certain cases it is valuable to only bring back some of the files from an execution inside a container back to the workspace.
This is now added.

Closes #753

* refactor according to PR review
2019-08-14 16:44:12 +02:00
Florian Wilhelm
3af8062c9f
Cleanup (#844) 2019-08-13 11:54:58 +02:00
Christopher Fenner
f3f4c741be
sonarExecuteScan: add custom certificate support (#819)
* feat(sonar): load TLS certificates

* allow verbose property

* handle whitespaces

* cleanup

* disable default verbosity on wget

* correct test file name

* add test case for custom certificates

* import StandardCharsets

* change cleanup

* correct pull-request provider name

* correct pull-request provider name

* correct pull-request provider name
2019-08-11 22:42:34 +02:00
Marcus Holl
f0a3dd9a39 Remove inappropriate package statement and inappr. shebang (#823) 2019-08-08 23:50:25 +02:00
Marcus Holl
62d1e23e6c
[fix] custom defaults passed as String instead of String is a List to DefaultValueCache (#817) 2019-08-08 08:52:21 +02:00
Marcus Holl
77a8c54084
Remove stdout from unit test (#787)
in the majority of the cases there is nobody for reading stdout.
2019-08-06 14:21:57 +02:00
Marcus Holl
0c90da6638
Simplify code: failExecution can be replaced by closure raising exception (#795) 2019-08-06 13:12:59 +02:00
Marcus Holl
e954e3b629 unified behaviour for shell call rule (#794)
* Ensure closure gets called when neither returnStdout nor returnStatus are set

In this case we do not have a return value, but in case we execute a closure we should execute the closure.
With that it is possible to raise an exception from the closure.

* [refactoring] unify usage of unify method call

* Remove dead code.
Coding after uncondition throw exception statement does not get executed.

* Ensure script rule behaves the same whan called with string and with map.
2019-08-02 17:05:49 +02:00
Sven Merk
edc396c0cb
Merge pull request #814 from SAP/nevskrem-patch-1
Fix docu script to avoid withMandatoryPropertyUponCondition being picked
2019-07-31 13:29:51 +02:00
Sven Merk
136ffa8204
Update createDocu.groovy 2019-07-31 12:51:55 +02:00
Oliver Feldmann
af5c16ef46
setupCommonPipelineEnvironment: support yaml config file ending (#811)
* Allow for yaml file ending

* Format code
2019-07-31 12:22:26 +02:00
Oliver Feldmann
073ce90fc9
Add cds test case (#810)
* Add cds test case

* Fix typo

Co-Authored-By: Christoph Szymanski <christoph.szymanski@sap.com>
2019-07-31 10:39:18 +02:00
Sven Merk
4f8c74f536
Merge pull request #812 from SAP/nevskrem-docs
Improve error verbosity for docu generation
2019-07-30 14:27:48 +02:00
Sven Merk
9358da7ccb Merge branch 'master' of https://github.com/SAP/jenkins-library into nevskrem-patch-1-local 2019-07-30 13:50:08 +02:00
Sven Merk
ca88e10a7b Ensure stacktrace being printed in case of errors 2019-07-30 13:41:58 +02:00
Christopher Fenner
7845e18f4d
fix NonCPS issues (#796)
* remove NonCPS statement

* remove NonCPS anntotation

* fix typo

* remove NonCPS anntotation

* remove NonCPS anntotation

* remove NonCPS anntotation

* remove NonCPS anntotation

* remove NonCPS anntotation

* remove Iterable

* remove mixins

* add mixins

* add mixins 2

* add mixins 3

* add NonCPS anntotation

* remove tokenize

* remove closure

* remove closure

* replace closure

* use Object

* use Object

* use Object

* remove object

* remove object

* add logic

* change type

* change type

* remove NonCPS anntotation

* remove NonCPS anntotation

* add import
2019-07-29 10:17:56 +02:00
Oliver Nocon
0c3e5f1ea9
use new unstable step to better visualize pipeline errors (#804)
With https://jenkins.io/blog/2019/07/05/jenkins-pipeline-stage-result-visualization-improvements/ it has been made possible to allow for a better visualization in case certain pipeline stages are 'UNSTABLE'

This is about using the new feature if available with a fall-back to old behavior.
2019-07-26 17:40:22 +02:00
Oliver Nocon
153dbf2a7f
githubPublishRelease - ensure proper JSON encoding (#807)
So far some special characters have not been properly encoded when creating a release.
This is addressed by using a new JsonUtils method now.
2019-07-26 14:03:20 +02:00
Oliver Nocon
e8821c2b90
Make library versioning more flexible (#806)
There is a possibility with maven to inject the version number into the build (see https://maven.apache.org/maven-ci-friendly.html).

This will allow us to publish regular releases without permanent PRs for version updates.
2019-07-25 15:27:49 +02:00
Oliver Feldmann
79bc304c09
add ui5 consumer test (#802) 2019-07-23 14:54:38 +02:00
Marcus Holl
3d94ce4770
Add tmpUpload to mkdocs index page (#801) 2019-07-22 12:08:11 +02:00
Sven Merk
bf869515c4
Merge pull request #776 from andre2007/whitesourceExecuteScan
whitesourceExecuteScan: Add scanType dub
2019-07-19 14:53:59 +02:00
Sven Merk
b1b480a7e1
Merge branch 'master' into whitesourceExecuteScan 2019-07-19 14:28:26 +02:00
tobiaslendle
cb245b1ce2 TMS integration (#782) 2019-07-18 15:06:11 +02:00
Florian Wilhelm
338314b08a
Use test project from new repo (#797) 2019-07-18 13:23:19 +02:00
Christopher Fenner
5bf7cda940
add new step piperPublishNotifications (#652)
* add new step for notification publication

* add test cases

* add helper method

* correct import

* Update pom.xml

* add step to post section

* add step piperPublishNotifications

* move step to end of pipeline to gather all findings

* use handlePipelineStepErrors step

* use commonPipelineEnvironment

* correct reporting

* add configuration

* fix typos

* fix rule setup

* remove test scope

* add method to fetch full build log

* add methods for warnings-ng parser creation

* remove warnings plugin coding

* add default parser settings

* change parameter handling for parser creation

* adapt step

* fix parser creation

* use ParserConfig.contains

* use correct parameter name

* correct parser regex

* change issue creation

* use classloader

* fix typo

* Revert "fix typo"

This reverts commit 446a201ae4.

* Revert "use classloader"

This reverts commit a896487032.

* rename step to piperPublishWarnings

* extract recordIssuesSettings to defaults

* make addWarningsNGParser non-static

* remove node

* adjust test case

* add docs

* rename log file

* fix tests

* fix typos

* rename parameter

* add import for IOUtils

* check plugin activation

* add comment for class loader usage
2019-07-18 12:09:54 +02:00
Marcus Holl
278cc17e33
Merge pull request #771 from marcusholl/pr/CommandLineMatcherHasSnippet
Add hasSnippet to CommandLineMatcher
2019-07-18 10:53:59 +02:00
Marcus Holl
e50aa9d37a Merge remote-tracking branch 'github/master' into HEAD 2019-07-18 10:21:25 +02:00
Marcus Holl
250368168c
Merge pull request #770 from marcusholl/pr/fileExistsRuleWithMap
fileExists also with map
2019-07-18 10:10:11 +02:00
Sven Merk
a5170bb878
Merge branch 'master' into whitesourceExecuteScan 2019-07-18 09:50:38 +02:00
Marcus Holl
2eeb5e05d4 Merge remote-tracking branch 'github/master' into HEAD 2019-07-18 09:44:59 +02:00
Oliver Nocon
be33eccbec
Take proper jnlp image as default for Kubernetes execution (#759)
* Take proper jnlp image as default for Kubernetes execution

Following changes are contained:

* removal of custom jnlp image as default
* allow customization of jnlp image via system environment

fixes #757

* add documentation
2019-07-17 12:01:24 +02:00
Sven Merk
7fbf7ffdf1
Merge branch 'master' into whitesourceExecuteScan 2019-07-17 10:56:47 +02:00
Sven Merk
1d5b08f057
Update default_pipeline_environment.yml 2019-07-17 09:25:30 +02:00
Oliver Nocon
31b9874eff
githubPublishRelease - properly handle situation where no release exists yet (#792)
correct error handling to properly take care of non-existing initial release.
2019-07-16 20:31:46 +02:00
Sven Merk
2d84095b2f
Update WhitesourceExecuteScanTest.groovy 2019-07-11 11:33:34 +02:00
Sven Merk
a945823075
Merge branch 'master' into whitesourceExecuteScan 2019-07-11 10:56:47 +02:00
Sven Merk
b0eb9a7a6c
Merge pull request #783 from SAP/nevskrem-patch-1
Change WhiteSource UA download URL to new official channel
2019-07-11 10:55:13 +02:00
Andre Pany
0e990446fc whitesourceExecuteScan: Add scanType dub 2019-07-11 06:17:30 +02:00
Sven Merk
353cfa6fca
Update WhitesourceExecuteScanTest.groovy 2019-07-10 15:32:01 +02:00
Sven Merk
faed64bca9
Merge branch 'master' into nevskrem-patch-1 2019-07-10 11:41:25 +02:00
Sven Merk
e3b5586a9c
Merge pull request #785 from SAP/nevskrem-patch-2
Fix consumer test invocation
2019-07-10 11:34:23 +02:00