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

50 Commits

Author SHA1 Message Date
Philipp Stehle
17ed9468cb
replace depreacted strings.Title function (#3786) 2022-05-20 18:50:03 +02:00
Pavel Busko
1f750af16d
feat(cnbBuild): cache buildpacks during multi-image build (#3635)
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
2022-03-30 13:58:16 +02:00
Anil Keshav
e8fc08e43b
fix (untar) correct condition for gunzip file (#3679)
* debug if file is gzipped

* looking 3 byte value

* debug for gzip file

* reading decimal values instead of hexadecimal

* looking for byte values

* modifying return

* simplyfying conditions

* correcting err condition

* trying with hex

* using hex

Co-authored-by: anilkeshav27 <you@example.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-03-30 12:30:57 +02:00
Christian Volk
22f6aa156f
feat(docker): use crane for pulling docker images (#3652) 2022-03-23 10:02:00 +01:00
Sven Merk
c30e93bc6a
feat(detectExecuteScan): SARIF export and GH issue creation (#3637)
* Added SARIF and GH issue creation
2022-03-17 15:32:48 +01:00
Christian Volk
5821a311cc
chore(npmExecuteScripts): config@2 support (#3607) 2022-03-04 10:26:46 +01:00
Christian Volk
e49820f5e4
chore(npmExecuteScripts): unit tests (#3597) 2022-03-02 14:06:51 +01:00
Christian Volk
d428cfcbd1
feat(kanikoExecute): image digests (#3566)
* feat(init stage): artifact version

* feat(kaniko): expose image digests to cpe

* fix

* handle tmp folder creation differently

* fix

* fix

* fix tests

* set ignore-path to /
2022-02-23 11:41:26 +01:00
Christian Volk
b0e4599d4d
feat(malwareExecuteScan): refactoring and docker support (#3421)
* feat(malwareExecuteScan): add support for scanning docker images

* refactoring

* print out finding if available

* generate toolrecord for malware scan

* persist scan report

* docs

* fix

* fix

* rollback cmd/init_unix.go

* auhenticated pull

* fix

* fix: report shall be consistent with the api model

* gcs upload

* fix linter
2022-01-24 09:48:01 +01:00
Pavel Busko
1750b75cb8
feat(cnbBuild): preserve maven test results in the workspace (#3429)
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com>
2022-01-14 11:05:11 +01:00
Pavel Busko
547ef5b55d
feat(cnbBuild): remove docker config after parsing (#3417)
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>
2022-01-11 10:01:15 +01:00
Anil Keshav
b1b19dcace
feat (FileUtils) support for untar in fileutils (#3154)
* support for untar in fileutils

* handeling strip component level like tar cli

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Thorsten Duda <thorsten.duda@sap.com>
2021-10-20 14:10:39 +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
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
Anil Keshav
3c41788405
fix(mavenBuild) looses trust to existing java cacerts (#2977)
* using default java truststore

* default java keytore

* remove trust store

* working directory

* change dir java_home

* env variable

* trying to find jre home

* changing directory to jre home and java home

* trying java jre

* remving $

* trying to search the cacerts

* copying existing cacerts

* removing change directory

* searching for secrutiy folder only

* searching cacerts

* new path for cacert

* path to ca-cert

* new trust store

* changing cacert location

* only adding maven_opts env variable once

* log message

* ca cert path from user

* handelling interface modification

* enhance logs and code clean up

* code clean up

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-07-22 11:06:46 +02:00
Christopher Fenner
f78777f784
feat(npm): allow to publish artifact to registry (#2871)
* add new paraeters

* update generated sources

* run npm publish

* add repositoryUrl parameter

* handle registry credentials

* rename parameter

* handle base64encoding

* remove vault reference

* make username secret

* add publish method

* use publish method

* use dedicated registry

* use dry run

* fix

* prepend path

* fix workdir

* move code to npm package

* do changes

* update dependencies

* correct property init

* remomve dry-run

* regenerate

* add mock

* add logging

* add debug log

* dry-run

* remove try run

* remove append

* add debug outut

* change

* add debug output

* changes

* cleanup

* use different auth property

* add credential utils

* add debug log outputs

* remove auth handling & reuse writeFile

* rename

* fix debug output

* remove comments

* update comment

* rename function

* update docs

* update generated files

* handle npm ignore

* remove commented code

* add debug output
2021-07-15 14:46:04 +02:00
Sven Merk
ab9e154d10
Replace io.Copy (#2934)
* Replace io.Copy

* Test coverage

* Improve test

* Fix fmt

* Improve error handling in test

* Fix code

* Improve test error log

* Fix fmt

* Fix unix file handles

* Fix error message

* Resolve code climate issue
2021-06-23 14:41:52 +02:00
Roland Stengel
cd8515acce
Go Unit Tests fail due to windows/linux file separator mismatch (#2662)
* Go Unit Tests fail due to windows/linux
file separator mismatch. See issue 2660.

* review results

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-03-03 22:58:29 +01:00
Marcus Holl
c74b99d2c7
Helper for removing duplicates from a string slice (#2455) 2021-01-29 10:52:58 +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
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
Fabian Reh
586044192c
feat(Gitops): new step to update deployment (#2178)
* 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

* Adds piper step to update deployment configuration in external git repository.

https://github.wdf.sap.corp/ContinuousDelivery/piper-ita/issues/21

* Adds handling of branchName as an optional parameter

* Update resources/metadata/gitopsUpdateDeployment.yaml

Feedback about description

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

* Adapt to interface guide

* Refactors to GitopsExecRunner

* Refactors to GitopsExecRunner in test

* Removes unnecessary mocked methods

* Adds tests for git utils

* Adds new step to CommonStepsTest.groovy

* Updates description from yaml

* Restricts visibility of methods and interfaces
Adds comments where necessary

* Updates comments

* Fixes URL name

* updates description

* updates generated file

* Fixes compile issue in CommonStepsTest.groovy

* Updates long description

* Updates test to run green on all kind of OS

* Removes global variables from tests

* Default branch: master

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

* Typo in Hierarchy

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

* Refactors test to allow parallel execution

* Renames utility variable in gitopsUpdateDeployment.go

* Renames error variables in gitopsUpdateDeployment.go

* simplified parameters for kubectl

* Refactors util classes to use parameters rather than global variables

* makes username and password mandatory

* remove unnecessary mandatory flag

* remove new methods from mock that are not necessary

* replaces with EqualError

* replaces with NoError

* update generated file

* refactor tests

* refactor tests

* make tests parallel executable

* parallel execution of tests

* Refactors interfaces to stop exposing interfaces

* Feedback from PR

* Simplifies failing mocks

* Renames variables and interfaces

* Fixes error messages

* shorten variable names

* Renames unused parameters in tests

* Cleanup nil parameters

* Typo

* Wrap errors and remove unnecessary logs

* Remove containername and filePath from GENERAL scope

* correct generated file

* corrects expected error messages

Co-authored-by: OliverNocon <oliver.nocon@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2020-10-20 09:05:17 +02:00
Stephan Aßmus
54ea3ed51a
whitesourceExecuteScan: bypass UA for mta, maven, npm and yarn (#1879)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-09-29 12:44:31 +02:00
Christopher Fenner
6999380ee3
chore(go): simplify code using gofmt -s (#2065) 2020-09-24 08:58:53 +02:00
Christopher Fenner
b219fb6514
fix(typo): found by misspell (#2064)
* fix typos in step yamls

* fix typos in go files

* regenerate step code

* fix typos in md files

* fix typos in groovy files

* fix further typos
2020-09-24 07:41:06 +02:00
Stephan Aßmus
33e6e13787
Refactor whitesourceExecuteScan, fix polling, error handling (#2036) 2020-09-18 11:54:45 +02:00
Daniel Kurzynski
8ee0d358b9
Support maven params in detect scan (#1855)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2020-07-30 10:35:46 +02:00
Daniel Kurzynski
bcab73d332
Support m2path for mtaBuild (#1850)
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-07-28 17:06:17 +02:00
Stephan Aßmus
61fed83475
Improve self-consistency of file system mock (#1815) 2020-07-20 14:23:33 +02:00
Marcus Holl
8af0540de2
Introduce chmod in file utils (#1808) 2020-07-16 14:25:01 +02:00
Marcus Holl
49d4f6269a
Introduce stat command into Files utils and correspoding mock (#1721)
Introduce stat command into Files utils and correspoding mock
2020-07-15 10:31:36 +02:00
Marcus Holl
dcd9972516
No parallel test exec for file tests (#1675) 2020-06-16 14:50:11 +02:00
Stephan Aßmus
f855658e06
Enhance piperutils.Files and mock.FilesMock (#1664)
* Flesh out piperutils.Files and mock.FilesMock functionality
* Avoid a lot of code-duplication via embedding
2020-06-15 09:47:33 +02:00
Sven Merk
af2a01c064
Fortify implementation in golang (#1428) 2020-05-25 19:48:59 +02:00
Florian Wilhelm
7bbdaf783c
Dont dedup mvn flags (#1479) 2020-04-28 20:38:36 +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
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
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
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
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
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
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
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
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
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
Marcus Holl
9ee2926018
xs deploy go (#931)
introduce xs deploy
2019-12-05 14:22:38 +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