From 3d8e3a8ff5a72a7a35de42534d7d62062e4728ff Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Wed, 6 Jan 2021 01:41:00 +1100 Subject: [PATCH 1/4] Initial pass of enabling 1ES pools in JS repo. --- .../templates/jobs/archetype-sdk-client.yml | 96 +++++++++++-------- .../templates/stages/archetype-sdk-client.yml | 88 +++++++++-------- eng/pipelines/templates/steps/common.yml | 2 - 3 files changed, 105 insertions(+), 81 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index b06372c44729..46c2029f35ca 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -1,28 +1,41 @@ parameters: - Artifacts: [] - TestPipeline: false - ServiceDirectory: not-specified - Matrix: - Linux_Node8: - OSVmImage: "ubuntu-18.04" - NodeTestVersion: "8.x" - TestType: "node" - Windows_Node10: - OSVmImage: "windows-2019" - NodeTestVersion: "10.x" - TestType: "node" - macOS_Node12: - OSVmImage: "macOS-10.15" - NodeTestVersion: "12.x" - TestType: "node" - Browser_Linux_Node12: - OSVmImage: "ubuntu-18.04" - NodeTestVersion: "$(NodeVersion)" - TestType: "browser" - Linux_Node14: - OSVmImage: "ubuntu-18.04" - NodeTestVersion: "14.x" - TestType: "node" + - name: Artifacts + type: object + default: [] + - name: TestPipeline + type: boolean + default: false + - name: ServiceDirectory + type: string + default: not-specified + - name: Matrix + type: object + default: + Linux_Node8: + Pool: $(LinuxPool) + OSVmImage: + NodeTestVersion: "8.x" + TestType: "node" + Windows_Node10: + Pool: $(WindowsPool) + OSVmImage: + NodeTestVersion: "10.x" + TestType: "node" + macOS_Node12: + Pool: + OSVmImage: "macOS-10.15" + NodeTestVersion: "12.x" + TestType: "node" + Browser_Linux_Node12: + Pool: $(LinuxPool) + OSVmImage: "ubuntu-18.04" + NodeTestVersion: "$(NodeVersion)" + TestType: "browser" + Linux_Node14: + Pool: $(LinuxPool) + OSVmImage: "ubuntu-18.04" + NodeTestVersion: "14.x" + TestType: "node" jobs: - job: "Build" @@ -30,7 +43,7 @@ jobs: - template: ../variables/globals.yml pool: - vmImage: "$(OSVmImage)" + name: ${{ parameters.LinuxPool }} steps: - script: | @@ -57,7 +70,7 @@ jobs: - template: ../variables/globals.yml pool: - vmImage: "$(OSVmImage)" + name: ${{ parameters.LinuxPool }} steps: - template: ../steps/common.yml @@ -69,21 +82,26 @@ jobs: # Only run tests if the matrix has entries - ${{ if ne(parameters.RunUnitTests, false) }}: - - job: "UnitTest" + - job: "UnitTest" - strategy: - matrix: ${{parameters.Matrix}} + strategy: + matrix: ${{parameters.Matrix}} - pool: - vmImage: "$(OSVmImage)" + pool: + name: $[coalesce(variables['Pool'], '')] + vmImage: $[coalesce(variables['OSVmImage'], '')] - variables: - - template: ../variables/globals.yml + variables: + - template: ../variables/globals.yml + - name: WindowsPool + value: ${{ parameters.WindowsPool }} + - name: LinuxPool + value: ${{ parameters.LinuxPool }} - steps: - - template: ../steps/common.yml + steps: + - template: ../steps/common.yml - - template: ../steps/test.yml - parameters: - Artifacts: ${{parameters.Artifacts}} - ServiceDirectory: ${{parameters.ServiceDirectory}} + - template: ../steps/test.yml + parameters: + Artifacts: ${{parameters.Artifacts}} + ServiceDirectory: ${{parameters.ServiceDirectory}} diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 0359c3958240..3c19660b3d9f 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -1,44 +1,52 @@ parameters: -- name: Artifacts - type: object - default: [] -- name: TestPipeline - type: boolean - default: false -- name: ServiceDirectory - type: string - default: not-specified -- name: IncludeRelease - type: boolean - default: true -- name: TargetDocRepoOwner - type: string - default: MicrosoftDocs -- name: TargetDocRepoName - type: string - default: azure-docs-sdk-node -- name: RunUnitTests - type: boolean - default: true + - name: Artifacts + type: object + default: [] + - name: TestPipeline + type: boolean + default: false + - name: ServiceDirectory + type: string + default: not-specified + - name: IncludeRelease + type: boolean + default: true + - name: TargetDocRepoOwner + type: string + default: MicrosoftDocs + - name: TargetDocRepoName + type: string + default: azure-docs-sdk-node + - name: RunUnitTests + type: boolean + default: true + - name: WindowsPool + type: string + default: azsdk-pool-mms-win-2019-general + - name: LinuxPool + type: string + default: azsdk-pool-mms-ubuntu-1804-general stages: -- stage: Build - jobs: - - template: ../jobs/archetype-sdk-client.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Artifacts: ${{ parameters.Artifacts }} - TestPipeline: ${{ parameters.TestPipeline }} - RunUnitTests: ${{ parameters.RunUnitTests }} + - stage: Build + jobs: + - template: ../jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Artifacts: ${{ parameters.Artifacts }} + TestPipeline: ${{ parameters.TestPipeline }} + RunUnitTests: ${{ parameters.RunUnitTests }} + WindowsPool: ${{ parameters.WindowsPool }} + LinuxPool: ${{ parameters.LinuxPool }} -# The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. -- ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq(parameters.IncludeRelease,true))}}: - - template: archetype-js-release.yml - parameters: - DependsOn: Build - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Artifacts: ${{ parameters.Artifacts }} - TestPipeline: ${{ parameters.TestPipeline }} - ArtifactName: packages - TargetDocRepoOwner: ${{ parameters.TargetDocRepoOwner }} - TargetDocRepoName: ${{ parameters.TargetDocRepoName }} + # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. + - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq(parameters.IncludeRelease,true))}}: + - template: archetype-js-release.yml + parameters: + DependsOn: Build + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Artifacts: ${{ parameters.Artifacts }} + TestPipeline: ${{ parameters.TestPipeline }} + ArtifactName: packages + TargetDocRepoOwner: ${{ parameters.TargetDocRepoOwner }} + TargetDocRepoName: ${{ parameters.TargetDocRepoName }} diff --git a/eng/pipelines/templates/steps/common.yml b/eng/pipelines/templates/steps/common.yml index e2026fe3fccb..34fbb43d3332 100644 --- a/eng/pipelines/templates/steps/common.yml +++ b/eng/pipelines/templates/steps/common.yml @@ -6,6 +6,4 @@ steps: inputs: versionSpec: "3.6" - - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml - - template: use-node-version.yml From cf9f5eabd3adb34eef6979ad897b04ffceb680ab Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Wed, 6 Jan 2021 01:49:56 +1100 Subject: [PATCH 2/4] Fix indentation. --- .../templates/stages/archetype-sdk-client.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 3c19660b3d9f..73a8287e0877 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -42,11 +42,11 @@ stages: # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq(parameters.IncludeRelease,true))}}: - template: archetype-js-release.yml - parameters: - DependsOn: Build - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Artifacts: ${{ parameters.Artifacts }} - TestPipeline: ${{ parameters.TestPipeline }} - ArtifactName: packages - TargetDocRepoOwner: ${{ parameters.TargetDocRepoOwner }} - TargetDocRepoName: ${{ parameters.TargetDocRepoName }} + parameters: + DependsOn: Build + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Artifacts: ${{ parameters.Artifacts }} + TestPipeline: ${{ parameters.TestPipeline }} + ArtifactName: packages + TargetDocRepoOwner: ${{ parameters.TargetDocRepoOwner }} + TargetDocRepoName: ${{ parameters.TargetDocRepoName }} From 9d851e33f309bbde44fcfd6cb495089ffac7a448 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Wed, 6 Jan 2021 01:53:09 +1100 Subject: [PATCH 3/4] Add WindowsPool and LinuxPool parameters to jobs template. --- eng/pipelines/templates/jobs/archetype-sdk-client.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 46c2029f35ca..4417e0b8371a 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -8,6 +8,12 @@ parameters: - name: ServiceDirectory type: string default: not-specified + - name: WindowsPool + type: string + default: azsdk-pool-mms-win-2019-general + - name: LinuxPool + type: string + default: azsdk-pool-mms-ubuntu-1804-general - name: Matrix type: object default: From db73f85b1b2b447a6de578f2510239c4dc81ce7a Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Wed, 6 Jan 2021 01:58:02 +1100 Subject: [PATCH 4/4] Add missing parameter RunUnitTests. --- eng/pipelines/templates/jobs/archetype-sdk-client.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 4417e0b8371a..12aa0e9b1dbb 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -14,6 +14,9 @@ parameters: - name: LinuxPool type: string default: azsdk-pool-mms-ubuntu-1804-general + - name: RunUnitTests + type: boolean + default: true - name: Matrix type: object default: