Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/setup-bc-container-repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ runs:
tenant-id: ${{ inputs.azure-tenant-id }}
allow-no-subscriptions: true

- name: Resolve BC version for artifact cache
if: inputs.skip-container != 'true'
id: bcversion
shell: pwsh
run: |
Import-Module ./scripts/BCBenchUtils.psm1 -Force -DisableNameChecking
$version = Get-BCBenchEntryVersion -InstanceId "${{ inputs.instance-id }}" -Category "${{ inputs.category }}"
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

- name: Cache BC sandbox artifacts
if: inputs.skip-container != 'true'
uses: actions/cache@v5
with:
path: C:\bcartifacts.cache
key: bcartifacts-${{ steps.bcversion.outputs.version }}

- name: Setup BC container and repository for ${{ inputs.instance-id }}
id: setup
env:
Expand Down
48 changes: 47 additions & 1 deletion scripts/BCBenchUtils.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,52 @@ function Get-BCBenchDatasetPath {
return Join-Path $projectRoot "dataset" $DatasetName
}

<#
.SYNOPSIS
Resolves the BC sandbox version (environment_setup_version) for a dataset entry.
.DESCRIPTION
Centralizes the category -> dataset -> version lookup used by container setup, symbol download,
and the CI artifact cache key. Resolves the dataset file via Get-BCBenchDatasetPath.
.PARAMETER InstanceId
The dataset instance_id to resolve.
.PARAMETER Category
The dataset category, used to locate the dataset file.
.PARAMETER DatasetPath
Optional override for the dataset (.jsonl) path. Defaults to the category-specific path via Get-BCBenchDatasetPath.
.OUTPUTS
The environment_setup_version string, e.g. "26.5".
.EXAMPLE
Get-BCBenchEntryVersion -InstanceId "bug-fix__job-budget-report-1" -Category "bug-fix"
#>
function Get-BCBenchEntryVersion {
[CmdletBinding()]
[OutputType([string])]
param(
[Parameter(Mandatory = $true)]
[string] $InstanceId,

[Parameter(Mandatory = $true)]
[string] $Category,

[Parameter(Mandatory = $false)]
[string] $DatasetPath = (Get-BCBenchDatasetPath -Category $Category)
)

if (-not (Test-Path $DatasetPath)) {
throw "Dataset file not found at: $DatasetPath"
}

foreach ($line in Get-Content -Path $DatasetPath) {
if ([string]::IsNullOrWhiteSpace($line)) { continue }
$entry = $line | ConvertFrom-Json
if ($entry.instance_id -eq $InstanceId) {
return $entry.environment_setup_version
}
}

throw "Entry '$InstanceId' not found in $DatasetPath"
}

<#
.SYNOPSIS
Returns the latest BCApps release branch name (e.g. "releases/28.5").
Expand Down Expand Up @@ -543,4 +589,4 @@ function Get-LatestReleaseBranch {
return $latest.Name
}

Export-ModuleMember -Function Get-BCCredential, Invoke-GitCloneWithRetry, Get-EnvironmentVariable, Write-Log, Invoke-GitApplyPatch, Update-AppProjectVersion, Get-BCBenchDatasetPath, Get-RepoCloneInfo, Get-LatestReleaseBranch
Export-ModuleMember -Function Get-BCCredential, Invoke-GitCloneWithRetry, Get-EnvironmentVariable, Write-Log, Invoke-GitApplyPatch, Update-AppProjectVersion, Get-BCBenchDatasetPath, Get-BCBenchEntryVersion, Get-RepoCloneInfo, Get-LatestReleaseBranch
11 changes: 3 additions & 8 deletions scripts/Download-BCSymbols.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using module .\DatasetEntry.psm1
using module .\BCBenchUtils.psm1

<#
Expand All @@ -11,9 +10,9 @@ using module .\BCBenchUtils.psm1
.PARAMETER InstanceId
The dataset instance_id to resolve the BC version for.
.PARAMETER Category
The dataset category (`bug-fix` or `test-generation`) to resolve the dataset path for (if DatasetPath is not explicitly provided).
The dataset category used to resolve the dataset path (via Get-BCBenchDatasetPath).
.PARAMETER DatasetPath
Path to the dataset (.jsonl). Defaults to the category-specific dataset path in the repo, for example dataset/bug-fix.jsonl or dataset/test-generation.jsonl.
Optional override for the dataset (.jsonl) path. Defaults to the category-specific path via Get-BCBenchDatasetPath.
.PARAMETER Country
BC artifact country (default: w1).
.EXAMPLE
Expand All @@ -35,11 +34,7 @@ param(

$ErrorActionPreference = 'Stop'

[DatasetEntry[]] $entries = Get-DatasetEntries -DatasetPath $DatasetPath -InstanceId $InstanceId
if (-not $entries -or $entries.Count -eq 0) {
throw "Entry '$InstanceId' not found in $DatasetPath"
}
[string] $version = $entries[0].environment_setup_version
[string] $version = Get-BCBenchEntryVersion -InstanceId $InstanceId -Category $Category -DatasetPath $DatasetPath
Write-Log "Resolved BC version $version for InstanceId $InstanceId" -Level Info

Import-Module BcContainerHelper -Force -DisableNameChecking
Expand Down
Loading