BUILD-11521: Use conditional vault URL when repox-url contains dev.sonar.build#284
Conversation
…nar.build When repox-url contains dev.sonar.build, Artifactory credentials are fetched from vault.dev.sonar.build instead of the default vault.sonar.build. Sonar platform credentials (SonarQube, signing) and Develocity always come from the production vault regardless of repox-url. Changes: - Remove repox-artifactory-url input from all actions (superseded by repox-url) - config-gradle, config-maven: split vault into id:artifactory (conditional URL, reader creds) and id:secrets (always prod vault, Develocity token) - config-npm, config-pip: add conditional url: to the single vault step - build-maven, build-gradle, build-npm, build-yarn, build-poetry, promote: split vault into id:artifactory (conditional URL, deploy creds) and id:secrets (always prod vault, Sonar platform + sign keys) - config-gradle/resources/repoxAuth.init.gradle.kts: derive host dynamically from ARTIFACTORY_URL instead of hardcoding repox.jfrog.io Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41ac33d to
7aa39d5
Compare
|
Code Review ✅ Approved 1 resolved / 1 findingsImplements conditional vault URL selection for Artifactory credentials based on the repox-url, ensuring development builds use the correct vault environment. The issue regarding the new artifactory vault step potentially running with empty secrets has been resolved. ✅ 1 resolved✅ Edge Case: New 'artifactory' vault step may run with empty secrets
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
Pull request overview
This PR updates the composite actions to (1) remove the repox-artifactory-url input (standardizing on repox-url) and (2) conditionally use the dev Vault (vault.dev.sonar.build) for Artifactory credentials when repox-url targets dev.sonar.build, while keeping Sonar platform / signing / Develocity secrets sourced from the production Vault. It also fixes the Gradle init script so Bearer auth applies to any Repox host derived from ARTIFACTORY_URL.
Changes:
- Remove
repox-artifactory-urlacross actions; always constructARTIFACTORY_URLfromrepox-url. - Split Vault retrieval into separate “artifactory” (conditional Vault URL) vs “secrets” (prod Vault) steps where needed.
- Update
repoxAuth.init.gradle.ktsto derive the authenticated host fromARTIFACTORY_URLinstead of hardcodingrepox.jfrog.io.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| promote/action.yml | Removes repox-artifactory-url and fetches Artifactory promotion token from dev/prod Vault based on repox-url. |
| config-pip/action.yml | Removes repox-artifactory-url; Vault URL for Artifactory reader creds becomes conditional on repox-url. |
| config-npm/action.yml | Removes repox-artifactory-url; Vault URL for Artifactory reader creds becomes conditional on repox-url. |
| config-maven/action.yml | Removes repox-artifactory-url; splits Artifactory vs Develocity Vault reads; Artifactory Vault URL becomes conditional. |
| config-gradle/action.yml | Removes repox-artifactory-url; splits Artifactory vs Develocity Vault reads; Artifactory Vault URL becomes conditional. |
| config-gradle/resources/repoxAuth.init.gradle.kts | Derives the Repox host from ARTIFACTORY_URL so Bearer auth applies to any Repox instance. |
| build-yarn/action.yml | Removes repox-artifactory-url; adds conditional Artifactory Vault step separated from prod “secrets”. |
| build-poetry/action.yml | Removes repox-artifactory-url; adds conditional Artifactory Vault step separated from prod “secrets”. |
| build-npm/action.yml | Removes repox-artifactory-url; adds conditional Artifactory deploy-token Vault step separated from prod “secrets”. |
| build-maven/action.yml | Removes repox-artifactory-url; adds conditional Artifactory deploy-creds Vault step separated from prod “secrets”. |
| build-gradle/action.yml | Removes repox-artifactory-url; adds conditional Artifactory deploy-creds Vault step separated from prod “secrets”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - uses: SonarSource/vault-action-wrapper@0a3114fe1230b784c35b53b099f9ab1f1e538cc7 # 3.5.0 | ||
| if: inputs.deploy != 'false' | ||
| id: artifactory |
| val artifactoryUrl = System.getenv("ARTIFACTORY_URL") ?: "https://repox.jfrog.io/artifactory" | ||
| val host = java.net.URI(artifactoryUrl).host | ||
| val sonarsourceRepositoryUrl = |



Summary
repox-artifactory-urlinput from all actions (superseded byrepox-url)repox-urlcontainsdev.sonar.build, Artifactory credentials are retrieved fromvault.dev.sonar.build(dev vault) instead of the defaultvault.sonar.buildrepox-urlrepoxAuth.init.gradle.kts:hostwas hardcoded torepox.jfrog.io; now derived dynamically fromARTIFACTORY_URLso Bearer auth applies to any Repox instanceImplementation:
config-maven,config-gradle): vault call split intoid: artifactory(conditional URL, Artifactory reader creds) andid: secrets(always prod vault, Develocity token, skipped whenuse-develocity=false)config-npm,config-pip): conditionalurl:on the single vault step (no Develocity, only Artifactory reader creds)build-maven,build-gradle,build-npm,build-yarn,build-poetry) andpromote: vault call split into a dedicatedartifactorystep (conditional URL, Artifactory deploy creds) and the existingsecretsstep (always prod vault, Sonar platform + sign keys)config-gradle/resources/repoxAuth.init.gradle.kts:hostnow derived fromjava.net.URI(artifactoryUrl).hostFollows the same approach as #280 but conditional on
repox-url.Jira: https://sonarsource.atlassian.net/browse/BUILD-11521
Test plan
Test PRs using
repox-url: https://repox.dev.sonar.buildonruns-on: {group: sonar-dev, labels: sonar-xs}:build-mavenbuild-gradle+config-gradlebuild-npm+config-npm@sonar/scan403 — npm package absent from dev Repoxnpmvirtual repo (dev Repox content gap)build-maven+config-mavenbuild-poetrysonarsource-pypi-public-qa— repo missing or deployer lacks write permission on dev Repox (dev Repox content gap)build-yarn@sonar/scan403 — same as sonar-dummy-jsNote: The 3 remaining failures are all dev Repox content/permission gaps unrelated to this PR:
@sonar/scannpm package not proxied in dev Repoxnpmvirtual repo (affects js + yarn)sonarsource-pypi-public-qamissing or not writable on dev Repox (affects python-oss)