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

176 Commits

Author SHA1 Message Date
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
Christopher Fenner
8455306a5e
docs: add code blocks to parameters table (#1460)
* add code blocks

* set parameters name in code block

* change test cases

* set parameters name in code block

* add step configuratio caption

* remove details caption

* add code block for docker settings

* add code block for stash content

* add code block for defaults

* add code block for sidecar image & name

* correct test cases

* add code block for docker

* correct test cases
2020-04-27 12:16:41 +02:00
Christopher Fenner
1660f4df48
docs: remove dangling whitespaces (#1459)
* omit <nil> in parameter table

* remove additional whitespaces

* add newline

* remove whitespaces

* adjust test cases

* fix whitespaces
2020-04-24 21:48:28 +02:00
Oliver Nocon
a728416e12
artifactPrepareVersion: define versioning scheme (#1457) 2020-04-24 20:52:16 +02:00
Christopher Fenner
96439972e2
docs: show possible values in step documentation (#1453)
* add possibleValues to model

* include possible values into docs
2020-04-24 14:13:02 +02:00
Christopher Fenner
2100632b54
docs: omit <nil> in parameter table (#1450)
* omit <nil> in parameter table

* adjust test case
2020-04-24 11:21:33 +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
Daniel Kurzynski
52822ded5e
Log command which is executed (#1300) 2020-04-22 11:06:00 +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
Christopher Fenner
57f5e436a6
fix: improve stepResults handling (#1425)
* set read permission on created files

* handle empty report lists

* remove test output

* remove duplicate asserts

* remove unnecessary asserts
2020-04-20 16:18:49 +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
Florian Wilhelm
b71ff0a055
Extend nexusUpload to also handle npm (#1379) 2020-04-11 12:56:44 +02:00
Christopher Fenner
b0144614e5
improve error message when parsing config (#1387)
* improve error message when parsing config

* adjust test case

Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-04-09 13:40:04 +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
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
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
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ß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
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
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
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
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
Christopher Fenner
dd67be3d21
docs(command): Clarify runExecutable Env usage (#1264)
* Clarify runExecutable Env usage

* remove trailing spaces
2020-03-12 09:00:51 +01:00
Florian Wilhelm
fdb9fd3c6e
Print "Status" in error case in http client (#1256)
This might provide useful context to the user.

For example when you try to upload a SNAPSHOT jar to a maven-release
repo in nexus, this will print an error like

returned with response 400 Repository version policy: RELEASE does
not allow version: 1.0-SNAPSHOT

instead of

returned with HTTP Code 400
2020-03-09 19:25:40 +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
Marcus Holl
d3820cb1f7
Have strategy for environment variable handling only once (#1234)
Have strategy for environment variable handling only once

And provide also a test checking if the environment variables
are present in the forked process.

The strategy applied for setting the environment variables is now
different from what it was before. Before the environment was
fully replaced by the new environment variables. Now we append
our environment variables to the list of environment variables available
by default for the forked process.



Co-authored-by: Florian Geckeler <43751896+fgeckeler@users.noreply.github.com>
2020-03-03 11:15:24 +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
d32e6402b0
Add GetTestModulesExcludes to pkg/maven (#1237) 2020-03-02 17:04:49 +01:00
Florian Geckeler
783d955654
Add mavenExecute to go lib 2020-02-28 13:09:46 +01:00
Florian Geckeler
9dc352029a
Add tag release when building go binary 2020-02-27 15:01:37 +01:00
Florian Geckeler
ef330e1eee
Move mock capabilities to pkg/mock/runner and adapt all tests 2020-02-27 12:11:22 +01:00
Marcus Holl
4835fbffab
Support nested folders when performing a http download into a file (#1206) 2020-02-25 16:52:12 +01:00
Marcus Holl
d1e5d9c2e7
Settings file handling (prepares mtaBuild step) (#1176)
download settings file via http or copy from the local file system into either $M2_HOME/conf/settings.xml or into ~/.m2/settings.xml

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-02-25 14:17:00 +01:00
Florian Wilhelm
c15f6a03d2
Add functions to infer build tool (#1210) 2020-02-23 16:54:50 +01:00
Florian Geckeler
48fa0a7521
Add 'Code generated by' header to stepGoTemplate 2020-02-21 12:56:09 +01:00
Marcus Holl
317716cf64
switch downloader from POST to GET (#1203) 2020-02-20 12:46:32 +01:00
Christopher Fenner
ea45136c3d
feat(go): add download file function (#1200)
* add download file function

* add test case

* Update pkg/piperutils/FileUtils.go

* correct test case

* remove FileUtils.Download

* add Downloader

* add Downloader

* fix error

* respect header and cookies

* add test case

* rename files

* correct test case

* remove SendRequest

* correct test case
2020-02-19 19:26:47 +01:00
Oliver Nocon
a5d4c64bf4
Correct step generator (#1190) 2020-02-18 08:31:54 +01:00
Oliver Nocon
ec4fb1b186
Update generator (#1188)
Provide better starting point for new steps
2020-02-17 13:30:30 +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
1417f4650a
Small cleanup (#1159) 2020-02-06 14:22:58 +01:00
redehnroV
a1232799e2
Docker functionality fix interface (#1156)
* Docker functionality fix interface
2020-02-06 11:14:11 +01:00
redehnroV
bb068ed76b
Provide docker functionality (#1155)
* Provide docker functionality to retrieve images


Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-02-06 10:47:45 +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
Christopher Fenner
768c6aa399
fix: generator for custom steps (#1139) 2020-01-31 15:39:45 +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
Sven Merk
4b1ca5697d
Add missing test (#1116)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-01-29 13:46:28 +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
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
Marcus Holl
c448a72930
Trim spaces from config value while reading CPE (#1103) 2020-01-23 12:02:34 +01:00
Sven Merk
71d0842c07
Update http_test.go 2020-01-22 15:26:35 +01:00
Sascha Vornheder
979ed1fabd added check that only POST and PUT is allowed for upload 2020-01-22 15:10:40 +01:00
Sascha Vornheder
1ae1be9cb9 improved Upload to handle http.Method 2020-01-22 14:22:04 +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
Sven Merk
acadf24d27 Add upload of files 2020-01-14 10:29:50 +01: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
3f3db13a8a
[fix] Don't forget to return the error instead of only creating an error (#1054) 2019-12-11 08:17:16 +01:00
Oliver Nocon
df1c61dcd7
Add http package (#1033)
* Add http package

This serves for http calls in future piper steps implemented ingolang
2019-12-09 17:35:31 +01:00
Marcus Holl
9ee2926018
xs deploy go (#931)
introduce xs deploy
2019-12-05 14:22:38 +01:00
redehnroV
0b3bfcbcd5 fixed docu generation layout (#1014) 2019-11-26 15:26:37 +01:00
Oliver Nocon
69bb2c9e60
Fix issues in config resolution (#1000)
* Respect defaults from step definition everywhere
* prevent empty config to overwrite default in aliasing

Address PR feedback
2019-11-22 10:30:44 +01:00
redehnroV
9559832a19
Merge branch 'master' into sv-docuGen 2019-11-22 07:49:40 +01:00
Oliver Nocon
e671094308
Use piper binary for githubPublishRelease (#990)
* Use piper binary for githubPublishRelease
2019-11-21 16:34:22 +01:00
Sven Merk
79e002cc5e
Merge branch 'master' into sv-docuGen 2019-11-21 16:13:50 +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
Sascha Vornheder
7558884f0b fixed wrong format 2019-11-21 11:18:56 +01:00
Sascha Vornheder
f79f5e64ad fixed codeclimate 2019-11-21 11:15:08 +01:00
Sascha Vornheder
957bd6ad4b fixed codeclimate 2019-11-21 11:12:30 +01:00
Sascha Vornheder
c61b3a6e6c removed unused code 2019-11-20 15:08:03 +01:00
Sascha Vornheder
39f6fd57c6 fixed issue with context defaults during docu generation 2019-11-20 14:36:07 +01:00
Sascha Vornheder
75b62547e3 fixed test 2019-11-20 11:29:13 +01:00
Sascha Vornheder
cdaa7dfd52 added dockerOptions to the docu generation 2019-11-20 10:50:23 +01:00
Sascha Vornheder
049dc95b1d Merge remote-tracking branch 'origin/master' into docuGen 2019-11-20 09:05:22 +01:00
Sascha Vornheder
001895a228 added dockerOptions to the docu generator 2019-11-20 09:05:10 +01:00
Sven Merk
ceac2b2b73
Merge branch 'master' into sv-VolumeBind 2019-11-19 15:20:28 +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
Sascha Vornheder
81b949685f added docker options to the step meta data 2019-11-19 11:52:34 +01:00
Sascha Vornheder
5ba375250d removed complexity added volumeMount 2019-11-18 11:14:45 +01:00
Sascha Vornheder
1da0f8d064 fixed order of mount path and name 2019-11-18 09:16:12 +01:00
Sascha Vornheder
4c747c05ca fixed findings 2019-11-18 08:15:08 +01:00
Sascha Vornheder
90449d6226 added volume bindings to the step meta data 2019-11-15 10:34:38 +01:00
Sascha Vornheder
737e0e9c5b added more tests 2019-11-14 15:09:12 +01:00
Sascha Vornheder
e763194779 added some tests, fixed CodeClimat findings 2019-11-14 13:59:31 +01:00
Sascha Vornheder
1a609e5418 fixed some codeclimate issues 2019-11-13 14:43:53 +01:00
Sascha Vornheder
c6f5dbf5ee refactored docuHelper and added general test 2019-11-13 14:34:04 +01:00
Sascha Vornheder
b5b4f60bc4 fixed helper test 2019-11-12 14:21:23 +01:00
Sascha Vornheder
85570095c5 Fix CodeClimate finding 2019-11-12 13:55:32 +01:00