Skip to content

Commit b677309

Browse files
Microsoft Graph DevX ToolingMicrosoft Graph DevX Tooling
authored andcommitted
fix: configure ACR publishing variables
Use shared registry and service connection variables and consume artifacts without requiring a separately provisioned Azure Pipelines environment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: af247b04-ecf8-4873-a78c-33d6437bb0d0
1 parent bd5ab3d commit b677309

3 files changed

Lines changed: 16 additions & 36 deletions

File tree

.azure-pipelines/ci-build.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,12 @@ extends:
138138
dependsOn: stage
139139
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest'), eq(dependencies.stage.outputs['MsGraphPsSdkCiBuild.DetectAcrChanges.ShouldPublishToAcr'], 'true'))
140140
jobs:
141-
- deployment: DeployPowerShellPackagesToAcr
141+
- job: DeployPowerShellPackagesToAcr
142142
displayName: Deploy PowerShell packages to ACR
143-
environment: PowerShellAcr
144143
templateContext:
145-
type: releaseJob
146-
isProduction: true
147144
inputs:
148145
- input: pipelineArtifact
149146
artifactName: drop
150147
targetPath: '$(System.DefaultWorkingDirectory)/drop'
151-
strategy:
152-
runOnce:
153-
deploy:
154-
steps:
155-
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
148+
steps:
149+
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self

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

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

4-
parameters:
5-
- name: AzureSubscription
6-
type: string
7-
default: 'ACR Images Push Service Connection'
8-
- name: RegistryUri
9-
type: string
10-
default: 'https://msgraphprodregistry.azurecr.io'
11-
- name: RepositoryName
12-
type: string
13-
default: 'MicrosoftGraphAcr'
14-
- name: ArtifactPath
15-
type: string
16-
default: '$(System.DefaultWorkingDirectory)/drop'
4+
variables:
5+
ACR_SERVICE_CONNECTION: 'ACR Images Push Service Connection'
6+
REGISTRY: 'msgraphprodregistry.azurecr.io'
7+
REGISTRY_NAME: 'msgraphprodregistry'
8+
ARTIFACT_PATH: '$(System.DefaultWorkingDirectory)/drop'
179

1810
steps:
1911
- task: AzurePowerShell@5
2012
displayName: 'Publish PowerShell packages to ACR'
2113
inputs:
22-
azureSubscription: ${{ parameters.AzureSubscription }}
14+
azureSubscription: $(ACR_SERVICE_CONNECTION)
2315
ScriptType: InlineScript
2416
azurePowerShellVersion: LatestVersion
2517
pwsh: true
@@ -36,12 +28,12 @@ steps:
3628
}
3729
Import-Module Microsoft.PowerShell.PSResourceGet -MinimumVersion $minimumPsResourceGetVersion -Force
3830
39-
$repositoryName = '${{ parameters.RepositoryName }}'
31+
$repositoryName = '$(REGISTRY_NAME)'
4032
$existingRepository = Get-PSResourceRepository -Name $repositoryName -ErrorAction SilentlyContinue
4133
if ($null -ne $existingRepository) {
4234
Unregister-PSResourceRepository -Name $repositoryName
4335
}
44-
Register-PSResourceRepository -Name $repositoryName -Uri '${{ parameters.RegistryUri }}'
36+
Register-PSResourceRepository -Name $repositoryName -Uri 'https://$(REGISTRY)'
4537
4638
Add-Type -AssemblyName System.IO.Compression.FileSystem
4739
function Get-PackageMetadata {
@@ -73,10 +65,10 @@ steps:
7365
}
7466
}
7567
76-
$packages = @(Get-ChildItem -Path '${{ parameters.ArtifactPath }}' -Recurse -File -Filter 'Microsoft.Graph*.nupkg' |
68+
$packages = @(Get-ChildItem -Path '$(ARTIFACT_PATH)' -Recurse -File -Filter 'Microsoft.Graph*.nupkg' |
7769
ForEach-Object { Get-PackageMetadata -PackagePath $_.FullName })
7870
if ($packages.Count -eq 0) {
79-
throw "No Microsoft Graph PowerShell packages were found under '${{ parameters.ArtifactPath }}'."
71+
throw "No Microsoft Graph PowerShell packages were found under '$(ARTIFACT_PATH)'."
8072
}
8173
8274
$packages = $packages | Sort-Object @{

.azure-pipelines/sdk-release.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,15 @@ extends:
164164
dependsOn: stage
165165
condition: succeeded()
166166
jobs:
167-
- deployment: DeployPowerShellPackagesToAcr
167+
- job: DeployPowerShellPackagesToAcr
168168
displayName: Deploy PowerShell packages to ACR
169-
environment: PowerShellAcr
170169
templateContext:
171-
type: releaseJob
172-
isProduction: true
173170
inputs:
174171
- input: pipelineArtifact
175172
artifactName: drop
176173
targetPath: '$(System.DefaultWorkingDirectory)/drop'
177-
strategy:
178-
runOnce:
179-
deploy:
180-
steps:
181-
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
174+
steps:
175+
- template: .azure-pipelines/common-templates/publish-psresources-acr.yml@self
182176

183177
- stage: PushDockerImageToRegistry
184178
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)