Skip to content

Commit

Permalink
1ES Template Conversion (#28848)
Browse files Browse the repository at this point in the history
- convert pipelines to 1es-templates from all entrypoints. specifically archetype-sdk-tests, archetype-sdk-client, and cosmos-sdk-client.
- Move all image selection (outside of release deployments) to honor env variables instead of manually writing the pool (similar patterns for all other platforms)

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
  • Loading branch information
scbedd and benbp authored Mar 11, 2024
1 parent c49462c commit ecbebf5
Show file tree
Hide file tree
Showing 20 changed files with 740 additions and 544 deletions.
22 changes: 16 additions & 6 deletions eng/pipelines/templates/jobs/ci.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ parameters:
- name: Matrix
type: string
- name: DependsOn
type: string
default: ''
type: object
default: []
- name: UsePlatformContainer
type: boolean
default: false
- name: CloudConfig
type: object
default: {}
- name: OSName
type: string
default: ''

jobs:
- job:
Expand All @@ -39,10 +42,16 @@ jobs:

pool:
name: $(Pool)
vmImage: $(OSVmImage)
${{ if eq(parameters.UsePlatformContainer, 'true') }}:
# Add a default so the job doesn't fail when the matrix is empty
container: $[ variables['Container'] ]
# 1es pipeline templates converts `image` to demands: ImageOverride under the hood
# which is incompatible with image selection in the default non-1es hosted pools
${{ if eq(parameters.OSName, 'macOS') }}:
vmImage: $(OSVmImage)
${{ else }}:
image: $(OSVmImage)
os: ${{ parameters.OSName }}
${{ if eq(parameters.UsePlatformContainer, 'true') }}:
# Add a default so the job doesn't fail when the matrix is empty
container: $[ variables['Container'] ]

variables:
- template: ../variables/globals.yml
Expand All @@ -55,3 +64,4 @@ jobs:
Artifacts: ${{ parameters.Artifacts }}
ServiceDirectory: ${{ parameters.ServiceDirectory }}
TestProxy: ${{ parameters.TestProxy }}
OSName: ${{ parameters.OSName }}
27 changes: 9 additions & 18 deletions eng/pipelines/templates/jobs/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ parameters:

jobs:
- job: "Build"
variables:
Codeql.Enabled: true
Codeql.BuildIdentifier: ${{ parameters.ServiceDirectory }}
Codeql.SkipTaskAutoInjection: false

pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: MMSUbuntu20.04
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
- script: |
Expand All @@ -55,8 +52,9 @@ jobs:
- job: "Analyze"

pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: MMSUbuntu20.04
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
- template: ../steps/common.yml
Expand All @@ -67,19 +65,12 @@ jobs:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
TestPipeline: ${{ parameters.TestPipeline }}

- job: Compliance
pool:
name: azsdk-pool-mms-win-2022-general
vmImage: MMS2022
steps:
- template: /eng/common/pipelines/templates/steps/credscan.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}

- ${{ if ne(parameters.RunUnitTests, false) }}:
- template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml
- template: /eng/common/pipelines/templates/jobs/generate-job-matrix.yml
parameters:
JobTemplatePath: /eng/pipelines/templates/jobs/ci.tests.yml
OsVmImage: $(LINUXVMIMAGE)
Pool: $(LINUXPOOL)
MatrixConfigs: ${{ parameters.MatrixConfigs }}
MatrixFilters: ${{ parameters.MatrixFilters }}
MatrixReplace: ${{ parameters.MatrixReplace }}
Expand Down
24 changes: 15 additions & 9 deletions eng/pipelines/templates/jobs/live.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ parameters:
- name: UsePlatformContainer
type: boolean
default: false

- name: OSName
type: string

jobs:
- job:
Expand All @@ -57,7 +58,13 @@ jobs:

pool:
name: $(Pool)
vmImage: $(OSVmImage)
# 1es pipeline templates converts `image` to demands: ImageOverride under the hood
# which is incompatible with image selection in the default non-1es hosted pools
${{ if eq(parameters.OSName, 'macOS') }}:
vmImage: $(OSVmImage)
${{ else }}:
image: $(OSVmImage)
os: ${{ parameters.OSName }}

timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}

Expand Down Expand Up @@ -190,13 +197,12 @@ jobs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(PackagePath)/coverage/cobertura-coverage.xml"

- task: PublishPipelineArtifact@1
displayName: "Publish Browser Code Coverage Report Artifact"
continueOnError: true
condition: and(succeededOrFailed(),eq(variables['TestType'], 'browser'),eq(variables['PublishCodeCoverage'], true))
inputs:
path: "$(PackagePath)/coverage-browser"
artifact: BrowserCodeCoverageReport
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactPath: "$(PackagePath)/coverage-browser"
ArtifactName: BrowserCodeCoverageReport
CustomCondition: and(succeededOrFailed(),eq(variables['TestType'], 'browser'),eq(variables['PublishCodeCoverage'], true))
SbomEnabled: false

# Unlink node_modules folders to significantly improve performance of subsequent tasks
# which need to walk the directory tree (and are hardcoded to follow symlinks).
Expand Down
Loading

0 comments on commit ecbebf5

Please sign in to comment.