Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
parameters:
- name: ArtifactPath
type: string
default: $(Build.ArtifactStagingDirectory)
- name: Artifacts
type: object
default: []
- name: ConfigFileDir
type: string
default: $(Build.ArtifactStagingDirectory)/PackageInfo
- name: GenerateApiReviewForManualOnly
type: boolean
default: false
- name: ArtifactName
type: string
default: "packages"
- name: PackageName
type: string
default: ""
- name: SourceRootPath
type: string
default: $(Build.SourcesDirectory)
- name: PackageInfoFiles
type: object
default: []

steps:
# Automatic APIView revisions are created regardless of how the pipeline is triggered.
# This condition limits revision creation to manual runs when GenerateApiReviewForManualOnly is true.
- ${{ if or(ne(parameters.GenerateApiReviewForManualOnly, true), eq(variables['Build.Reason'], 'Manual')) }}:
# Ideally this should be an initial step in the caller job.
# Remove this step once all callers set the default branch themselves.
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
parameters:
WorkingDirectory: ${{ parameters.SourceRootPath }}

- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest'), not(endsWith(variables['Build.Repository.Name'], '-pr'))) }}:
- task: AzureCLI@2
inputs:
azureSubscription: "APIView prod deployment"
scriptType: pscore
scriptLocation: scriptPath
scriptPath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Create-APIViewRevision.ps1
# PackageInfoFiles example: @('a/file1.json','a/file2.json')
arguments: >
-PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}')
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name)
-ArtifactPath '${{ parameters.ArtifactPath }}'
-ArtifactName '${{ parameters.ArtifactName }}'
-PackageName '${{ parameters.PackageName }}'
-SourceBranch '$(Build.SourceBranchName)'
-DefaultBranch '$(DefaultBranch)'
-ConfigFileDir '${{ parameters.ConfigFileDir }}'
-BuildId '$(Build.BuildId)'
-RepoName '$(Build.Repository.Name)'
displayName: Create APIView Revision
condition: >-
and(
succeededOrFailed(),
not(
and(
eq(variables['Skip.CreateApiReview'], 'true'),
eq(variables['IsRequesterAuthorizedToSkipApiReview'], 'true')
)
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
parameters:
- name: PackageInfoFiles
type: object
- name: RepoOwner
type: string
default: ""
- name: SourceRootPath
type: string
default: $(Build.SourcesDirectory)

steps:
# The consuming pipeline must install the Azure SDK Tools CLI before including this template.
# Use install-azsdk-cli.yml or otherwise set $(AZSDK) to the azsdk executable path.
- task: AzureCLI@2
displayName: Check Package Approval Status
# Keep this predicate aligned with the release-stage inclusion condition in archetype-python-release.yml.
condition: >-
and(
succeeded(),
eq(variables['System.TeamProject'], 'internal'),
or(
in(variables['Build.Reason'], 'Manual', ''),
and(
eq(variables['Build.Reason'], 'IndividualCI'),
eq(variables['Build.SourceBranch'], 'refs/heads/main')
)
),
not(
and(
eq(variables['Skip.CheckPackageApproval'], 'true'),
eq(variables['IsRequesterAuthorizedToSkipApiReview'], 'true')
)
)
)
inputs:
azureSubscription: "ADO to ARH Service Connection"
scriptType: pscore
scriptLocation: scriptPath
scriptPath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Get-PackageApprovalStatus.ps1
# PackageInfoFiles example: @('a/file1.json','a/file2.json')
arguments: >
-PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}')
-RepoOwner '${{ parameters.RepoOwner }}'
-AzSdkExePath '$(AZSDK)'
workingDirectory: $(Pipeline.Workspace)
37 changes: 37 additions & 0 deletions eng/common/pipelines/templates/steps/mark-package-released.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
parameters:
- name: PackageInfoFiles
type: object
- name: RepoOwner
type: string
default: ""
- name: SourceRootPath
type: string
default: $(Build.SourcesDirectory)

steps:
# Include this template only after package publishing in the release stage.
# The consuming pipeline must install the Azure SDK Tools CLI before including this template.
# Use install-azsdk-cli.yml or otherwise set $(AZSDK) to the azsdk executable path.
- task: AzureCLI@2
displayName: Mark Packages Released
condition: >-
and(
succeeded(),
not(
and(
eq(variables['Skip.MarkPackageReleased'], 'true'),
eq(variables['IsRequesterAuthorizedToSkipApiReview'], 'true')
)
)
)
inputs:
azureSubscription: "ADO to ARH Service Connection"
scriptType: pscore
scriptLocation: scriptPath
scriptPath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Mark-PackageReleased.ps1
# PackageInfoFiles example: @('a/file1.json','a/file2.json')
arguments: >
-PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}')
-RepoOwner '${{ parameters.RepoOwner }}'
-AzSdkExePath '$(AZSDK)'
workingDirectory: $(Pipeline.Workspace)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variables:
IsRequesterAuthorizedToSkipApiReview: >-
$[in(
lower(variables['Build.RequestedForEmail']),
'bebroder@microsoft.com',
'mharder@microsoft.com',
Comment thread
tjprescott marked this conversation as resolved.
'djurek@microsoft.com',
'chononiw@microsoft.com',
'raychen@microsoft.com',
'trpresco@microsoft.com',
'prmarott@microsoft.com'
)]
Loading
Loading