Skip to content

BUILD-12160 Add config-nuget to resolve NuGet packages through Repox - #354

Merged
hedinasr merged 1 commit into
masterfrom
feat/hnasr/BUILD-12160-configNuget
Oct 1, 2026
Merged

hedinasr merged 1 commit into
masterfrom
feat/hnasr/BUILD-12160-configNuget

Conversation

@hedinasr

@hedinasr hedinasr commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Part of BUILD-12160

Summary

New config-nuget action, so .NET repositories can resolve NuGet packages through the JFrog Edge with the same repox-url opt-in as the other config-* actions.

  • Reads the reader token like the other config-* actions: development/artifactory/token/... on vault.sonar.build by default, development/artifactory-edge-dev/token/... on vault.dev.sonar.build with an Edge repox-url.
  • Exports ARTIFACTORY_URL, ARTIFACTORY_USERNAME and ARTIFACTORY_ACCESS_TOKEN, plus ARTIFACTORY_USER and ARTIFACTORY_PASSWORD, which the NuGet configurations reference in packageSourceCredentials.
  • With a repox-url other than SaaS, rewrites every package source value starting with https://repox.jfrog.io/artifactory/ in nuget-config-files to repox-url. The committed files keep SaaS Repox for local builds, and trustedSigners service indexes are unchanged. It fails when a listed file is missing or has no Repox package source.
  • Bash only and no get-build-number, so it runs on Windows runners (Git Bash) and only needs id-token: write.
  • README: new config-nuget section.

Test plan

  • shellspec spec/config-nuget_spec.sh: 10 examples, 0 failures. pre-commit passes.
  • sonar-dotnet-enterprise#2653 pinned to a09a8a6 (same tree as the squashed 518cd4e) with repox-url: https://repox-internal.dev.sonar.build: on Windows warp runners the action rewrites analyzers/NuGet.Config, private/analyzers/NuGet.Config and private/its/projects/NuGet.config, and dotnet restore succeeds from the Edge (.NET UTs NetFx, .NET UTs Net). .NET ITs fails on a S9415 ruling difference after a successful restore, the same as on master (run).

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

BUILD-12160

Comment thread config-nuget/nuget_config.sh
Comment thread .shellspec
@hedinasr
hedinasr marked this pull request as ready for review October 1, 2026 12:51
@hedinasr
hedinasr requested a review from a team as a code owner October 1, 2026 12:51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test plan: the live check is still unchecked. Please tick it once sonar-dotnet-enterprise#2653 restores from the Edge on a Windows runner, with a link to the run, before this is merged.

Comment thread config-nuget/action.yml
Comment thread config-nuget/action.yml
Comment thread config-nuget/action.yml Outdated
Comment thread config-nuget/nuget_config.sh
Comment thread README.md Outdated
Comment thread README.md Outdated
Read the Repox reader token for repox-url, export it for the NuGet
package source credentials, and rewrite the SaaS Repox package sources
of the listed NuGet configuration files to repox-url. Files that already
resolve through repox-url are skipped, so the action can be called again.
@hedinasr
hedinasr force-pushed the feat/hnasr/BUILD-12160-configNuget branch from a09a8a6 to 518cd4e Compare October 1, 2026 14:29
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@hedinasr
hedinasr merged commit c3a85ac into master Oct 1, 2026
18 checks passed
@hedinasr
hedinasr deleted the feat/hnasr/BUILD-12160-configNuget branch October 1, 2026 14:34
@gitar-bot

gitar-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🟡 Medium risk · Adds Vault-backed NuGet credentials and rewrites package sources for configured builds

New config-nuget action enables .NET repositories to resolve NuGet packages through the JFrog Edge with the same repox-url opt-in as other config-* actions. Resolved issues with xargs trimming of config paths and coverage/analysis configuration.

✅ 2 closed
✅ Edge Case: xargs trimming mangles backslashes and quotes in config paths

📄 config-nuget/nuget_config.sh:54-58
config="$(echo "$config" | xargs)" trims whitespace but also runs xargs' quote and escape handling. On Windows runners, which this action explicitly supports, a listed path like its\NuGet.config turns into itsNuGet.config and the action fails with NuGet configuration file not found: itsNuGet.config. A path containing an apostrophe makes xargs exit with unmatched single quote, and set -e then aborts the script without the ::error:: annotation. I reproduced both locally. Trimming with parameter expansion avoids this.

✅ Quality: config-nuget added to kcov coverage but not to sonar.sources

📄 .shellspec:2
The PR adds config-nuget to the kcov --include-pattern in .shellspec, so coverage data is collected for nuget_config.sh. sonar-project.properties still lists sonar.sources without config-nuget, so SonarQube never analyzes the new script, and the coverage report for it goes unused. The coverage wiring is therefore only half done. Add config-nuget to sonar.sources.

Verification

Functional validation No results

Rules No rules evaluated

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

3 participants