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

feat(sonar): respect existing SONAR_SCANNER_OPTS definition #5230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

inf2381
Copy link
Member

@inf2381 inf2381 commented Jan 10, 2025

Description

Currently, it is not possible to set the environment variable SONAR_SCANNER_OPTS outside of piper when running sonarExecuteScan because it will be overwritten by the keystore config. This PR adds the functionality to append the keystore config to the existing scanner opts if they are present.

Checklist

  • Tests
  • Documentation
  • Inner source library needs updating

@inf2381 inf2381 requested a review from CCFenner as a code owner January 10, 2025 14:08
Copy link
Member

@CCFenner CCFenner left a comment

Choose a reason for hiding this comment

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

👍 thanks for the fix

@CCFenner CCFenner changed the title Don't overwrite SONAR_SCANNER_OPTS feat(sonar): respect existing SONAR_SCANNER_OPTS definition Jan 16, 2025
@CCFenner
Copy link
Member

CCFenner commented Jan 16, 2025

Please have a look at the failing tests:

--- FAIL: TestSonarLoadCertificates (0.00s)
    --- FAIL: TestSonarLoadCertificates/use_local_trust_store (0.00s)
        sonarExecuteScan_test.go:464: 
            	Error Trace:	/home/runner/work/jenkins-library/jenkins-library/cmd/sonarExecuteScan_test.go:464
            	Error:      	[]string{"SONAR_SCANNER_OPTS=-Xmx42m -Djavax.net.ssl.trustStore=/home/runner/work/jenkins-library/jenkins-library/cmd/.certificates/cacerts -Djavax.net.ssl.trustStorePassword=changeit"} does not contain "SONAR_SCANNER_OPTS=-Djavax.net.ssl.trustStore=/home/runner/work/jenkins-library/jenkins-library/cmd/.certificates/cacerts -Djavax.net.ssl.trustStorePassword=changeit"
            	Test:       	TestSonarLoadCertificates/use_local_trust_store
    --- FAIL: TestSonarLoadCertificates/use_local_trust_store_with_downloaded_certificates (0.00s)
        sonarExecuteScan_test.go:483: 
            	Error Trace:	/home/runner/work/jenkins-library/jenkins-library/cmd/sonarExecuteScan_test.go:483
            	Error:      	[]string{"SONAR_SCANNER_OPTS=-Xmx42m -Djavax.net.ssl.trustStore=/home/runner/work/jenkins-library/jenkins-library/cmd/.certificates/cacerts -Djavax.net.ssl.trustStorePassword=changeit"} does not contain "SONAR_SCANNER_OPTS=-Djavax.net.ssl.trustStore=/home/runner/work/jenkins-library/jenkins-library/cmd/.certificates/cacerts -Djavax.net.ssl.trustStorePassword=changeit"
            	Test:       	TestSonarLoadCertificates/use_local_trust_store_with_downloaded_certificates

@CCFenner CCFenner assigned CCFenner and unassigned CCFenner Jan 16, 2025
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