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

31 Commits

Author SHA1 Message Date
Oliver Nocon
cd2fb914fa
feat: allow linting failures (#4355)
Co-authored-by: Anil Keshav <anil.keshav@sap.com>
2024-01-25 11:44:24 +01:00
Jordi van Liempt
0ba4c2206c
chore(deps): Replace io/ioutil package (#4494)
* update all deprecated ioutil usages

* forgotten changes

* add missing imports

* undo changing comment

* add missing 'os' import

* fix integration test

---------

Co-authored-by: I557621 <jordi.van.liempt@sap.com>
Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
2023-08-16 12:57:04 +02:00
Jordi van Liempt
d01c161822
fix(golangBuild): BOM creation failed with private Go modules (#4460)
* quickly try to only specify base private repo URLs with git config

* fix the test

* refactoring of private modules

* test

* fix test

* fix url

* typo

* Adding gitConfiguration

* typo

* unit test

* unit test

---------

Co-authored-by: I557621 <jordi.van.liempt@sap.com>
Co-authored-by: aibaend1 <106729492+aibaend1@users.noreply.github.com>
Co-authored-by: asadu <aibyn_sadu@epam.com>
2023-08-14 10:03:43 +02:00
aibaend1
a247dc2694
adding verbose log of cyclonedx (#4492)
* adding log of cyclonedx

* fix test

* fix integration test

* fix assertion of test

---------

Co-authored-by: asadu <aibyn_sadu@epam.com>
2023-08-02 13:47:06 +06:00
Ashly Mathew
9a0b84a953
Pin version of golang BOM to 1.4.0 (#4462) 2023-07-12 17:49:11 +02:00
Jk1484
7f2e58b211
fix(golangBuild): pinversion of cyclonedx (#4368)
* output version pin for cyclonedx

* test fix

---------

Co-authored-by: Vyacheslav Starostin <32613074+vstarostin@users.noreply.github.com>
2023-05-30 16:06:34 +06:00
Jk1484
ffc931aad1
feat(golangBuild): use 'unit' build tag to include tests during test execution (#4345)
* Added unit tag as argument. Added description to runTests command. Changed code generator to have unit build tag in generated unit test files.

* Added unit build tag to all unit test files.

* added to new unit test unit build tag

* Update verify-go.yml

* small fix

---------

Co-authored-by: Muhammadali Nazarov <Muhammadali.Nazarov@acronis.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2023-05-03 21:02:11 +05:00
Christopher Fenner
bee1ffe4f1
feat(golangBuild): create test report json file (#4306)
* feat(golangBuild): create test report json file

* Update golangBuild_test.go

* Update golangBuild_test.go

* Update integration_golang_test.go

* Update integration_golang_test.go

* Update golangBuild.go

* rename test files

* rename
2023-04-05 15:07:54 +02:00
Vyacheslav Starostin
6a9ade78ff
golangBuild: update the way of installing golangci-lint (#4145)
* Add the OS agnostic way of installing golangci-lint

* Fix

* Clean up

* Modify unit tests

* Rename downloaded archive

* Refactor

* Expose golangci-lint url as a parameter

* Clean up

* Rename parameter

* Update mock

* Fix golangci-lint version
2022-12-07 22:13:44 +06:00
Philipp Stehle
48e959b4a9
fix(golangBuild) pass testOptions to gotestsum (#4077)
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>

Co-authored-by: Pavel Busko <pavel.busko@sap.com>
2022-10-21 11:29:23 +02:00
R. Kloe
3cad6ac2cd
feat: allow uploading multiple boms (#3900)
* WIP: Adapt bom names

* + WIP: Adapt bom filenames

* Upgrade cyclonedx gradle plugin and use cyclonedxBom config parameters

* Fix unit tests - use correct name in bom creation

* Fix pythonBuild bom name

* introduce and use npmBomFilename const

* Introduce and use mvnBomFilename const

* Introduce and use gradleBomFilename const

* Use build-tool names for bom suffix

* + Adapt tests (build tool suffix)

* Use BOM schema version 1.2 in gradleExecuteBuild

* Pin version of cyclonedx-maven-plugin to 2.7.1

* Adapt generated files

* Fix integration tests

* Fix integration tests

* Fix gradle build integration tests

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-08-01 13:38:49 +02:00
Vyacheslav Starostin
79b07e625b
Add linting capability to step ``golangBuild`` (#3903)
* add golangci-lint functionality

* fix log typos

* fix golangci-lint install dir

* log golangci-lint output report

* specify golangci-lint version, as recommended

* log spelling consistency

* clean code

* refactor golangci-lint runner

* fail build if linter found issues

* fix bug where exit status can't be derived from nil error

* refactor runGolangciLint

* refactor retrieveGolangciLint

* uncomment golang tests

* Use FileWrite method from utils

* Add tests

* Fix test

* fix typo

* alter runLinter param name, improve docs

* undo commenting RunTests...

* alter runLinter name in generated and tests too

* fix variable name (thanks code climate)

* Add usage of ‘go install’ instead of ‘curl’

* Fix tests

* Add usage of functionality of http pkg

* Update tests

* Update tests

* Add usage of piperhttp pkg && update tests

* Add DownloadFile method

* Update tests

Co-authored-by: Jordi van Liempt <35920075+jliempt@users.noreply.github.com>
2022-07-27 11:22:35 +06:00
Oliver Nocon
53f4ce96ae
feat(cpe): provide go templating functions (#3872)
* feat(cpe): provide go templating functions

* change type

* fix: type in test

* chore: add comment for exported function

* fix: ensure that custom returns string properly

* fix types and add tests

Co-authored-by: Anil Keshav <anil.keshav@sap.com>
2022-07-14 16:20:11 +02:00
Eng Zer Jun
0f4e30e9db
test: use T.TempDir to create temporary test directory (#3721)
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-07-12 15:19:12 +02:00
Oliver Nocon
ce161590ae
fix(golangBuild): publish binary with default name (#3773)
* fix(golangBuild): publish binary with default name

* chore: merge changes with latest state

* fix & enhance tests
2022-06-30 09:57:48 +02:00
Gareth Evans
74b6b09609 fix(golangBuild) properly handle multi main package builds
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
2022-04-26 09:38:49 +02:00
Oliver Nocon
62b3a9a459
fix(versioning): properly consider go.mod (#3687)
* fix(versioning): properly consider go.mod

* fix test
2022-03-31 17:07:10 +02:00
Maximilian Braun
040a2c36ef
fix(golangBuild): order of arguments (#3645)
* fix: order of go build arguments

As per https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies 
The `go build [-o output] [build flags] [packages] ` -ldflags shall be put before packages.

The build may fail this way
```
running command: go build -trimpath -o foo-linux.amd64 ./cmd/main.go -ldflags '-linkmode=external'
named files must be .go files: -ldflags

```
2022-03-18 12:03:45 +01:00
Oliver Nocon
6247c5dddd
feat(buildsettings): golang and future tools (#3561)
Co-authored-by: Christian Volk <christian.volk@sap.com>
2022-02-21 09:16:48 +01:00
Christian Volk
65ab680f53
fix(golangBuild): remove system paths from the compiled executables (#3560) 2022-02-18 14:46:21 +01:00
Christian Volk
6a466b28fd
fix(golangBuild): cyclonedx-gomod import path (#3541)
* fix(golangBuild): cyclonedx-gomod import path

* fix tests
2022-02-14 12:07:25 +01:00
Christian Volk
c888e21e6c
chore(multiarch): helper to parse targetArchitectures (#3525)
* chore(docker): helper to parse targetArchitectures

* missing files
2022-02-10 16:46:00 +01:00
Siarhei Pazdniakou
4660f3a311
feat(golangBuild): add BOM creation (#3496)
* Added BOM creation

* Fix cyclonedx install

* undo config.yml changes

* metadata was updated

* Update golangBuild.go

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-02-08 09:23:33 +01:00
Christian Volk
56726d96f1
fix(golangBuild): expect status 201 instead of 200 (#3508) 2022-02-04 15:30:42 +01:00
Christian Volk
ed7323175d
feat(golangBuild): publish to subfolder (#3503)
* feat(golangBuild): publish to subfolder

* edge case handling

* fix
2022-02-04 15:22:57 +01:00
Christian Volk
a90cf78565
fix(golangBuild): use PUT instead of POST (#3504)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-02-04 14:46:52 +01:00
Oliver Nocon
42b9c2ce48
Revert "fix(golangBuild): keep track of the artifactversion in binary names (#3498)" (#3499)
This reverts commit ec783b0da6.
2022-02-03 11:23:34 +01:00
Christian Volk
ec783b0da6
fix(golangBuild): keep track of the artifactversion in binary names (#3498)
* fix(golangBuild): keep track of the artifactversion in binary names

* improve the naming scheme
2022-02-02 17:30:56 +01:00
Christian Volk
78dac5973b
feat(golangBuild): add support for publishing binaries (#3495) 2022-02-02 15:44:51 +01:00
Christian Volk
880be73a4c
feat(golangBuild): support private modules (#3471)
* feat(golangBuild): support private module repositories
2022-01-31 10:45:40 +01:00
Oliver Nocon
9a78fabc89
feat(golangBuild): add new step for building go (#3178)
* feat(golangBuild): add new step for building go

* chore(golangBuild): increase test coverage

* remove indirect dependencies

* cleanup go.sum

* chore: remove trailing spaces

* chore(golangBuild): cleanup params, add groovy wrapper

* fix: update docker options

* update docs

* update installation according to https://golang.org/doc/go-get-install-deprecation

* fix: update installation

* update groovy test exclusion

* Update vars/golangBuild.groovy

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

* update branch

* address PR feedback

* fix compilation error

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-12-06 16:17:59 +01:00