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

319 Commits

Author SHA1 Message Date
Fabian Reh
d8d4f83fb4
Unit test enhancement (#2471)
* Fixes parallelization in generated code

* Fixes test_code_generated.golden

* generate go code

Signed-off-by: Fabian Reh <fabian.reh@sap.com>

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-12-22 09:30:54 +01:00
Marcus Holl
cdb784aaf4
fiori cts upload (#2390)
fiori cts upload


Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
2020-12-21 09:05:49 +01:00
Marcus Holl
a84692ea97
Remove strange 'Hello', most likly troubleshoot leftover (#2475)
in case this is really important it should be logged and not
emitted to stdout.
2020-12-18 11:15:15 +01:00
Marcus Holl
f9fc642c0e
http client: tell us which resource was not found (#2410)
Up to now we get a message 'Requested resource could not be found' which is not very
helpul during troubleshooting based on the log. With this change we tell the reader
which resource could not be resolved.
2020-12-16 08:55:22 +01:00
Oliver Feldmann
4f6b99cead
Don't allow empty strings as default container parameters (#2406)
First a bug fix is addressed in which the pull policy could not be configured to false by configuring the general configuration. It could neither be configured via dockerExecute or dockerExecuteOnKubernetes, even though this parameter is docker specific. Only by configuring the specific step where one wants to set the pull policy to false can it be configured.

As the bug stems from zero values being in the context config map, which is also addressed with this PR. That is the second part: Context config parameters are only set if they have a value.

* Don't set pull image if not configured

Otherwise, if the pull policy is not set explicitly for a step, dockerPullImage is set to true. Thus, before this change, it cannot be set in the general, or in dockerExecute or in dockerExecuteOnKubernetes configuration.

* Fix unit tests

* Add pullImage parameter test

* Do not place empty default values in context config

* Use putIfNotEmpty for sidecar container options

* Export common configuration

Keys that are set by both main and sidecar container can be exported

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-12-10 11:28:39 +01:00
Daniel Mieg
a3ff90f632
Fix: Change URL creation for abapEnvironmentCloneGitRepo (#2452)
* Fix url creation

* Adapt url creation
2020-12-08 09:31:08 +01:00
tiloKo
080cb025a4
AAKaaS upload in chunks (#2422)
* Upload in Chunks

* fix unit tests for file upload in chunks

* upload in chunks review round 1

* Upload in Chunks - review round 2 - comments

Co-authored-by: Daniel Mieg <56156797+DanielMieg@users.noreply.github.com>
2020-11-26 13:45:51 +01:00
Stephan Aßmus
2f444be997
WhiteSource: Force update of project when "checkPolicies" failed (#2401)
* Force update of WS project
* Refactor file filtering to avoid duplicated code
2020-11-26 11:45:53 +01:00
Sven Merk
2511ec9cea
fix backslash mess (#2428) 2020-11-26 11:22:54 +01:00
Christopher Fenner
860b28884c
chore(jenkins): expose artifacts save method (#2426)
* fix code smell

* expose artifact.Save function

* regenerate mock file
2020-11-26 10:06:14 +01:00
Sven Merk
26af83b1fc
Add slash backslash compatibility (#2425)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-26 09:18:01 +01:00
Kevin Stiehl
e2335b7181
(documentation) fix documentation render bug (#2423)
* fix documentation render bug

* fix tests

* fix complexity
2020-11-26 07:51:43 +01:00
Saschl
ee27cbba05
Removed hardcoded pom.xml and added test (#2393)
Test verifies that correct pom.xml is used as provided in the parameters

Also removed the --file pom.xml in the tests as maven should take pom.xml as default
2020-11-25 17:03:11 +01:00
Sven Merk
5d1782aa01
checkmarxExecuteScan: adapt to 9.2 api (#2363)
* Update checkmarxExecuteScan.go

* api mods

* Switch default

* Fix decode

* mod marshalling

* Fix unmarshalling

* Code fmt and small fix

* Optimize preset handling

* Integer handling

* Fix test

* cleanup

* go fmt

* Improve test
2020-11-25 13:47:26 +01:00
Marcus Holl
f3f221ee80
generator helper: support for map[string]interface{} (#2232)
Up to now the code generator is not able to handle the type
map[string]interface{} which is important for nested
configurations.

With that change we support such nested configuration.

Fo now parameters with a map type are not supported via
command line parameters. Those parameters are simply
ommitted. But with this change is it possible to read
such nested structures from the pipeline configuration
(.pipeline/config.yml).

As a next step we can discuss if we would like to support
such values also via command line parameters. One possible
approach could be

```
./piper <command> -myParam key1=val1 --myParam key2=val2
```

which gets finally collected inside our map:

```
map["key1"] = "val1"
map["key2"] = "val2"
```

This is of course hard to do for deeper nestings. In that case
providing a pointer to a file might be more suitable.

In that context we need to consider how to
  - declare the default values for map like parameters in our
    metadata files.
  - deal with the different types we have for the parameter
    itself wrt the yaml like config on the one hand and on the
    level of the command line parameters on the other hand. Maybe for
    that we have to extend the metadata format (e.g. describe an
    alternate type receiving the values from the command line, like
    []string. With that approach values for simple nested (... not deep
    nested) params can be provided like described above, it would be
    possible to represent these parameters for the command line parser
    as string slice entries like "[]string{key1=val1, key2=val2". These
    parameters needs in this case transformed "by us" into the map we
    use further down the road.

In case we agree in principle on an approach as outlined here we should
adjust the golden files reflecting this use case.
2020-11-23 07:55:20 +01:00
lndrschlz
b9bab27833
feat: expose complete step metadata through generated function (#2329)
* exposing step metadata through generator

* add metadata_generated.go

* fix step go test generation

* metadata fields added to generated files

* added generated files

* removed image placeholder from fortify step

* refactored step meta generation

* go generate

* fixed metadata generator and tests

* added output resource fields/tags to metadata generator

* fix string in metadata_generated

* go generate

* fixed generator

* go generate

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-20 08:13:59 +01:00
Kevin Stiehl
dfab156427
Feature/approle secret id rotation (#2311)
* add new step vault secret

* add debug log

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-17 13:49:31 +01:00
Christopher Fenner
81c8553d6a
refactor(hadolint): implement step in GO (#1169)
* initial commit of yaml file

* initial commit for HaDoLint in GO

* add helper function to load file from url

* load config file

* write report information to disk

* comment the code

* refactor groovy code

* remove download function from FileUtils

* use http.Downloader

* rename step files

* update generated files

* update generated files

* remove duplicate commands

* add credentials for config url

* add generated test file

* reuse piperExecuteBin functions

* correct step name

* update go step

* deactivate test

* fix import

* use differing go step name

* rename step

* correct result publishing

* correct command name

* expose tls insecure flag

* hand through error

* disable tls verification

* fix tls disabling

* use credentials

* mow

* reformat

* add qgate only if set

* correct report name

* remove old defaults

* add qgate to defaults

* handle report name

* restore default

* remove unused step config

* use piperExecuteBin

* remove obsolete type

* add test cases

* remove groovy tests

* move client parameter handling to run function

* use custom interfaces and mockery

* remove commented code

* correct struct names

* rename parameter dockerfile

* add further asserts

* cleanup

* change file permission to read/write

* remove tokenize

* add further comments

* init http client only if necessary

* add todo

* Revert "rename parameter dockerfile"

This reverts commit 2a570685b8.

* add alias for dockerfile parameter

* correct test case

* Apply suggestions from code review

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

* add comment about mock assertions

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-11-16 15:14:54 +01:00
Kevin Stiehl
6c51b76fcf
(documentation) Vault Setup documentation (#2366)
* add vault documentation

* fix test

* fix typo

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-16 11:53:52 +01:00
Marcus Holl
56586cae1b
Remove assert.Error right before assert.EqualError (#2344)
Is there any benefit from having

```
assert.Error(./.)
assert.EqualError(./.)
```

?

assert.Error ensures that we have an error.
assert.EqualError ensures that we have an error and
moreover it checks for a specific error. Hence
assert.EqualError does all and more what assert.Error
does.

In case there is a benefit from that pattern this PR should not be merged.
In case there is not benefit from that pattern  we should abandong that pattern.
2020-11-11 14:14:55 +01:00
Sven Merk
3c7712f2ee
Retry capabilities for HTTP requests + enablement for Checkmarx step (#2346) 2020-11-11 13:35:53 +01:00
Oliver Nocon
a70933bbd4
fortifyExecuteScan: improve error categorization (#2295)
* fortifyExecuteScan: improve error categorization

* reset error category in success case
2020-11-11 13:04:45 +01:00
Daniel Kurzynski
9a18489cc4
Refactor maven utils and add tests for install artifacts (#2318)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-11-10 17:14:55 +01:00
Fabian Reh
12d61bc287
Marks tests as parallizable (#2343)
* Makes tests properly parallelized

* Makes tests properly parallelized
2020-11-10 15:22:03 +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
Christopher Fenner
e859ed3375
feat(http): expose tls insecure flag (#2324)
* expose tls insecure flag

* fix tls disabling

* move debug message

* add test case
2020-11-09 11:47:03 +01:00
Kevin Stiehl
9d461c6753
consider alias during secret resolving (#2327) 2020-11-06 17:54:01 +01:00
Oliver Nocon
bdf4e8da7d
versioning: gradle (#2319)
* versioning: add gradle

* complete initGetArtifact

* correct error message

* improve init handling
2020-11-06 09:20:08 +01:00
Kevin Hudemann
a04e53df2a
npmExecuteScripts: allow passing a list of build descriptors to execute scripts for (#2312)
This change extends the npmExecuteScripts step to support execution of
npm scripts for specific modules. Previously, it was not possible to
execute npm scripts only for specific modules. Now, if the parameter
buildDesriptorList is set the scripts defined by the runScripts
parameter will be executed for the modules defined by
buildDescriptorList. Note, in this case the buildDescriptorExcludeList
will be ignored.
2020-11-04 16:20:26 +01:00
Christopher Fenner
b7afe8bbf5
feat(http): support empty passwords (#2206)
* add test case

* allow zero-length passwords

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-03 19:36:52 +01:00
Fabian Reh
04599e97da
feat(Gitops): Gitops update deployment with helm (#2247)
* makes containerImage not mandatory

* Adds kubectl container

* Adds log statement to debug

* adds general to container image

* removes GENERAL again
Removes condition from Kubectl container

* removes workDir

* marks logs as debug

* adds workingdir again

* Adds author to commits

* Adds commit time now

* remove deprecated and reorder

* adds deprecated again to containerRegistryUrl
Adds GENERAL scope to containerImage

* updates generated file

* Renames containerImageNameTag

* adds else case

* adds debug log

* code cleanup

* adds debug log

* revert

* adds debug logs

* revert

* makes root path not hidden

* revert

* Read container properties

* Removes debug message

* Removes debug message

* Removes general scope again

* Fixes unit test

* Adds helm capabilities to the gitopsUpdateDeployment step

* Adds helm capabilities to gitopsUpdateDeployment step

* Removes condition from input field

* Adds test for invalid deploy tool

* Fixes typo

* Adds tests for git errors and file errors
Simplifies test setup

* Adds test for error on image name extraction

* fixes URL variable name

* adds workind directory to paths

* Refactors too long method

* Reverts refactoring method

* Adds repository name as parameter

* Adds glob method

* Test glob method

* Revert "Test glob method"

This reverts commit ac11b54c14.

* Revert "Adds glob method"

This reverts commit ddf47ddebe.

* Revert "Adds repository name as parameter"

This reverts commit 8fc471c909.

* Removes getWd

* Adds stash deployDescriptor

* removes = from paramters

* Revert "removes = from paramters"

This reverts commit 3ecb3665e2.

* Adds " around parameters

* adds logging of all files

* Updates helm to version 3.3.4

* Clean up debug logs

* Raise error if no branch name provided.
Defaulting should be handled by step configuration.

* clean code

* Updates fields and adds checks for required field for certain deploy tools

* Fixes default commit message

* Update long description

* Removes default parameter

* Update resources/metadata/gitopsUpdateDeployment.yaml

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

* Updates yaml file

* Add error category and removes too much wrapping

* Update generated file

* Checks all parameters before returning the error

* Introduces constant

* Renames constant

* Fixes unit tests

* unexpose constants

* Makes tests thread safe and resilient to failed deletion

* Remove methods that did not work properly with hash containers rather than tags.

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-03 18:29:46 +01:00
Daniel Mieg
aa9dd3b199
Add step abapEnvironmentCreateSystem (#2273)
* Create initial step

* Add parameters for system creation

* Creating a tmp manifest.yml

* Add descriptions

* regenerate

* Create tests

* fix codeclimate issue

* Test

* Test2

* Test3

* Replace os.getTempDir

* Change to fileUtils

* Remove FileUtil
2020-11-03 12:02:13 +01:00
Kevin Stiehl
67727147f8
switch to debug logging for some vault log messages (#2299) 2020-11-03 08:45:12 +01:00
Christopher Fenner
8d682abc83
add package for Jenkins interactions (#2296) 2020-11-02 17:11:18 +01:00
Daniel Mieg
7639175def
Add commit to clone and pull (#2258)
* commit ID for clone

* commit ID for clone

* Remove old default values

* Add commitID to Pull

* Print http response on debug level

* Fix tests

* Adapt tests

* Shorten sleep

* Fix clone tests

* Add ignore commit option

* Adapt tests

* Adapt docu

* Implement feedback

* fix codeclimate issue
2020-11-02 14:17:13 +01:00
Oliver Nocon
edd5ef7709
fix(descriptorUtils) improve error message (#2294) 2020-11-02 13:50:04 +01:00
Oliver Nocon
9725b2a9d7
fix(permissions) allow deletion of errors file (#2293) 2020-11-02 12:34:28 +01:00
Marcus Holl
073a2a8599
generator: Don't swallow output from go fmt (#2222)
* generator: Don't swallow output from go fmt

* fix formatting

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-02 10:31:00 +01:00
Kevin Stiehl
ea5e91672d
mask secret also when they are url encoded (#2289)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-11-02 10:08:34 +01:00
Oliver Nocon
26cfbf7357
fix(whitesourceExecuteScan) properly handle output resources (#2266)
* fix(whitesourceExecuteScan) properly handle output resources

* fix merge issues

* add required aliases

* update generation

* fix reading custom and container environment parameters from cpe

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-11-02 08:51:58 +01:00
Daniel Kurzynski
a2656a5f71
Install artifacts before whitesource scan (#2280) 2020-10-30 15:05:14 +01:00
Daniel Kurzynski
1015371efd
Pass settings file also to install-file (#2279) 2020-10-30 10:04:38 +01:00
Sven Merk
c204abb9cf
checkmarxExecuteScan: Relax timeout (#2265) 2020-10-29 18:03:22 +01:00
Stephan Aßmus
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
Daniel Kurzynski
6afb0ae507
Pass project settings to flatten command (#2269) 2020-10-29 16:33:58 +01:00
Stephan Aßmus
86f335811c
whitesourceExecuteScan-go: Implement parameters "timeout", "createProductFromPipeline" (#2246) 2020-10-29 09:21:01 +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
Fabian Reh
9c870b2514
Gitops update deployment fixes (#2234)
* makes containerImage not mandatory

* Adds kubectl container

* Adds log statement to debug

* adds general to container image

* removes GENERAL again
Removes condition from Kubectl container

* removes workDir

* marks logs as debug

* adds workingdir again

* Adds author to commits

* Adds commit time now

* remove deprecated and reorder

* adds deprecated again to containerRegistryUrl
Adds GENERAL scope to containerImage

* updates generated file

* Renames containerImageNameTag

* adds else case

* adds debug log

* code cleanup

* adds debug log

* revert

* adds debug logs

* revert

* makes root path not hidden

* revert

* Read container properties

* Removes debug message

* Removes debug message

* Removes general scope again

* Fixes unit test

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-10-27 13:45:34 +01:00
Sven Merk
9d737575aa
fortifyExecuteScan: Fix report download (#2244)
* Fix report download

* Update fortifyExecuteScan.go

* Update fortifyExecuteScan_test.go

* Update fortify.go

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-10-27 13:12:31 +01:00
Kevin Stiehl
24aafb0b69
add vaultSecretFileReferences (#2203)
* add vaultSecretFileReferences

* fix test

* fix test

* go generate

* remove code duplication

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-10-26 14:20:04 +01:00