Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(golangBuild): BOM creation failed with private Go modules #4460

Merged
merged 16 commits into from
Aug 14, 2023

Conversation

jliempt
Copy link
Member

@jliempt jliempt commented Jul 11, 2023

CycloneDX uses a go list command which needs git to authenticate to the base URL of private modules.
Since git config's insteadOf uses a base URL, I think we can replace the git config commands that we do in this step for all individual private modules with just the base URLs.

Since GOPRIVATE can be in glob format, we can't use the privateModules parameter directly to determine the base URLs.

Changes

  • Tests
  • Documentation

Copy link
Member Author

@jliempt jliempt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realised it's maybe not a great idea to use the host URLs in git config instead of the specific repository URLs. Because it could potentially lead to confusion in other parts of the step when git is needed.

But if we do go ahead with the host URLs, maybe they can be parsed from the privateModules parameter instead of iterating over go.mod?

cmd/golangBuild.go Outdated Show resolved Hide resolved
cmd/golangBuild.go Outdated Show resolved Hide resolved
cmd/golangBuild.go Outdated Show resolved Hide resolved
cmd/golangBuild.go Outdated Show resolved Hide resolved
cmd/golangBuild.go Show resolved Hide resolved
@aibaend1
Copy link
Contributor

aibaend1 commented Aug 8, 2023

/it-go

cmd/golangBuild_test.go Outdated Show resolved Hide resolved
@aibaend1
Copy link
Contributor

/it-go

@jliempt jliempt marked this pull request as ready for review August 14, 2023 06:47
@jliempt jliempt requested a review from a team as a code owner August 14, 2023 06:47
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@aibaend1
Copy link
Contributor

/it-go

@jliempt jliempt enabled auto-merge (squash) August 14, 2023 07:56
@jliempt jliempt merged commit d01c161 into master Aug 14, 2023
@jliempt jliempt deleted the jliempt/fixGolangBOM branch August 14, 2023 08:03
maxatsap pushed a commit to maxatsap/jenkins-library that referenced this pull request Jul 23, 2024
* 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 <[email protected]>
Co-authored-by: aibaend1 <[email protected]>
Co-authored-by: asadu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants