Skip to content

Commit 2f79d58

Browse files
committed
Update update-dependencies pipeline to use new command
1 parent 37afe84 commit 2f79d58

File tree

4 files changed

+43
-126
lines changed

4 files changed

+43
-126
lines changed

eng/pipelines/jobs/update-tools.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@ jobs:
88
pool:
99
vmImage: $(defaultLinuxAmd64PoolImage)
1010
steps:
11-
- powershell: |
12-
Import-Module -force $(engPath)/DependencyManagement.psm1
13-
14-
$args=("9.0" + `
15-
" --tool ${{ tool }}" + `
16-
" --version-source-name ${{ tool }}" + `
17-
" --source-branch nightly" + `
18-
" --org dnceng" + `
19-
" --project $(System.TeamProject)" + `
20-
" --repo $(Build.Repository.Name)" + `
21-
" --target-branch $(Get-Branch)")
22-
23-
echo "##vso[task.setvariable variable=customArgsArray]$($args | ConvertTo-Json -Compress -AsArray)"
24-
displayName: Set up args
2511
- template: /eng/pipelines/steps/update-dependencies.yml
2612
parameters:
27-
customArgsArray: "$(customArgsArray)"
13+
args: >
14+
specific 9.0
15+
--tool ${{ tool }}
16+
--version-source-name ${{ tool }}
17+
--source-branch nightly
18+
--target-branch nightly
19+
--org dnceng
20+
--project $(System.TeamProject)
21+
--repo $(Build.Repository.Name)
Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
11
parameters:
2-
# The customArgsArray parameter is used to specify the configuration for multiple Dockerfile versions.
3-
# This allows for a single branch to be generated for different internal .NET build versions.
4-
customArgsArray: ""
5-
6-
useInternalBuild: false
2+
serviceConnection: ""
3+
args: ""
74

85
steps:
96
- script: docker build -t update-dependencies -f $(engPath)/update-dependencies/Dockerfile --pull .
10-
displayName: Build Update Dependencies Tool
7+
displayName: Build Update Dependencies image
118
- script: docker run --name update-dependencies -d -t --entrypoint /bin/sh -v /var/run/docker.sock:/var/run/docker.sock update-dependencies
12-
displayName: Create Update Dependencies container
13-
- powershell: |
14-
if ("${{ parameters.useInternalBuild }}" -eq "true") {
15-
$pat="$(dn-bot-devdiv-dnceng-rw-code-pat)"
16-
} else {
17-
$pat="$(BotAccount-dotnet-docker-bot-PAT)"
18-
}
9+
displayName: Start Update Dependencies container
1910

20-
$credArgs = "--user $(dotnetDockerBot.userName) --email $(dotnetDockerBot.email) --password $pat"
11+
- ${{ if ne(parameters.serviceConnection, '') }}:
12+
- template: /eng/common/templates/steps/run-pwsh-with-auth.yml@self
13+
parameters:
14+
displayName: Az login
15+
serviceConnection: ${{ parameters.serviceConnection }}
16+
command: |
17+
$azLogin = "az login --service-principal --tenant $env:tenantId --username $env:servicePrincipalId --federated-token $env:idToken";
18+
$loginCommand = "docker exec update-dependencies $azLogin";
19+
Write-Host "Executing $loginCommand";
20+
Invoke-Expression $loginCommand;
2121
22-
# Execute update-deps for each of the items in the customArgsArray, representing different Dockerfile versions
23-
# Ensure that the value is treated as an array by wrapping it in an array literal. This deals with the quirk of
24-
# how PowerShell treats a single item as a string instead of an array.
25-
$customArgsArray = @('${{ parameters.customArgsArray }}' | ConvertFrom-Json)
26-
foreach ($customArgs in $customArgsArray) {
27-
# If this is the last iteration, include the credentials to cause a PR to be generated.
28-
# For internal builds this will cause branch to be pushed to AzDO, but no PRs will be generated.
29-
if ($customArgs -eq $customArgsArray[-1]) {
30-
$customArgs += " $credArgs"
31-
}
22+
- powershell: |
23+
$args = "${{ parameters.args }}"
24+
$pat="$(BotAccount-dotnet-docker-bot-PAT)"
25+
$credArgs = "--user $(dotnetDockerBot.userName) --email $(dotnetDockerBot.email) --password $pat"
26+
$args += " $credArgs"
3227
33-
$command = "docker exec update-dependencies update-dependencies $customArgs"
34-
Invoke-Expression $command
35-
}
28+
$command = "docker exec update-dependencies update-dependencies $args"
29+
Invoke-Expression $command
3630
displayName: Run Update Dependencies
31+
3732
- script: docker rm -f update-dependencies
3833
displayName: Remove Update Dependencies container
3934
condition: always()
Lines changed: 7 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,12 @@
11
parameters:
2-
useInternalBuild: false
3-
4-
# Comma-delimited list of SDK versions to target (overrides the use of channel var to determine latest version)
5-
sdkVersions: ""
6-
7-
buildId: ""
2+
serviceConnection: ""
3+
channel: ""
4+
repo: "https://github.com/dotnet/dotnet"
5+
versionSourceName: ""
86

97
steps:
10-
- powershell: |
11-
if ("${{ parameters.sdkVersions }}" -ne "") {
12-
$args = @{
13-
SdkVersions = "${{ parameters.sdkVersions }}" -split ","
14-
}
15-
}
16-
elseif ("${{ parameters.useInternalBuild }}" -eq "false") {
17-
$args = @{
18-
Channel = "$(channel)"
19-
}
20-
}
21-
else {
22-
$args = @{
23-
BuildId = "${{ parameters.buildId }}"
24-
}
25-
}
26-
27-
if ("${{ parameters.useInternalBuild }}" -eq "true") {
28-
$args["UseInternalBuild"] = $true
29-
$args["InternalAccessToken"] = '$(System.AccessToken)'
30-
$args["AzdoVersionsRepoInfoAccessToken"] = "$(dn-bot-devdiv-dnceng-rw-code-pat)"
31-
}
32-
33-
$(engPath)/Get-DropVersions.ps1 @args
34-
displayName: Get Versions
35-
- powershell: |
36-
Import-Module -force $(engPath)/DependencyManagement.psm1
37-
38-
$versionInfos = '$(versionInfos)' | ConvertFrom-Json
39-
40-
$index=0
41-
foreach ($versionInfo in $versionInfos) {
42-
$args = @{
43-
ProductVersion = $versionInfo.DockerfileVersion
44-
RuntimeVersion = $versionInfo.RuntimeVersion
45-
AspnetVersion = $versionInfo.AspnetVersion
46-
SdkVersion = $versionInfo.SdkVersion
47-
ComputeShas = $true
48-
AzdoVariableName = "updateDepsArgs-$index"
49-
UseStableBranding = $versionInfo.StableBranding
50-
}
51-
52-
if ("${{ parameters.useInternalBuild }}" -eq "true") {
53-
$args["InternalAccessToken"] = '$(System.AccessToken)'
54-
$args["InternalBaseUrl"] = '"$(internalBaseUrl)"'
55-
} else {
56-
$args["ReleaseState"] = $(Get-ProductReleaseState)
57-
}
58-
59-
Write-Host "Executing Set-DotnetVersions.ps1 for $($versionInfo.DockerfileVersion)"
60-
$(engPath)/Set-DotnetVersions.ps1 @args
61-
$index++
62-
}
63-
displayName: Get update-dependencies args
64-
- powershell: |
65-
Import-Module -force $(engPath)/DependencyManagement.psm1
66-
67-
$targetBranch = $(Get-Branch)
68-
if ("${{ parameters.useInternalBuild }}" -eq "true") {
69-
$targetBranch = "staging-${{ parameters.buildId }}-pipeline-$(Build.BuildId)"
70-
}
71-
72-
$customArgsArray = @()
73-
$index=0
74-
75-
# Grab the variables that were set by the multiple calls to Set-DotnetVersions.ps1 and
76-
# add them to an array. This allows us to pass args for multiple Dockerfile versions.
77-
while ([Environment]::GetEnvironmentVariable("UPDATEDEPSARGS-$index") -ne $null) {
78-
$updateDepsArgs = [Environment]::GetEnvironmentVariable("UPDATEDEPSARGS-$index")
79-
$updateDepsArgs = "$updateDepsArgs --org dnceng --project $(System.TeamProject) --repo $(Build.Repository.Name) --target-branch $targetBranch"
80-
$customArgsArray += $updateDepsArgs
81-
$index++
82-
}
83-
84-
echo "##vso[task.setvariable variable=customArgsArray]$($customArgsArray | ConvertTo-Json -Compress -AsArray)"
85-
displayName: Set Custom Args
868
- template: update-dependencies.yml
879
parameters:
88-
customArgsArray: "$(customArgsArray)"
89-
useInternalBuild: ${{ parameters.useInternalBuild }}
10+
args: "from-channel ${{ parameters.channel }} ${{ parameters.repo }} --version-source-name '${{ parameters.versionSourceName }}'"
11+
useInternalBuild: false
12+
serviceConnection: ${{ parameters.serviceConnection }}

eng/pipelines/update-dependencies.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ stages:
2020
vmImage: $(defaultLinuxAmd64PoolImage)
2121
steps:
2222
- template: steps/update-dotnet-dependencies.yml
23+
parameters:
24+
channel: "${{ variables['channel'] }}"
25+
repo: "https://github.com/dotnet/dotnet"
26+
versionSourceName: "dotnet/dotnet"
27+
serviceConnection: "Darc: Maestro Production"
2328
- template: jobs/update-tools.yml
2429
parameters:
2530
tools: ["chisel", "rocks-toolbox", "syft", "mingit"]

0 commit comments

Comments
 (0)