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

68 Commits

Author SHA1 Message Date
Christian Volk
880be73a4c
feat(golangBuild): support private modules (#3471)
* feat(golangBuild): support private module repositories
2022-01-31 10:45:40 +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
Rinita Asani
278c47b808
Refactor of gctsExecuteABAPUnitTests (#3338)
* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.yaml

* Add commit parameter

* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Change the commit parameter in Yaml file

* Adding scope paramter to gCTSExecuteABAPUnitTest

* Adding logs

* Adapting checkstyle for success case

* write ATC file

* add log

* time duration

* add log

* Improve log

* Improve unit test

* severity error

* Fix the xml file for Unit Tests

* Editing UnitTest Results for better parsing

* Change file name

* Add folder

* Add path to file

* Add src

* Add src and object type

* Add filename

* Add path

* Handling success cases

* complete refactoring

* fix for file path

* filname lower case

* Add log entry

* Delete ATC Results

* Change ATC name

* Functiongroups

* When ATC errors Pipeline fails

* Reading a file into chuncks

* escape string

* Fix for a bug

* Unesscape URL

* Change from fatal error to error

* When unit test fails pipeline fails too

* Severity errors

* Severity for Unit Test

* Fix for successful unit test

* Code review

* Telemetry was missing

* yaml file

* generate yaml file

* add logs

* fix location

* do not close body

* checkstyle severity

* checkstyle

* checkstyle2

* atc method

* line calculation

* global file

* method

* line

* fix

* add logs

* add log

* add logg

* unit test error

* Code checked and finalized

* change commit paramter to optional

* Add logs for current local and remote commit

* Add logs for object type and name

* parse ATC checks error

* add log of http response

* add log

* remove end of function findline

* log cleaning

* log extra cleaning

* cleaning log for unit test

* more cleaning

* double cleanser for your code

* more cleaning

* docu checks

* file name fix for function group

* handle programs-reports

* fix a bug

* fix regex

* fix regex for test class

* fix regexos

* fix dots

* fix a error message in unit tests

* calculate dynamically file extension

* add log for path

* add method name

* add method name-

* fix repo scope

* include table type

* Change paramter commitId to commit only

* change log output

* give more detailed examples

* Table Name in get file name

* change logs

* improve log entries

* improve log entries again

* final improvements

* Delete UnitTestResults

* Review

* Change text and comments

* fix a type in commit paramter

* change repository method name

* Fix typos in yaml file

* Remove empty lines in yaml file

* Remove blank lines in the end

* Add new line

* go generate

* Remove tabs

Co-authored-by: Martin Bredy <58846699+martin-bredy@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-12-15 10:55:53 +01:00
Pavel Busko
79f7ccd0f5
feat(cnbBuild): increased platform api compatibility (#3330)
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Benjamin Haegenlaeuer <benjamin.haegenlaeuer@sap.com>
2021-12-07 14:06:35 +01:00
Oliver Nocon
24d8584c3f
chore: update Vault dependency (#3332) 2021-12-06 12:54:42 +01:00
Pavel Busko
6fc8a4be2d
updated go.mod dependencies (#3167)
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2021-10-13 10:39:45 +02:00
Pavel Busko
372cef04b4
feat(cnbBuild): added support for project.toml (#3163)
Co-authored-by: Sumit Kulhadia <sumit.kulhadia@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2021-10-11 11:10:21 +02:00
Siarhei Pazdniakou
46bafc40a3
Improve validation of configuration (#3125)
* Implemented validation for the option possibleValues

* Has been added the option mandatoryIf to config with validation

* Fixed issues found during code review

* improved golang template

* Fixed tests. Added validation for mandatoryIf option

* Fix typo

* Fixed tests

* Validation was refactored. Added options

* Added default value for parameters with possibleValues option

* Validation was moved after the configuration resolution

* Canceled some default values

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-10-01 12:49:05 +02:00
Pavel Busko
cba94dcb35
Cnb build custom buildpacks (#3090)
* [WIP] cnbBuild custom buildpacks draft

Co-authored-by: Pavel Busko <pavel.busko@sap.com>

* Store custom buildpacks in the dedicated tmp folder

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>

* added test

Co-authored-by: Pavel Busko <pavel.busko@sap.com>

* updated documentation

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>

* use Files for toml files cleanup

Co-authored-by: Pavel Busko <pavel.busko@sap.com>

* Add missing function to the FileUtils interface

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>

Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
2021-09-14 16:14:50 +02:00
Siarhei Pazdniakou
d8d533b154
ADO - Vault Secret Rotation (#3084)
* Implemented vault secret rotation for ADO

* Added tests

* Fixed issues
2021-09-08 16:48:12 +02:00
Siarhei Pazdniakou
54f2a0d471
Added go-based influxWriteData step (#2890)
* Added go-based influxWriteData step

* Wrote tests & fixed issues

* Fixed issues

* Created go-based step tests. Fixed issues

* Fixed issues

* Integration test was added

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2021-06-30 11:18:49 +02:00
Christopher Fenner
367ca6211a
refactor(protecode): simplify protecode calls (#2838)
* simplify protecode calls

* add todos

* reomve todo

* restore go.sum

* Update cmd/protecodeExecuteScan.go

Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>

* Apply suggestions from code review

* remove productID

Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2021-06-15 22:29:24 +02:00
Oliver Nocon
bcb76eff06
fix(windows build): fix golang.org/x/sys (#2887)
* chore: release binaries for darwin and win

* fix(windows build): fix golang.org/x/sys

This is necessary doe to a dependency of github.com/hashicorp/vault to docker@v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatible\pkg\system\filesys_windows.go

This creates a build error.
Further information can be found here:
https://github.com/golang/go/issues/34610

* Update .github/workflows/upload-go-master.yml

* update go.sum
2021-06-10 16:50:17 +02:00
Christopher Fenner
824cd7d768
fix(jenkins): fix job invocation (#2868)
* update mock

* update signarture

* add test case

* use latest gojenkins

* add integration test

* update mock

* add todo

* add job wrapper

* add job mock

* add test cases

* refactor

* cleanup

* update integration test case
2021-06-02 16:45:22 +02:00
Oliver Nocon
d8a8a73184
feat(commonPipelineEnvironment): add artifact coordinates (#2867)
* add coordinates to CPE

* revert go.mod changes
2021-06-02 15:41:05 +02:00
Christopher Fenner
40c32598a4
feat(jenkins): update jenkins go dependency (#2848)
* update dependency

* use context

* regenerate mock

* decapitalize error messages

* use getBuildFromQueueID

* add comments about mockery

* update mocks

* update tests

* add context parameter

* pull up context

* update mocks

* update tests
2021-05-28 11:12:42 +02:00
Siarhei Pazdniakou
0673d3fed6
Writing secrets to vault (#2770)
Co-authored-by: Kevin Stiehl <kevin.stiehl@numericas.de>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-05-06 10:27:23 +02:00
Kevin Stiehl
f2b0683880
add token revocation (#2686)
* add token revocation

* update mocks

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-03-10 08:36:50 +01:00
Christopher Fenner
cb3fa7c293
feat(sonar): add output of measurements (#2218)
* add sonarqube measurements

* fetch measurements from API

* add api for fetching issue counts

* add debug outputs

* add further severities

* log number of issues

* report failure

* expose method to send request

* Fixed what was broken.

* add debug output

* wip

* correct opaque property

* push client handling to apiClient.go

* use correct API URL

* correct log outputs

* remove logging

* remove option validation

* extend search options

* restructure

* rename api client file

* simplify client usage

* simplify issue client

* write sonar values to influx

* extract issue service

* reorder imports

* add sonar integration test

* allow unknown fields

* add test case

* add test case

* remove

* fix

* Update http.go

* Apply suggestions from code review

* Update cmd/sonarExecuteScan.go

* rework test cases

* use explicit returns

* add task service

* add waitfortask

* fix typo

* remove fixme

* expose poll interval

* rename test cases

* add test cases

* use newAPIClient method

* use waitForTask

* rename services

* finalize code

* handle error

* move defer

* move types

* add test case

* use http.status...

* add test case

* expose api endpoint names

* extract api client

* adjust test cases

* Update integration-tests-pr.yaml

* Update integration-tests.yaml

* improve require message

* Update integration-tests-pr.yaml

* Update integration-tests-pr.yaml
2021-02-24 15:44:23 +01:00
Christopher Fenner
9ec282fd0c
test: allow usage of httpmock in tests (#2576)
* add test case

* add flag for default transport

* Update go.mod

* Update go.sum

* fix spaces

* fix format

* Update http_test.go

* Update http_test.go

* Update http_test.go

* Update http_test.go

* Update http_test.go
2021-02-04 14:58:35 +01:00
Sven Merk
205d59c1ed
Remove obsolete parameter (#2515)
* Remove obsolete parameter

* Update pkg/fortify/fortify_test.go

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

* Update fortify_test.go

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-01-15 13:55:13 +01:00
Florian Wilhelm
7dc2c86758
Revert "Update Go dependencies (#2441)" (#2449)
This reverts commit e03f2ba98c.

There is a regression in the go lib which was updated in this commit
2020-12-04 16:10:47 +01:00
Florian Wilhelm
e03f2ba98c
Update Go dependencies (#2441)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-12-04 11:09:11 +01:00
Christopher Fenner
8d682abc83
add package for Jenkins interactions (#2296) 2020-11-02 17:11:18 +01:00
Christopher Fenner
86af3efcfe
fix(influx): adjust influx field types for fortify (#2219)
* adjust influx field types

* fix test case

* simplify type conversion
2020-10-22 11:40:42 +02:00
Florian Wilhelm
f34d515a88
Automated go dependency update (#2115)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-05 10:14:50 +02:00
Oliver Nocon
5856e35d50
Add step to set GitHub status (#2012)
* add step for GitHub branch protection check

* add command to piper command

* remove unnecessary parameter

* Update resources/metadata/githubbranchprotection.yaml

* Add step to set GitHub status

* add groovy part

* update generation & go mod tidy

* update groovy tests

* update github api to fix bug

* add comment

* go mod tidy

* update naming

* update docs

* update docs

* Update resources/metadata/githubstatus.yaml

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

* Update resources/metadata/githubstatus.yaml

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

* Update resources/metadata/githubstatus.yaml

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

* update generated files

* update GitHub step order

* Update interface usage

* do not export interfaces

* go mod tidy

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-09-14 18:08:24 +02:00
Oliver Nocon
eef3bcde60
Add step for GitHub branch protection check (2) (#2016)
* add step for GitHub branch protection check

* add command to piper command

* remove unnecessary parameter

* Update resources/metadata/githubbranchprotection.yaml

* add groovy part

* update generation & go mod tidy

* update groovy tests

* fix bug with go-github version

* Add step to check GitHub branch protection settings

* include PR review feedabck

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-09-14 12:05:12 +02:00
Oliver Nocon
d68e466c28
Revert "Add step for GitHub branch protection check (#2010)" (#2014)
This reverts commit f1cfca2e76.
2020-09-11 18:56:51 +02:00
Oliver Nocon
f1cfca2e76
Add step for GitHub branch protection check (#2010)
* add step for GitHub branch protection check

* add command to piper command

* remove unnecessary parameter

* Update resources/metadata/githubbranchprotection.yaml

* add groovy part

* update generation & go mod tidy

* update groovy tests

* fix bug with go-github version

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
2020-09-11 15:28:43 +02:00
Florian Wilhelm
ed1da5e048
Automated go dependency update (#1979)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-04 13:42:34 +02:00
Oliver Nocon
69b145e83f
artifactPrepareVersion: improve error categorization (#1889)
* artifactPrepareVersion: improve error categorization
* go mod tidy
2020-08-06 11:13:19 +02:00
Florian Wilhelm
869aa116e1
Automated go dependency update (#1877)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-03 12:51:32 +02:00
Marcus Holl
e41e43611b
cloud foundry deploy go (#1743)
Provide cloudFoundryDeploy step in GO layer.

Groovy part untouched. Groovy-Stub needs to be provided later (with a feature toggle in order to be able to switch back)

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-07-31 12:38:00 +02:00
Kevin Stiehl
644f18b491
feat(vault): Added package to get secrets from vault (#1763)
* Added Vault package

* added support for logical path lookups instead of api paths

* added integration tests

* add integration tests and mock tests

* Replace mock with mockery generated one

	* update tests to use mockery
        * create mocks sub package
2020-07-08 08:20:15 +02:00
Florian Wilhelm
f8a9abf88c
Automated go dependency update (#1756)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-07-03 13:35:09 +02:00
Jordan Levin
34967c502c
Whitesource scan (MVP) (#1658)
* Whitesource MVP for Gradle, Golang, and NPM/Yarn

* Refactoring

* Refactor and cleanup, better error checking

* publish stepResults, use pkg/versioning, bubble up errors, add gomod versioning support

* Run gofmt and cleanup comments

* Resolve PR comments

* Update resources/metadata/whitesource.yaml

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

* Only determine project coordinates if they are missing

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

* Gradle versioning artifact

* fix gradle artifact version regexp and refactor

* Fix token extraction from output buffer

* Fix some issues with pip and jsonfile versioning logic

* Remove useless spacing

* Remove unnecessary test file and fix naming style for JSONDescriptor

* Automatically download wss-unified-agent if file does not exist

* adds downloadVulnerabilityReport, checkSecurityViolations, minor refactoring

* adds config.ReportDirectoryName, improves readability

* Version-wide reporting for vulnerabilities and list of libraries.

* Refactor and improve build accuracy

* fix sed command

* Add includes file pattern config option

* Adds --exclude command line flag

* run go mod tidy and regenerate step framework

* Fix unit tests

* revert changes

* poll project status before downloading reports

* merge with master

* go mod tidy, go fmt, and fix whitesource unit test

* sync go.mod

* sync go.mod again

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-07-01 07:54:13 +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
Daniel Kurzynski
7c0c5242e3
Revert go mod change (#1696) 2020-06-22 10:04:25 +02:00
Oliver Nocon
d8444d51f2
Add possibility to add category to failures (#1692)
* Add possibility to add category to failures

It is now possible to set the error category within the flow.
When exiting the program the error category can be used.

There is  a convenience function available for exiting with a previously set category,
for example

```
log.SetErrorCategory(log.ErrorCompliance)
...
log.FatalError(err, "configuration error")
```

* extend test

* go mod tidy

* add missing comment

* update information about error categories

* Update DEVELOPMENT.md
2020-06-22 08:21:38 +02:00
Daniel Kurzynski
be01dd3869
Add schema patch step in go (#1683)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-06-18 14:50:46 +02:00
Florian Wilhelm
285537f6a4
Automated go dependency update (#1630)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-06-04 13:52:19 +02:00
Oliver Nocon
6053cae6c5
Cleanup go.mod (#1603)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-05-28 11:04:28 +02:00
Sven Merk
af2a01c064
Fortify implementation in golang (#1428) 2020-05-25 19:48:59 +02:00
Florian Wilhelm
bd1e0a1071
Fix npm registry config (#1564) 2020-05-20 13:41:23 +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
Chris Bo
fb4cfd84ec
Introducing new step: "gctsCreateRepository" (#1424)
With the step gctsCreateRepository it is possible to create a local gCTS repository on an ABAP server

Co-authored-by: Marcus Holl <marcus.holl@sap.com>
2020-04-24 15:31:41 +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
Florian Wilhelm
c9cc2e1d30
Automated go dependency update (#1423)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-04-21 09:16:08 +02:00
Oliver Nocon
b9781ce50c
artifactPrepareVersioning: support more buildTools (#1367)
* artifactPrepareVersioning: support more buildTools
2020-04-15 13:12:43 +02:00