From 47aba066d8f621ab4a4a11b5a648d8b6620edd7f Mon Sep 17 00:00:00 2001 From: ray chen Date: Wed, 5 Mar 2025 19:23:20 +0000 Subject: [PATCH 1/2] Renamed batch pipeline and added internal project constrain --- ...k-all-specs.yml => spec-gen-sdk-batch.yml} | 0 .../stages/archetype-spec-gen-sdk.yml | 55 ++++++++++--------- 2 files changed, 28 insertions(+), 27 deletions(-) rename eng/pipelines/{spec-gen-sdk-all-specs.yml => spec-gen-sdk-batch.yml} (100%) diff --git a/eng/pipelines/spec-gen-sdk-all-specs.yml b/eng/pipelines/spec-gen-sdk-batch.yml similarity index 100% rename from eng/pipelines/spec-gen-sdk-all-specs.yml rename to eng/pipelines/spec-gen-sdk-batch.yml diff --git a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml index f579ed1415e8..1af5487bc19f 100644 --- a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml +++ b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml @@ -209,34 +209,35 @@ extends: 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')) - inputs: - pwsh: true - workingDirectory: $(SdkRepoDirectory) - filePath: $(SdkRepoDirectory)/eng/common/scripts/Add-IssueLabels.ps1 - arguments: > - -RepoOwner $(SpecRepoOwner) - -RepoName $(SpecRepoName) - -IssueNumber "$(System.PullRequest.PullRequestNumber)" - -Labels $(BreakingChangeLabel) - -AuthToken "$(azuresdk-github-pat)" - - task: PowerShell@2 - displayName: Remove label from the spec PR - condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['BreakingChangeLabel'], ''), eq(variables['BreakingChangeLabelAction'], 'remove')) - inputs: - pwsh: true - workingDirectory: $(SdkRepoDirectory) - filePath: $(SdkRepoDirectory)/eng/common/scripts/Remove-IssueLabel.ps1 - arguments: > - -RepoOwner $(SpecRepoOwner) - -RepoName $(SpecRepoName) - -IssueNumber "$(System.PullRequest.PullRequestNumber)" - -LabelName $(BreakingChangeLabel) - -AuthToken "$(azuresdk-github-pat)" + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - task: PowerShell@2 + displayName: Add label to the spec PR + condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['BreakingChangeLabel'], ''), eq(variables['BreakingChangeLabelAction'], 'add')) + inputs: + pwsh: true + workingDirectory: $(SdkRepoDirectory) + filePath: $(SdkRepoDirectory)/eng/common/scripts/Add-IssueLabels.ps1 + arguments: > + -RepoOwner $(SpecRepoOwner) + -RepoName $(SpecRepoName) + -IssueNumber "$(System.PullRequest.PullRequestNumber)" + -Labels $(BreakingChangeLabel) + -AuthToken "$(azuresdk-github-pat)" + + - task: PowerShell@2 + displayName: Remove label from the spec PR + condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['BreakingChangeLabel'], ''), eq(variables['BreakingChangeLabelAction'], 'remove')) + inputs: + pwsh: true + workingDirectory: $(SdkRepoDirectory) + filePath: $(SdkRepoDirectory)/eng/common/scripts/Remove-IssueLabel.ps1 + arguments: > + -RepoOwner $(SpecRepoOwner) + -RepoName $(SpecRepoName) + -IssueNumber "$(System.PullRequest.PullRequestNumber)" + -LabelName $(BreakingChangeLabel) + -AuthToken "$(azuresdk-github-pat)" - ${{ if eq(parameters.SkipPullRequestCreation, false) }}: - template: /eng/common/pipelines/templates/steps/git-push-changes.yml From 62274bf5240abf7ba6b48830b3d8e6d6ff99158f Mon Sep 17 00:00:00 2001 From: ray chen Date: Thu, 6 Mar 2025 16:52:08 +0000 Subject: [PATCH 2/2] Moved all needed steps inside of interal project condition --- .../stages/archetype-spec-gen-sdk.yml | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml index 1af5487bc19f..179984c36303 100644 --- a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml +++ b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml @@ -239,40 +239,40 @@ extends: -LabelName $(BreakingChangeLabel) -AuthToken "$(azuresdk-github-pat)" - - ${{ if eq(parameters.SkipPullRequestCreation, false) }}: - - template: /eng/common/pipelines/templates/steps/git-push-changes.yml - parameters: - BaseRepoBranch: $(PrBranch)-$(Build.BuildId) - BaseRepoOwner: azure-sdk - CommitMsg: $(GeneratedSDKInformation) - TargetRepoOwner: $(SdkRepoOwner) - TargetRepoName: $(SdkRepoName) - PushArgs: "--force" - WorkingDirectory: $(SdkRepoDirectory) - ScriptDirectory: $(SdkRepoDirectory)/eng/common/scripts + - ${{ if eq(parameters.SkipPullRequestCreation, false) }}: + - template: /eng/common/pipelines/templates/steps/git-push-changes.yml + parameters: + BaseRepoBranch: $(PrBranch)-$(Build.BuildId) + BaseRepoOwner: azure-sdk + CommitMsg: $(GeneratedSDKInformation) + TargetRepoOwner: $(SdkRepoOwner) + TargetRepoName: $(SdkRepoName) + PushArgs: "--force" + WorkingDirectory: $(SdkRepoDirectory) + ScriptDirectory: $(SdkRepoDirectory)/eng/common/scripts - - ${{ 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 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) + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - template: /eng/common/pipelines/templates/steps/detect-api-changes.yml + parameters: + ArtifactPath: $(GeneratedSDK.StagedArtifactsFolder) + ArtifactName: $(PipelineArtifactsName) + RepoRoot: $(SdkRepoDirectory)