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

23 Commits

Author SHA1 Message Date
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
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
Christopher Fenner
f3a4342261
feat(influx): handle data types of non-string fields (#2132)
* add type to sonar field

* respect type of influx fields

* update generated code

* switch type

* copy changes from #1885

* log JSON data

* read simple values from json

* Update InfluxData.groovy

* Revert "Update InfluxData.groovy"

This reverts commit c8cfdf381f.

* Revert "read simple values from json"

This reverts commit 94b69866d2.

* Revert "copy changes from #1885"

This reverts commit 2471b4475e.

* update TODO
2020-10-13 16:37:48 +02:00
Christopher Fenner
7a14331337
feat(sonar): use SonarSource sonar-scanner-cli Docker image (#2166)
* feat(sonar): update to sonar-scanner-cli v4.5

* regenerate files
2020-10-13 14:30:57 +02:00
Kevin Stiehl
3eae0c5f68
feat(vault): fetch secrets from vault (#2032)
* cloud-foundry & sonar from vault

* add vault development hint

* don't abort on vault errors

* cloudfoundry make credentialsId only mandatory when vault is not configured

* add vault ref to step ymls

* rename vaultAddress to vaultServerUrl

* rename PIPER_vaultRole* to PIPER_vaultAppRole*

* add resourceRef for detect step

* fix error when no namespace is set

* added debug logs

* added debug logs

* fix vault resolving

* add vaultCustomBasePath

* rename vault_test.go to client_test.go

* refactored vault logging

* refactored config param lookup for vault

* added tüddelchen

* rename vaultCustomBasePath to vaultPath

* fix tests

* change lookup path for group secrets

* fix interpolation tests

* added vault resource ref to versioning

* execute go generate

* rename Approle to AppRole

* change verbose back to false

Co-authored-by: Leander Schulz <leander.schulz01@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-10-13 14:14:47 +02:00
Christopher Fenner
be90876b7c
feat(output): handle non-string output values (#2113)
* handle non-string values as JSON

* change value type to interface in resources

* regenerate code

* add test cases

* handle reading of json files

* write json data to json files

* fix assignment

* use GetResourceParameter

* add test case

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-10-05 15:33:28 +02:00
Christopher Fenner
5eb4c9de29
refactor(sonar): align serverUrl with other steps (#2090)
Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
2020-10-01 11:45:14 +02:00
Oliver Nocon
19c1732826
Telemetry: report error category (#2085) 2020-09-29 13:49:40 +02:00
Kevin Stiehl
d589038206
Vault AppRole login (#1971)
* added interpolation package in config

* vault allow paths to hold config references

* allow referencing properties in vaultPaths

* fix small typo

* add approleAuth

* register resolved secrets to logger

* generate steps

* clean up

* add integration test

* add vault to context filter

* reduce Cognitive Complexity & added tests

* Update pkg/config/stepmeta_test.go

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>

* go generate

* go generate after merge

* rename VaultAppRole* to VaultRole*

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-09-16 14:50:09 +02:00
Stephan Aßmus
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
Christopher Fenner
e4113242aa
fix(sonar): correct type for custom TLS certificates (#1847)
* correct type

* correct certificate handling

* adapt test cases

* Update resources/metadata/sonar.yaml

* update
2020-07-27 15:01:30 +02:00
Oliver Nocon
bb8cd30c4c
Extend resource references to cater for secrets (#1718)
* Add secret references to step metadata

* Update references

* update generated files
2020-06-25 16:33:38 +02:00
andre2007
f0babcade1
feat(sonar): upgrade sonar-scanner-cli to 4.4.0.2170 (#1710)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-25 13:53:22 +02:00
Oliver Nocon
eafe383d54
Add error category parsing to cmd execution (#1703)
* Add error category parsing to cmd execution

It is now possible to define `ErrorCategoryMapping` as a `map[string][]string` on a `Command`.
The format contains the category as key which has a list of error patterns assigned.
Example:

```
cmd := Command{
  ErrorCategoryMapping: map[string][]string
    "build": {"build failed"},
    "compliance": {"vulnerabilities found", "outdated components found"},
    "test": {"some tests failed"},
  },
}
```

Setting this map triggers console log parsing when executing a command.
If a match is found the error category is stored and
it will automatically be added to the `errorDetails.json`.

* clean up go.mod

* fix test

* fix test

* Update DEVELOPMENT.md

* fix tests

* address long console content without line breaks

* scan condition update

* fix test

* add missing comment for exported function

* Update pkg/command/command.go

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

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-06-24 10:04:05 +02:00
Christopher Fenner
c42553593e
fix: remove unused variables from generated step coding (#1698)
* remove unused parameters from generated code

* update steps

* update steps

* correct golden files

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-23 18:05:21 +02:00
Sven Merk
af2a01c064
Fortify implementation in golang (#1428) 2020-05-25 19:48:59 +02:00
Oliver Nocon
7f7d0bce89
Piper steps: Issue SUCCESS message (#1478)
* Piper steps: Issue SUCCESS message

Log `SUCCESS` message in all steps by default if no error occured

* Update additional generated steps

* Update generated step
2020-05-18 21:52:54 +02:00
Christopher Fenner
27c6320474
feat(sonar): write flag for sonar execution to influx (#1534)
* write flag for sonar execution to influx

* add missing step metadata file

* first attempt to read influx from disk

* add missing import

* correct glob pattern

* use file path

* correct type names

* cleanup

* fix code climate issue

* fix typo

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

* add test case

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-14 13:46:40 +02:00
lndrschlz
39e30ff1b4
Added hook configuration; added sentry hook and tests (#1497)
* Added hook configuration; added sentry hook and tests
* steps generated by step framework
* added comments and renamed correlationID
* formatted comment on NewSentryHook method
* fix generator step tests
2020-05-05 08:36:24 +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
Daniel Kurzynski
ce4be51362
Mask secrets (#1382) 2020-04-16 14:37:45 +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
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