Skip to content

Commit

Permalink
Skip pull request creation on private repos (#32678)
Browse files Browse the repository at this point in the history
Test generation of APIView

Update logic in eng/common to allow testing

test generation of pipeline artifacts

Use correct artifacts path

Revert changes to common tools

Run Detect-API-Changes only for pull request runs
  • Loading branch information
chidozieononiwu authored Feb 27, 2025
1 parent 16bfd22 commit c2afa6e
Showing 1 changed file with 42 additions and 29 deletions.
71 changes: 42 additions & 29 deletions eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ extends:
value: '3.13'
- name: SpecGenSdkVersion
value: 'latest'
- name: SdkArtifactName
value: SDK_Artifact
- name: PipelineArtifactsName
value: 'packages'

pool:
name: $(LINUXPOOL)
Expand All @@ -54,16 +54,6 @@ extends:
templateContext:
outputParentDirectory: $(System.DefaultWorkingDirectory)/out
outputs:
- output: pipelineArtifact
displayName: Publish SDK artifacts to Pipeline Artifacts
condition: and(ne(variables['ValidationResult'], ''), eq(variables['HasSDKArtifact'], 'true'))
artifactName: $(sdkArtifactName)
targetPath: "$(System.DefaultWorkingDirectory)/out/stagedArtifacts"
- output: pipelineArtifact
displayName: Publish API View artifacts to Pipeline Artifacts
condition: and(ne(variables['ValidationResult'], ''), eq(variables['HasApiViewArtifact'], 'true'))
artifactName: $(ArtifactName)
targetPath: "$(System.DefaultWorkingDirectory)/out/stagedArtifacts"
- output: pipelineArtifact
displayName: Publish logs to Pipeline Artifacts
condition: ne(variables['ValidationResult'], '')
Expand Down Expand Up @@ -205,6 +195,21 @@ extends:
$optional_params
displayName: 'Generate SDK'
- task: Powershell@2
inputs:
filePath: $(SdkRepoDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory $(GeneratedSDK.ServiceName)
-OutDirectory $(GeneratedSDK.StagedArtifactsFolder)/PackageInfo
pwsh: true
workingDirectory: $(SdkRepoDirectory)
displayName: Dump Package properties

- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactName: $(PipelineArtifactsName)
ArtifactPath: $(GeneratedSDK.StagedArtifactsFolder)

- task: PowerShell@2
displayName: Add label to the spec PR
condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['BreakingChangeLabel'], ''), eq(variables['BreakingChangeLabelAction'], 'add'))
Expand Down Expand Up @@ -245,20 +250,28 @@ extends:
WorkingDirectory: $(SdkRepoDirectory)
ScriptDirectory: $(SdkRepoDirectory)/eng/common/scripts

- task: PowerShell@2
displayName: Create pull request
condition: and(succeeded(), eq(variables['HasChanges'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
pwsh: true
workingDirectory: $(SdkRepoDirectory)
filePath: $(SdkRepoDirectory)/eng/common/scripts/Submit-PullRequest.ps1
arguments: >
-RepoOwner "$(SdkRepoOwner)"
-RepoName "$(SdkRepoName)"
-BaseBranch "main"
-PROwner "azure-sdk"
-PRBranch "$(PrBranch)-$(Build.BuildId)"
-AuthToken "$(azuresdk-github-pat)"
-PRTitle "$(PrTitle)-generated-from-$(Build.DefinitionName)-$(Build.BuildId)"
-PRBody "$(GeneratedSDKInformation)"
-OpenAsDraft $true
- ${{ if not(endsWith(variables['SdkRepoName'], '-pr')) }}:
- task: PowerShell@2
displayName: Create pull request
condition: and(succeeded(), eq(variables['HasChanges'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
pwsh: true
workingDirectory: $(SdkRepoDirectory)
filePath: $(SdkRepoDirectory)/eng/common/scripts/Submit-PullRequest.ps1
arguments: >
-RepoOwner "$(SdkRepoOwner)"
-RepoName "$(SdkRepoName)"
-BaseBranch "main"
-PROwner "azure-sdk"
-PRBranch "$(PrBranch)-$(Build.BuildId)"
-AuthToken "$(azuresdk-github-pat)"
-PRTitle "$(PrTitle)-generated-from-$(Build.DefinitionName)-$(Build.BuildId)"
-PRBody "$(GeneratedSDKInformation)"
-OpenAsDraft $true
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: /eng/common/pipelines/templates/steps/detect-api-changes.yml
parameters:
ArtifactPath: $(GeneratedSDK.StagedArtifactsFolder)
ArtifactName: $(PipelineArtifactsName)
RepoRoot: $(SdkRepoDirectory)

0 comments on commit c2afa6e

Please sign in to comment.