Skip to content

Commit 026e72f

Browse files
Microsoft Graph DevX ToolingMicrosoft Graph DevX Tooling
authored andcommitted
refactor: pass ACR variables to publish template
Expose the service connection and registry values as explicit step-template parameters while retaining their definitions in the parent pipelines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: af247b04-ecf8-4873-a78c-33d6437bb0d0
1 parent 6f52476 commit 026e72f

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

.azure-pipelines/ci-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,8 @@ extends:
148148
artifactName: drop
149149
targetPath: '$(System.DefaultWorkingDirectory)/drop'
150150
steps:
151-
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
151+
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
152+
parameters:
153+
AzureSubscription: $(ACR_SERVICE_CONNECTION)
154+
Registry: $(REGISTRY)
155+
RegistryName: $(REGISTRY_NAME)

.azure-pipelines/common-templates/publish-psresources-acr.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
parameters:
5+
- name: AzureSubscription
6+
type: string
7+
- name: Registry
8+
type: string
9+
- name: RegistryName
10+
type: string
11+
412
steps:
513
- task: AzurePowerShell@5
614
displayName: 'Publish PowerShell packages to ACR'
715
inputs:
8-
azureSubscription: $(ACR_SERVICE_CONNECTION)
16+
azureSubscription: ${{ parameters.AzureSubscription }}
917
ScriptType: InlineScript
1018
azurePowerShellVersion: LatestVersion
1119
pwsh: true
@@ -22,12 +30,12 @@ steps:
2230
}
2331
Import-Module Microsoft.PowerShell.PSResourceGet -MinimumVersion $minimumPsResourceGetVersion -Force
2432
25-
$repositoryName = '$(REGISTRY_NAME)'
33+
$repositoryName = '${{ parameters.RegistryName }}'
2634
$existingRepository = Get-PSResourceRepository -Name $repositoryName -ErrorAction SilentlyContinue
2735
if ($null -ne $existingRepository) {
2836
Unregister-PSResourceRepository -Name $repositoryName
2937
}
30-
Register-PSResourceRepository -Name $repositoryName -Uri 'https://$(REGISTRY)'
38+
Register-PSResourceRepository -Name $repositoryName -Uri 'https://${{ parameters.Registry }}'
3139
3240
Add-Type -AssemblyName System.IO.Compression.FileSystem
3341
function Get-PackageMetadata {

.azure-pipelines/sdk-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ extends:
175175
targetPath: '$(System.DefaultWorkingDirectory)/drop'
176176
steps:
177177
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
178+
parameters:
179+
AzureSubscription: $(ACR_SERVICE_CONNECTION)
180+
Registry: $(REGISTRY)
181+
RegistryName: $(REGISTRY_NAME)
178182

179183
- stage: PushDockerImageToRegistry
180184
condition: and(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), not(contains(variables['Build.SourceBranch'], '-preview')))

0 commit comments

Comments
 (0)