1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
Commit Graph

44 Commits

Author SHA1 Message Date
raman-susla-epam
bf57938520
fix(getConfig): add error handling for config JSON marshalling
Co-authored-by: Ashly Mathew <ashly.mathew@sap.com>
Co-authored-by: Jordi van Liempt <35920075+jliempt@users.noreply.github.com>
2022-09-01 11:33:28 +02:00
Oliver Nocon
f6a6448631
chore: fix linting issues (#3878)
* chore: fix linting issues

* add more fixes

* correct formatting

* Delete depl.yaml
2022-07-21 09:04:21 +02:00
Oliver Nocon
1151fc4de0
chore: export config functions (#3631)
* chore: export config functions

* add docs
2022-03-14 12:33:52 +01:00
Ralf Pannemans
e7db09db12
feat(cnbBuild): added dockerimage to the telemetry data (#3501)
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>
Co-authored-by: Sumit Kulhadia <sumit.kulhadia@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2022-02-16 13:28:51 +01:00
Johannes Dillmann
32acc9f91f
Collect buildTool in cnbBuild metrics (#3530) 2022-02-14 15:16:45 +01:00
Marc Bormeth
78c4a8fe93
Revert "feat: Add debug output to getConfig (#3341)" (#3396)
This reverts commit b760bf48e7.

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-01-11 10:47:03 +01:00
Siarhei Pazdniakou
cd243ee542
feat(gcs): allow upload to gcs from steps (#3034)
* Upload reports to Google Cloud Storage bucket

* Added tests. Made fixes

* Update step generation. GCS client was moved to GeneralConfig

* Code was refactored

* Fixed issues

* Fixed issues

* Code correction due to PR comments

* Improved gcs client and integration tests

* Integrated gcp config. Updated step metadata

* Fixed issues. Added tests

* Added cpe, vault, aliases resolving for reporting parameters

* Added tests

* Uncommented DeferExitHandler. Removed useless comments

* fixed cloning of config

* Added comments for exported functions. Removed unused mock

* minor fix

* Implemented setting of report name via paramRef

* some refactoring. Writing tests

* Update pkg/config/reporting.go

* Update cmd/sonarExecuteScan_generated.go

* Apply suggestions from code review

* Update pkg/config/reporting.go

* Update pkg/config/reporting.go

* fixed removing valut secret files

* Update pkg/config/reporting.go

* restore order

* restore order

* Apply suggestions from code review

* go generate

* fixed tests

* Update resources/metadata/sonarExecuteScan.yaml

* Update resources.go

* Fixed tests. Code was regenerated

* changed somewhere gcp to gcs. Fixed one test

* move gcsSubFolder to input parameters

* fixed removing valut secret files

* minor fix in integration tests

* fix integration tests

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2021-12-15 15:07:47 +01:00
Marc Bormeth
b760bf48e7
feat: Add debug output to getConfig (#3341)
* Fix Orchestrator detection

* Add unit tests

* Add debug output to getConfig

* Update getConfig.go

* fix whitespaces

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-12-08 10:16:54 +01:00
Christopher Fenner
d0762f5db9
fix: use correct metadata resolver (#3342)
* fix something

* add default metadata resolver

Co-authored-by: ffeldmann <f.feldmann@sap.com>
2021-12-07 15:54:59 +01:00
kingvvgo
b29a2f2264
Add Changes for value of docker image (#3303)
* Add Changes for value of docker image

* Get docker image value

* Fix

* Fix unit

* Add chnages for kaniko and mta builds

* Fix

* Test changes

* Test

* Move func ResolveMetadata to stepmeta.go

* Fix

* Change getConfig.go

* Fix getting docker value for mta, npm and kaniko

* Fix according to suggestions

* Add func to get only value of docker image

* Test empty value of docker image

* Fix for getDockerImageValue

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-12-01 07:46:18 +01:00
Oliver Nocon
be81da225e
feat(getConfig): allow file output (#3194)
allow to target the output of a `getConfig` call to a file
2021-10-21 14:00:51 +02:00
Oliver Nocon
481f0a1282
fix(getConfig): custom metadata (#3047)
* fix(getConfig): custom metadata

when re-using getConfig it is now possible to provide a custom metadata resolver

* clean up coding
2021-08-12 14:54:46 +02:00
Oliver Nocon
f308fbfc0d
feat(getConfig) allow reading stage configuration (#3026)
* feat(getConfig) allow reading stage configuration

* update test

* use fix version of Selenium Image for Karma tests
2021-08-04 10:09:02 +02:00
Oliver Nocon
805a8fd88f
feat(config): read config/defaults with authentication (#2975)
* feat(config):read config/defaults with authentication

This change allows to use defaults and config files from a protected GitHub repository.

The options `--customConfig` and `--defaultConfig` already allowed to provide a link to an uprotected file.

Now, by passing a value in the form `<hostname>:<token>` to parameter `gitHubTokens` (this parameter can be passed multiple times) a token can be provided for dedicated hosts.

This makes it possible to use a link like
`https://api.github.com/repos/SAP/jenkins-library/contents/resources/my-defaults.yml?ref=master`
as reference to a default file or similarly as reference to a configuration file.

* update generation to allow protected config/defaults

* fix CodeClimate issues

* update missing generations
2021-07-08 15:26:07 +02:00
Oliver Nocon
0b48bfcc73
feat: retrieve metadata by stepName - corrected (#2892)
* refactored getConfig to allow stepName param for metadata fetching

* extended step generator

* go generate

* Update cmd/getConfig.go

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

* Update cmd/getConfig.go

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

* Update cmd/getConfig.go

* update generated files

* update golden files to care for generator update

* update and add tests

* update generated files

* Update cmd/getConfig.go

* Update cmd/getConfig.go

* update/fix formatting

* feat: retrieve metadata by stepName - corrected

* update generation

* update condition logic for defaults

* update generation & tests

* support multiple conditions

* update generation

* Add generated

Co-authored-by: Leander Schulz <leander.schulz01@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
Co-authored-by: Sven Merk <s.merk@sap.com>
2021-06-16 08:43:30 +02:00
Oliver Nocon
4250ca8bed
Revert "feat(getConfig): retrieve metadata by stepName (#2736)" (#2891)
This reverts commit ae4a24c594.
2021-06-14 10:57:44 +02:00
lndrschlz
ae4a24c594
feat(getConfig): retrieve metadata by stepName (#2736)
* refactored getConfig to allow stepName param for metadata fetching

* extended step generator

* go generate

* Update cmd/getConfig.go

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

* Update cmd/getConfig.go

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

* Update cmd/getConfig.go

* update generated files

* update golden files to care for generator update

* update and add tests

* update generated files

* Update cmd/getConfig.go

* Update cmd/getConfig.go

* update/fix formatting

Co-authored-by: Leander Schulz <leander.schulz01@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: OliverNocon <oliver.nocon@sap.com>
2021-06-14 08:58:41 +02:00
Oliver Nocon
9b6a8cb3b6
feat(whitesource): create json report (#2699)
* feat(withesource): create json report

* proper constant value

* update generation
2021-03-19 11:10:08 +01:00
Oliver Nocon
d47a17c8fc
feat(whitesource): consolidated reporting and versioning alignment (#2571)
* update reporting and add todo comments

* enhance reporting, allow directory creation for reports

* properly pass reports

* update templating and increase verbosity of errors

* add todo

* add detail table

* update sorting

* add test and improve error message

* fix error message in test

* extend tests

* enhance tests

* enhance versioning behavior accoring to #1846

* create markdown overview report

* small fix

* fix small issue

* make sure that report directory exists

* align reporting directory with default directory from UA

* add missing comments

* add policy check incl. tests

* enhance logging and tests

* update versioning to allow custom version usage properly

* fix report paths and golang image

* update styling of md

* update test
2021-02-10 16:18:00 +01:00
Oliver Nocon
39089bed5d
kanikoExecute: improve user experience (#2141)
* kanikoExecute: improve user experience

* ensure proper tags

* update permissions

in case a container runs with a different user
we need to make sure that the orchestrator user
can work on the file

* update permissions

* ensure availablility of directories on Jenkins

* (fix) clean up tmp dir in test

* add resilience for incorrect step yaml

* incorporate PR feedback
2020-10-14 11:13:08 +02:00
Oliver Nocon
b18bcee533
artifactPrepareVersion: improve error categorization (#1936)
* artifactPrepareVersion: improve error categorization

* Update getConfig.go

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-08-19 20:20:00 +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
lndrschlz
db13b2f9ce
moved container context method to config package and expose for reuse (#1770) 2020-07-10 10:32:26 +02:00
Oliver Nocon
d5d510719d
piperExecuteBin - prevent non-speaking exit code 1 error (#1584)
* piperExecuteBin - prevent non-speaking exit code 1 error

Make sure that error during context resolution gets more context.

* properly provide golang errors

* improve error message, when no details are available

* Add error category

* Update getConfig.go
2020-05-26 07:58:03 +02:00
Oliver Nocon
a0ded365c5
Fix container condition handling (#1562)
* Add additional tests
* Update handling of containers
* Properly consider existing config at root level
* Fix parameter filtering
* Fix tests for adapted filter handling
2020-05-20 10:50:35 +02:00
Stephan Aßmus
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
Christopher Fenner
70c000338f
fix: read config.yaml and config.yml in getConfig command (#1400) 2020-04-14 18:10:56 +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
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
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
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
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
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
0abda0c67b
Remove redundancy: no duplicate stepName (#998)
* Remove redundancy: no duplicate stepName

Up to now: provided explicity via command line argument and also contained in the
step metadata (which are as a file also provided as command line argument).

Now it is retrieved from the metadata file.

* Step name is not a required parameter anymore

Since the step name is derived from the config file

* Adjust method signature in test
2019-11-22 10:14:21 +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
Marcus Holl
7c5a8a73bc
Helper for fileExists (#954)
Since we need it at several places (next use case will be step xsDeploy) we should
have a helper for that.
2019-11-07 08:17:42 +01:00
Oliver Nocon
ede322c8bb
Export general configuration - part 2 (#957)
* Export general configuration - part 2

First part in #956 missed to export the elements of the struct ...

* Add comment for exported struct

* Add function for opening config files
2019-11-06 16:22:50 +01:00
Oliver Nocon
bb230d3b9b
Export general configuration (#956)
Allow for package external access to general configuration.

Use-case: re-use individual steps
2019-11-06 14:07:41 +01:00
Sven Merk
6721c59a30
Merge branch 'master' into cfg-hierarchical-defaults 2019-11-06 12:13:15 +01:00
Marcus Holl
a456282d6a
fix: getting config should also work in case there is no project config (#951) 2019-11-06 10:28:15 +01:00
Sven Merk
c241066e21 Add capability for hierarchical defaults in golang 2019-11-04 16:29:39 +01:00
Oliver Nocon
e01b3327fd
Go configuration - add aliasing functionality (#925)
* Go configuration - add aliasing functionality

This assists in backward compatibility cases.
It is now possible to define per parameter aliases.
2019-10-29 10:58:24 +01:00
Oliver Nocon
1f34511407
Provide golang based Piper library (#915)
* Provide golang based Piper  library

This includes the main command
and a sub command for config resolution
2019-10-24 10:59:58 +02:00