Skip to content

Commit

Permalink
Specify source channel for asset validation (#4183)
Browse files Browse the repository at this point in the history
* Specify asset source channel
* Remove tokens for GitHub and AzDO when using `darc get-asset` in the tagging stage. This eliminates need for a restricted variable group.
  • Loading branch information
garath authored Feb 9, 2024
1 parent 773d85e commit 460c15e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
3 changes: 0 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,11 @@ stages:
demands: ImageOverride -equals windows.vs2022.amd64
variables:
- group: Publish-Build-Assets
- group: DotNetBot-GitHub
steps:
- checkout: self
clean: true
- powershell: eng/create-baridtag.ps1
-azdoToken $(dn-bot-dotnet-build-rw-code-rw)
-barToken $(MaestroAccessToken)
-githubPAT $(BotAccount-dotnet-bot-repo-PAT)
displayName: Create BAR ID Tag
name: Create_BAR_ID_Tag
- template: eng\common\templates\post-build\post-build.yml
Expand Down
5 changes: 2 additions & 3 deletions eng/create-baridtag.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Param(
[Parameter(Mandatory=$true)][string] $azdoToken,
[Parameter(Mandatory=$true)][string] $barToken,
[Parameter(Mandatory=$true)][string] $githubPAT
[string] $sourceChannelName = '.NET Eng - Validation'
)

set-strictmode -version 2.0
Expand All @@ -12,7 +11,7 @@ $darc = & "$PSScriptRoot\validation\get-darc.ps1"

$arcadeSdkPackageName = 'Microsoft.DotNet.Arcade.Sdk'
$arcadeSdkVersion = $GlobalJson.'msbuild-sdks'.$arcadeSdkPackageName
$assetData = & $darc get-asset --name $arcadeSdkPackageName --version $arcadeSdkVersion --github-pat $githubPAT --azdev-pat $azdoToken --password $bartoken --output-format json | convertFrom-Json
$assetData = & $darc get-asset --name $arcadeSdkPackageName --version $arcadeSdkVersion --channel "$sourceChannelName" --password $bartoken --output-format json | convertFrom-Json

# Get the BAR Build ID for the version of Arcade we are validating
$barBuildId = $assetData.build.id
Expand Down
5 changes: 3 additions & 2 deletions eng/validation/build-arcadewithrepo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Param(
[string] $buildParameters = '',
[switch] $pushBranchToGithub,
[string] $azdoRepoName,
[string] $subscribedBranchName
[string] $subscribedBranchName,
[string] $sourceChannelName = '.NET Eng - Validation'
)

set-strictmode -version 2.0
Expand Down Expand Up @@ -198,7 +199,7 @@ if($null -ne $branchExists)
Git-Command $global:githubRepoName checkout -b $global:targetBranch $sha

## Get the BAR Build ID for the version of Arcade we want to use in update-dependecies
$asset = & $darc get-asset --name $global:arcadeSdkPackageName --version $global:arcadeSdkVersion --github-pat $global:githubPAT --azdev-pat $global:azdoToken --password $global:bartoken
$asset = & $darc get-asset --name $global:arcadeSdkPackageName --version $global:arcadeSdkVersion --channel "$sourceChannelName" --github-pat $global:githubPAT --azdev-pat $global:azdoToken --password $global:bartoken
$barBuildIdString = $asset | Select-String -Pattern 'BAR Build Id:'
$barBuildId = ([regex]"\d+").Match($barBuildIdString).Value

Expand Down
3 changes: 2 additions & 1 deletion eng/validation/test-publishing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $ErrorActionPreference = 'Stop'
$darc = & "$PSScriptRoot\get-darc.ps1"

$global:buildId = $buildId
$global:sourceChannel = ".NET Eng - Validation"
$global:targetChannel = "General Testing"
$global:azdoToken = $azdoToken
$global:azdoUser = $azdoUser
Expand Down Expand Up @@ -45,7 +46,7 @@ $global:arcadeSdkPackageName = 'Microsoft.DotNet.Arcade.Sdk'
$global:arcadeSdkVersion = $GlobalJson.'msbuild-sdks'.$global:arcadeSdkPackageName
$global:azdoRepoName = "dotnet-arcade"
$global:azdoRepoUri = "https://unused:$azdoToken@${global:azdoOrg}.visualstudio.com/${global:azdoProject}/_git/${global:azdoRepoName}"
$jsonAsset = & $darc get-asset --name $global:arcadeSdkPackageName --version $global:arcadeSdkVersion --github-pat $global:githubPAT --azdev-pat $global:azdoToken --password $global:bartoken --output-format json | convertFrom-Json
$jsonAsset = & $darc get-asset --name $global:arcadeSdkPackageName --version $global:arcadeSdkVersion --channel "$sourceChannel" --github-pat $global:githubPAT --azdev-pat $global:azdoToken --password $global:bartoken --output-format json | convertFrom-Json
$sha = $jsonAsset.build.commit
$global:targetBranch = "val/arcade-" + $global:arcadeSdkVersion

Expand Down

0 comments on commit 460c15e

Please sign in to comment.