From 75a7bbfcb7c57318a68c19fc727713614fccb42a Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Fri, 16 May 2025 14:05:17 -0700 Subject: [PATCH 1/4] Remove 1es-redirect We don't have an official production pipelines in repo so removing the unnecessary 1es-redirect. --- .../stages/archetype-spec-gen-sdk.yml | 446 +++++++++--------- 1 file changed, 221 insertions(+), 225 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml index e8a2dd17e653..9e915f8c9779 100644 --- a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml +++ b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml @@ -29,257 +29,253 @@ parameters: type: string default: '' -extends: - template: /eng/pipelines/templates/stages/1es-redirect.yml - parameters: - Use1ESOfficial: false - stages: - - stage: Build - displayName: 'SDK Generation' - jobs: - - job: - timeoutInMinutes: 2400 +stages: +- stage: Build + displayName: 'SDK Generation' + jobs: + - job: + timeoutInMinutes: 2400 - variables: - - template: /eng/pipelines/templates/variables/image.yml - - name: NodeVersion - value: '22.13.x' - - name: PythonVersion - value: '3.13' - - name: PipelineArtifactsName - value: 'packages' - - name: SpecRepoCommit - value: $(Build.SourceVersion) + variables: + - template: /eng/pipelines/templates/variables/image.yml + - name: NodeVersion + value: '22.13.x' + - name: PythonVersion + value: '3.13' + - name: PipelineArtifactsName + value: 'packages' + - name: SpecRepoCommit + value: $(Build.SourceVersion) - pool: - name: $(LINUXPOOL) - vmImage: $(LINUXVMIMAGE) - os: linux + pool: + name: $(LINUXPOOL) + vmImage: $(LINUXVMIMAGE) + os: linux - templateContext: - outputParentDirectory: $(System.DefaultWorkingDirectory)/out - outputs: - - output: pipelineArtifact - displayName: Publish logs to Pipeline Artifacts - artifactName: "spec-gen-sdk-logs" - targetPath: "$(System.DefaultWorkingDirectory)/out/logs" + templateContext: + outputParentDirectory: $(System.DefaultWorkingDirectory)/out + outputs: + - output: pipelineArtifact + displayName: Publish logs to Pipeline Artifacts + artifactName: "spec-gen-sdk-logs" + targetPath: "$(System.DefaultWorkingDirectory)/out/logs" - steps: - - checkout: none + steps: + - checkout: none - - pwsh: | - $tspConfigPathPattern = '^specification\/([^\/]+\/)+tspconfig\.yaml$' - $readmePathPattern = '^specification\/([^\/]+\/){2,}readme\.md$' - if (('${{ parameters.ConfigType }}' -eq 'TypeSpec') -and ('${{ parameters.ConfigPath }}' -notmatch $tspConfigPathPattern)) { - Write-Host "##vso[task.logissue type=error]'ConfigPath' must be a valid 'tspconfig.yaml' file path when 'ConfigType' is set to 'TypeSpec'. For example, 'specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml'" - Exit 1 - } elseif (('${{ parameters.ConfigType }}' -eq 'OpenAPI') -and ('${{ parameters.ConfigPath }}' -notmatch $readmePathPattern)) { - Write-Host "##vso[task.logissue type=error]'ConfigPath' must be a valid 'readme.md' file path when 'ConfigType' is set to 'OpenAPI'. For example, 'specification/appplatform/resource-manager/readme.md'" - Exit 1 - } - if (('$(Build.Reason)' -ne 'PullRequest') -and ('${{ parameters.SpecBatchTypes }}' -eq '')) { - if (('${{ parameters.SdkReleaseType }}' -eq 'stable') -and ('${{ parameters.ApiVersion}}' -match 'preview')) { - Write-Host "##vso[task.logissue type=error]'SDK release type' must be set to 'beta' for the preview API specifications." - Exit 1 - } - } - $urlPattern = '^https://github\.com/(?[^/]+)/(?[^/]+)' - if ('${{ parameters.SpecRepoUrl }}' -match $urlPattern) { - $specRepoOwner = $Matches['organization'] - Write-Host "##vso[task.setvariable variable=SpecRepoOwner]$specRepoOwner" - Write-Host "SpecRepoOwner variable set to: $specRepoOwner" + - pwsh: | + $tspConfigPathPattern = '^specification\/([^\/]+\/)+tspconfig\.yaml$' + $readmePathPattern = '^specification\/([^\/]+\/){2,}readme\.md$' + if (('${{ parameters.ConfigType }}' -eq 'TypeSpec') -and ('${{ parameters.ConfigPath }}' -notmatch $tspConfigPathPattern)) { + Write-Host "##vso[task.logissue type=error]'ConfigPath' must be a valid 'tspconfig.yaml' file path when 'ConfigType' is set to 'TypeSpec'. For example, 'specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml'" + Exit 1 + } elseif (('${{ parameters.ConfigType }}' -eq 'OpenAPI') -and ('${{ parameters.ConfigPath }}' -notmatch $readmePathPattern)) { + Write-Host "##vso[task.logissue type=error]'ConfigPath' must be a valid 'readme.md' file path when 'ConfigType' is set to 'OpenAPI'. For example, 'specification/appplatform/resource-manager/readme.md'" + Exit 1 + } + if (('$(Build.Reason)' -ne 'PullRequest') -and ('${{ parameters.SpecBatchTypes }}' -eq '')) { + if (('${{ parameters.SdkReleaseType }}' -eq 'stable') -and ('${{ parameters.ApiVersion}}' -match 'preview')) { + Write-Host "##vso[task.logissue type=error]'SDK release type' must be set to 'beta' for the preview API specifications." + Exit 1 + } + } + $urlPattern = '^https://github\.com/(?[^/]+)/(?[^/]+)' + if ('${{ parameters.SpecRepoUrl }}' -match $urlPattern) { + $specRepoOwner = $Matches['organization'] + Write-Host "##vso[task.setvariable variable=SpecRepoOwner]$specRepoOwner" + Write-Host "SpecRepoOwner variable set to: $specRepoOwner" - $specRepoName = $Matches['repository'] - Write-Host "##vso[task.setvariable variable=SpecRepoName]$specRepoName" - Write-Host "SpecRepoName variable set to: $specRepoName" + $specRepoName = $Matches['repository'] + Write-Host "##vso[task.setvariable variable=SpecRepoName]$specRepoName" + Write-Host "SpecRepoName variable set to: $specRepoName" - $specRepoDirectory = "$(System.DefaultWorkingDirectory)/$specRepoName" - Write-Host "##vso[task.setvariable variable=SpecRepoDirectory]$specRepoDirectory" - Write-Host "SpecRepoDirectory variable set to: $specRepoDirectory" - } + $specRepoDirectory = "$(System.DefaultWorkingDirectory)/$specRepoName" + Write-Host "##vso[task.setvariable variable=SpecRepoDirectory]$specRepoDirectory" + Write-Host "SpecRepoDirectory variable set to: $specRepoDirectory" + } - if ('${{ parameters.SdkRepoUrl }}' -match $urlPattern) { - if ('${{ parameters.SpecRepoUrl }}'.EndsWith('-pr') -and (-not '${{ parameters.SdkRepoUrl }}'.EndsWith('-pr'))) { - Write-Host "##vso[task.logissue type=error]SdkRepoUrl must be a private repository if SpecRepoUrl is a private repository." - Exit 1 - } + if ('${{ parameters.SdkRepoUrl }}' -match $urlPattern) { + if ('${{ parameters.SpecRepoUrl }}'.EndsWith('-pr') -and (-not '${{ parameters.SdkRepoUrl }}'.EndsWith('-pr'))) { + Write-Host "##vso[task.logissue type=error]SdkRepoUrl must be a private repository if SpecRepoUrl is a private repository." + Exit 1 + } - $sdkRepoOwner = $Matches['organization'] - Write-Host "##vso[task.setvariable variable=SdkRepoOwner]$sdkRepoOwner" - Write-Host "SdkRepoOwner variable set to: $sdkRepoOwner" + $sdkRepoOwner = $Matches['organization'] + Write-Host "##vso[task.setvariable variable=SdkRepoOwner]$sdkRepoOwner" + Write-Host "SdkRepoOwner variable set to: $sdkRepoOwner" - $sdkRepoName = $Matches['repository'] - Write-Host "##vso[task.setvariable variable=SdkRepoName]$sdkRepoName" - Write-Host "SdkRepoName variable set to: $sdkRepoName" + $sdkRepoName = $Matches['repository'] + Write-Host "##vso[task.setvariable variable=SdkRepoName]$sdkRepoName" + Write-Host "SdkRepoName variable set to: $sdkRepoName" - $sdkRepoDirectory = "$(System.DefaultWorkingDirectory)/$sdkRepoName" - Write-Host "##vso[task.setvariable variable=SdkRepoDirectory]$sdkRepoDirectory" - Write-Host "SdkRepoDirectory variable set to: $sdkRepoDirectory" - } + $sdkRepoDirectory = "$(System.DefaultWorkingDirectory)/$sdkRepoName" + Write-Host "##vso[task.setvariable variable=SdkRepoDirectory]$sdkRepoDirectory" + Write-Host "SdkRepoDirectory variable set to: $sdkRepoDirectory" + } - if ([string]::IsNullOrEmpty($SpecRepoOwner) -or [string]::IsNullOrEmpty($SpecRepoName) -or [string]::IsNullOrEmpty($SdkRepoOwner) -or [string]::IsNullOrEmpty($SdkRepoName)) { - Write-Host "##vso[task.logissue type=error]One or more required variables is empty or invalid. Ensure that SpecRepoUrl and SdkRepoUrl are set to valid GitHub repository URLs." - Exit 1 - } + if ([string]::IsNullOrEmpty($SpecRepoOwner) -or [string]::IsNullOrEmpty($SpecRepoName) -or [string]::IsNullOrEmpty($SdkRepoOwner) -or [string]::IsNullOrEmpty($SdkRepoName)) { + Write-Host "##vso[task.logissue type=error]One or more required variables is empty or invalid. Ensure that SpecRepoUrl and SdkRepoUrl are set to valid GitHub repository URLs." + Exit 1 + } - displayName: "Create Run Time Variables" + displayName: "Create Run Time Variables" - - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml - parameters: - Paths: - - '/*' - - '!sdk/**/test-recordings/*' - - '!sdk/**/recordings/*' - - '!sdk/**/SessionRecords/*' - - '!sdk/**/session-records/*' - Repositories: - - Name: $(SpecRepoOwner)/$(SpecRepoName) - Commitish: $(SpecRepoCommit) - WorkingDirectory: $(SpecRepoDirectory) - - Name: $(SdkRepoOwner)/$(SdkRepoName) - Commitish: ${{ parameters.SdkRepoCommit }} - WorkingDirectory: $(SdkRepoDirectory) - SkipCheckoutNone: true - ${{ if and(eq(variables['System.TeamProject'], 'internal'), endsWith(variables['Build.Repository.Name'], '-pr')) }}: - TokenToUseForAuth: $(azuresdk-github-pat) - PreserveAuthToken: true + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - '/*' + - '!sdk/**/test-recordings/*' + - '!sdk/**/recordings/*' + - '!sdk/**/SessionRecords/*' + - '!sdk/**/session-records/*' + Repositories: + - Name: $(SpecRepoOwner)/$(SpecRepoName) + Commitish: $(SpecRepoCommit) + WorkingDirectory: $(SpecRepoDirectory) + - Name: $(SdkRepoOwner)/$(SdkRepoName) + Commitish: ${{ parameters.SdkRepoCommit }} + WorkingDirectory: $(SdkRepoDirectory) + SkipCheckoutNone: true + ${{ if and(eq(variables['System.TeamProject'], 'internal'), endsWith(variables['Build.Repository.Name'], '-pr')) }}: + TokenToUseForAuth: $(azuresdk-github-pat) + PreserveAuthToken: true - - task: NodeTool@0 - inputs: - versionSpec: $(NodeVersion) - displayName: 'Install Node.js' + - task: NodeTool@0 + inputs: + versionSpec: $(NodeVersion) + displayName: 'Install Node.js' - - task: UsePythonVersion@0 - inputs: - versionSpec: $(PythonVersion) + - task: UsePythonVersion@0 + inputs: + versionSpec: $(PythonVersion) - - script: | - optional_params="" - sdk_gen_info="Configurations: " + - script: | + optional_params="" + sdk_gen_info="Configurations: " - if [ "$(Build.Reason)" != "PullRequest" ] && [ "${{ parameters.ConfigType }}" = "TypeSpec" ]; then - optional_params="$optional_params --tsp-config-relative-path ${{ parameters.ConfigPath }}" - sdk_gen_info="$sdk_gen_info '${{ parameters.ConfigPath }}'," - elif [ "$(Build.Reason)" != "PullRequest" ] && [ "${{ parameters.ConfigType }}" = "OpenAPI" ]; then - optional_params="$optional_params --readme-relative-path ${{ parameters.ConfigPath }}" - sdk_gen_info="$sdk_gen_info '${{ parameters.ConfigPath }}'," - fi + if [ "$(Build.Reason)" != "PullRequest" ] && [ "${{ parameters.ConfigType }}" = "TypeSpec" ]; then + optional_params="$optional_params --tsp-config-relative-path ${{ parameters.ConfigPath }}" + sdk_gen_info="$sdk_gen_info '${{ parameters.ConfigPath }}'," + elif [ "$(Build.Reason)" != "PullRequest" ] && [ "${{ parameters.ConfigType }}" = "OpenAPI" ]; then + optional_params="$optional_params --readme-relative-path ${{ parameters.ConfigPath }}" + sdk_gen_info="$sdk_gen_info '${{ parameters.ConfigPath }}'," + fi - updatedSpecRepoCommit="$(SpecRepoCommit)" - if [ "$(Build.Reason)" = "PullRequest" ]; then - optional_params="$optional_params --pr-number $(System.PullRequest.PullRequestNumber)" - specPrUrl="${{ parameters.SpecRepoUrl }}/pull/$(System.PullRequest.PullRequestNumber)" - sdk_gen_info="$sdk_gen_info spec PR: $specPrUrl" - updatedSpecRepoCommit="$(System.PullRequest.SourceCommitId)" - fi + updatedSpecRepoCommit="$(SpecRepoCommit)" + if [ "$(Build.Reason)" = "PullRequest" ]; then + optional_params="$optional_params --pr-number $(System.PullRequest.PullRequestNumber)" + specPrUrl="${{ parameters.SpecRepoUrl }}/pull/$(System.PullRequest.PullRequestNumber)" + sdk_gen_info="$sdk_gen_info spec PR: $specPrUrl" + updatedSpecRepoCommit="$(System.PullRequest.SourceCommitId)" + fi - if [ "${{ parameters.SpecBatchTypes }}" != "" ]; then - optional_params="$optional_params --batch-type ${{ parameters.SpecBatchTypes }}" - sdk_gen_info="$sdk_gen_info SpecBatchTypes: ${{ parameters.SpecBatchTypes }}," - fi + if [ "${{ parameters.SpecBatchTypes }}" != "" ]; then + optional_params="$optional_params --batch-type ${{ parameters.SpecBatchTypes }}" + sdk_gen_info="$sdk_gen_info SpecBatchTypes: ${{ parameters.SpecBatchTypes }}," + fi - if [ "${{ parameters.ApiVersion }}" != "" ]; then - optional_params="$optional_params --api-version ${{ parameters.ApiVersion }} --sdk-release-type ${{ parameters.SdkReleaseType }}" - sdk_gen_info="$sdk_gen_info API Version: ${{ parameters.ApiVersion }}, SDK Release Type: ${{ parameters.SdkReleaseType }}," - fi - sdk_gen_info="$sdk_gen_info and CommitSHA: '$updatedSpecRepoCommit' in SpecRepo: '${{ parameters.SpecRepoUrl }}'" - echo "##vso[task.setvariable variable=GeneratedSDKInformation]$sdk_gen_info" - echo "$sdk_gen_info" + if [ "${{ parameters.ApiVersion }}" != "" ]; then + optional_params="$optional_params --api-version ${{ parameters.ApiVersion }} --sdk-release-type ${{ parameters.SdkReleaseType }}" + sdk_gen_info="$sdk_gen_info API Version: ${{ parameters.ApiVersion }}, SDK Release Type: ${{ parameters.SdkReleaseType }}," + fi + sdk_gen_info="$sdk_gen_info and CommitSHA: '$updatedSpecRepoCommit' in SpecRepo: '${{ parameters.SpecRepoUrl }}'" + echo "##vso[task.setvariable variable=GeneratedSDKInformation]$sdk_gen_info" + echo "$sdk_gen_info" - cd $(SpecRepoDirectory) - echo "##[group]Run npm ci" - npm ci - echo "##[endgroup]" - node $(SpecRepoDirectory)/eng/tools/spec-gen-sdk-runner/cmd/spec-gen-sdk-runner.js \ - --scp $(SpecRepoDirectory) \ - --sdp $(SdkRepoDirectory) \ - --wf $(System.DefaultWorkingDirectory) \ - --lang $(SdkRepoName) \ - --commit $updatedSpecRepoCommit \ - --spec-repo-url ${{ parameters.SpecRepoUrl }} \ - $optional_params || true # return true always to suppress exit error logging - displayName: 'Generate SDK' + cd $(SpecRepoDirectory) + echo "##[group]Run npm ci" + npm ci + echo "##[endgroup]" + node $(SpecRepoDirectory)/eng/tools/spec-gen-sdk-runner/cmd/spec-gen-sdk-runner.js \ + --scp $(SpecRepoDirectory) \ + --sdp $(SdkRepoDirectory) \ + --wf $(System.DefaultWorkingDirectory) \ + --lang $(SdkRepoName) \ + --commit $updatedSpecRepoCommit \ + --spec-repo-url ${{ parameters.SpecRepoUrl }} \ + $optional_params || true # return true always to suppress exit error logging + displayName: 'Generate SDK' - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml - parameters: - ArtifactName: $(SpecGenSdkArtifactName) - ArtifactPath: "$(System.DefaultWorkingDirectory)/$(SpecGenSdkArtifactPath)" - CustomCondition: and(succeededOrFailed(), ne(variables['SpecGenSdkArtifactName'], '')) + - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: $(SpecGenSdkArtifactName) + ArtifactPath: "$(System.DefaultWorkingDirectory)/$(SpecGenSdkArtifactPath)" + CustomCondition: and(succeededOrFailed(), ne(variables['SpecGenSdkArtifactName'], '')) - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml - parameters: - ArtifactName: $(PipelineArtifactsName) - ArtifactPath: $(StagedArtifactsFolder) - CustomCondition: and(succeeded(), ne(variables['StagedArtifactsFolder'], '')) + - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: $(PipelineArtifactsName) + ArtifactPath: $(StagedArtifactsFolder) + CustomCondition: and(succeeded(), ne(variables['StagedArtifactsFolder'], '')) - - ${{ 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)" + - ${{ 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)" + - 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 and(eq(parameters.SkipPullRequestCreation, false), ne(variables['Build.Reason'], 'PullRequest')) }}: - - 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 and(eq(parameters.SkipPullRequestCreation, false), ne(variables['Build.Reason'], 'PullRequest')) }}: + - 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 - - task: PowerShell@2 - displayName: Create pull request - condition: and(succeeded(), eq(variables['HasChanges'], 'true'), ne(variables['Build.Reason'], 'PullRequest'), not(endsWith(variables['SdkRepoName'], '-pr'))) - 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 + - task: PowerShell@2 + displayName: Create pull request + condition: and(succeeded(), eq(variables['HasChanges'], 'true'), ne(variables['Build.Reason'], 'PullRequest'), not(endsWith(variables['SdkRepoName'], '-pr'))) + 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') }}: - - pwsh: | - . $(SpecRepoDirectory)/eng/common/scripts/Helpers/ApiView-Helpers.ps1 - Create-API-Review ` - -specGenSDKArtifactPath "$(System.DefaultWorkingDirectory)/$(SpecGenSdkArtifactPath)/$(SpecGenSdkArtifactName).json" ` - -apiviewArtifactName "$(PipelineArtifactsName)" ` - -buildId "$(Build.BuildId)" ` - -commitish "$(System.PullRequest.SourceCommitId)" ` - -repoName "$(SdkRepoOwner)/$(SpecRepoName)" ` - -pullRequestNumber "$(System.PullRequest.PullRequestNumber)" - displayName: 'Detect API Change and Create API Review' - condition: and(succeeded(), ne(variables['SpecGenSdkArtifactPath'], ''), ne(variables['SpecGenSdkArtifactName'], '')) \ No newline at end of file + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - pwsh: | + . $(SpecRepoDirectory)/eng/common/scripts/Helpers/ApiView-Helpers.ps1 + Create-API-Review ` + -specGenSDKArtifactPath "$(System.DefaultWorkingDirectory)/$(SpecGenSdkArtifactPath)/$(SpecGenSdkArtifactName).json" ` + -apiviewArtifactName "$(PipelineArtifactsName)" ` + -buildId "$(Build.BuildId)" ` + -commitish "$(System.PullRequest.SourceCommitId)" ` + -repoName "$(SdkRepoOwner)/$(SpecRepoName)" ` + -pullRequestNumber "$(System.PullRequest.PullRequestNumber)" + displayName: 'Detect API Change and Create API Review' + condition: and(succeeded(), ne(variables['SpecGenSdkArtifactPath'], ''), ne(variables['SpecGenSdkArtifactName'], '')) From 92352696ca177b54495a53c8d3156da545a6ecb7 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Fri, 16 May 2025 14:05:51 -0700 Subject: [PATCH 2/4] Delete eng/pipelines/templates/stages/1es-redirect.yml --- .../templates/stages/1es-redirect.yml | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 eng/pipelines/templates/stages/1es-redirect.yml diff --git a/eng/pipelines/templates/stages/1es-redirect.yml b/eng/pipelines/templates/stages/1es-redirect.yml deleted file mode 100644 index c20deb7fcb02..000000000000 --- a/eng/pipelines/templates/stages/1es-redirect.yml +++ /dev/null @@ -1,51 +0,0 @@ -resources: - repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release - -parameters: -- name: stages - type: stageList - default: [] -- name: Use1ESOfficial - type: boolean - default: true -- name: GenerateBaselines - type: boolean - default: false - -extends: - ${{ if and(parameters.Use1ESOfficial, eq(variables['System.TeamProject'], 'internal')) }}: - template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates - parameters: - settings: - skipBuildTagsForGitHubPullRequests: true - sdl: - ${{ if and(parameters.GenerateBaselines, eq(variables['Build.SourceBranchName'], 'main'), eq(variables['System.TeamProject'], 'internal')) }}: - autobaseline: - isMainPipeline: true - disableAutoBaselineOnNonDefaultBranches: true - enableForGitHub: true - sourceAnalysisPool: - name: azsdk-pool - image: windows-2022 - os: windows - psscriptanalyzer: - compiled: true - break: true - policy: M365 - stages: ${{ parameters.stages }} - ${{ else }}: - template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates - parameters: - settings: - skipBuildTagsForGitHubPullRequests: true - sdl: # SDLSources stage still runs even all tools are disabled. 1es team uses it for other purposes and they have the following work item to remove the stage. - enableAllTools: false # https://dev.azure.com/mseng/1ES/_workitems/edit/2253084 - sourceAnalysisPool: - name: azsdk-pool - image: windows-2022 - os: windows - stages: ${{ parameters.stages }} \ No newline at end of file From fe1f9a643732e67fc260a0478344facddafc4a51 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Fri, 16 May 2025 14:29:32 -0700 Subject: [PATCH 3/4] Update archetype-spec-gen-sdk.yml --- .../stages/archetype-spec-gen-sdk.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml index 9e915f8c9779..35f178cd51f6 100644 --- a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml +++ b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml @@ -52,14 +52,6 @@ stages: vmImage: $(LINUXVMIMAGE) os: linux - templateContext: - outputParentDirectory: $(System.DefaultWorkingDirectory)/out - outputs: - - output: pipelineArtifact - displayName: Publish logs to Pipeline Artifacts - artifactName: "spec-gen-sdk-logs" - targetPath: "$(System.DefaultWorkingDirectory)/out/logs" - steps: - checkout: none @@ -196,13 +188,13 @@ stages: $optional_params || true # return true always to suppress exit error logging displayName: 'Generate SDK' - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + - template: /eng/common/pipelines/templates/steps/publish-artifact.yml parameters: ArtifactName: $(SpecGenSdkArtifactName) ArtifactPath: "$(System.DefaultWorkingDirectory)/$(SpecGenSdkArtifactPath)" CustomCondition: and(succeededOrFailed(), ne(variables['SpecGenSdkArtifactName'], '')) - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + - template: /eng/common/pipelines/templates/steps/publish-artifact.yml parameters: ArtifactName: $(PipelineArtifactsName) ArtifactPath: $(StagedArtifactsFolder) @@ -279,3 +271,9 @@ stages: -pullRequestNumber "$(System.PullRequest.PullRequestNumber)" displayName: 'Detect API Change and Create API Review' condition: and(succeeded(), ne(variables['SpecGenSdkArtifactPath'], ''), ne(variables['SpecGenSdkArtifactName'], '')) + + - template: /eng/common/pipelines/templates/steps/publish-artifact.yml + parameters: + ArtifactName: "spec-gen-sdk-logs" + ArtifactPath: "$(System.DefaultWorkingDirectory)/out/logs" + CustomCondition: and(succeeded(), ne(variables['SpecGenSdkArtifactPath'], ''), ne(variables['SpecGenSdkArtifactName'], '')) From b445e65ab3554cbd8acccfc8f371ba7c578e3ca6 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Mon, 19 May 2025 15:36:05 -0700 Subject: [PATCH 4/4] Update eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml Co-authored-by: Ray Chen --- eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml index 35f178cd51f6..f49b0d57a93f 100644 --- a/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml +++ b/eng/pipelines/templates/stages/archetype-spec-gen-sdk.yml @@ -276,4 +276,4 @@ stages: parameters: ArtifactName: "spec-gen-sdk-logs" ArtifactPath: "$(System.DefaultWorkingDirectory)/out/logs" - CustomCondition: and(succeeded(), ne(variables['SpecGenSdkArtifactPath'], ''), ne(variables['SpecGenSdkArtifactName'], '')) + CustomCondition: succeededOrFailed()