Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
parameters:
ServiceDirectory: ''
CoverageGoal: 0.95
RunTests: false
- name: ServiceDirectory
type: string
default: ''
- name: CoverageGoal
type: string
default: '0.95'
- name: RunTests
type: string
default: false

stages:
- stage: Build
Expand Down
101 changes: 101 additions & 0 deletions eng/pipelines/templates/jobs/live.tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
parameters:
- name: ServiceDirectory
type: string
default: ''
- name: EnvVars
type: object
default: {}
- name: TimeoutInMinutes
type: number
default: 60
- name: PreSteps
type: object
default: []
- name: PostSteps
type: object
default: []
- name: CloudConfig
type: object
default: {}
- name: Location
type: string
default: ''
- name: Matrix
type: string
- name: DependsOn
type: string
default: ''
- name: UsePlatformContainer
type: boolean
default: false

jobs:
- job:
displayName: Live Test on
dependsOn: ${{ parameters.DependsOn }}
condition: ne(${{ parameters.Matrix }}, '{}')
strategy:
maxParallel: 0
matrix: $[ ${{ parameters.Matrix }} ]

variables:
- template: ../variables/globals.yml
- name: ArmTemplateParameters
value: '@{}'

pool:
name: $(Pool)
vmImage: $(OSVmImage)

timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}

${{ if eq(parameters.UsePlatformContainer, 'true') }}:
container: $[ variables['Container'] ]

steps:
- ${{ parameters.PreSteps }}

- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
AgentImage: $(OSVmImage)

- template: /eng/common/TestResources/build-test-resource-config.yml
parameters:
SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
SubscriptionConfigurations: ${{ parameters.CloudConfig.SubscriptionConfigurations }}

- template: /eng/common/TestResources/deploy-test-resources.yml
parameters:
${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
ServiceDirectory: ${{ parameters.ServiceDirectory }}
SubscriptionConfiguration: $(SubscriptionConfiguration)
ArmTemplateParameters: $(ArmTemplateParameters)

- task: GoTool@0
inputs:
version: '$(GoVersion)'
displayName: "Select Go Version"

- template: ../steps/create-go-workspace.yml

- template: ../steps/set-scope.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
GoWorkspace: $(GO_WORKSPACE_PATH)

- template: ../steps/build-test.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
GoWorkspace: $(GO_WORKSPACE_PATH)
Scope: $(SCOPE)
Image: $(OSVmImage)
GoVersion: $(GoVersion)
RunTests: true

- ${{ parameters.PostSteps }}

- template: /eng/common/TestResources/remove-test-resources.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
SubscriptionConfiguration: $(SubscriptionConfiguration)
96 changes: 96 additions & 0 deletions eng/pipelines/templates/stages/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
parameters:
- name: ServiceDirectory
type: string
default: ''
- name: Clouds
type: string
default: 'Public'
- name: SupportedClouds
type: string
default: 'Public,UsGov,China'
- name: UnsupportedClouds
type: string
default: ''
- name: PreSteps
type: object
default: []
- name: PostSteps
type: object
default: []
- name: TimeoutInMinutes
type: number
default: 60
- name: Location
type: string
default: ''
- name: CloudConfig
type: object
default:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
Preview:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview)
Canary:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
Location: 'centraluseuap'
UsGov:
SubscriptionConfiguration: $(sub-config-gov-test-resources)
China:
SubscriptionConfiguration: $(sub-config-cn-test-resources)
- name: MatrixConfigs
type: object
default:
- Name: Go_live_test_base
Path: eng/pipelines/templates/stages/platform-matrix.json
Selection: all
GenerateVMJobs: true
- name: AdditionalMatrixConfigs
type: object
default: []
- name: MatrixFilters
type: object
default: []
- name: MatrixReplace
type: object
default: []

stages:
- ${{ each cloud in parameters.CloudConfig }}:
# Run all clouds by default for weekly test pipeline, except for clouds specifically unsupported by the calling pipeline
# - ${{ if or(contains(parameters.Clouds, cloud.key), contains(variables['Build.DefinitionName'], 'tests-weekly')) }}:
- ${{ if or(contains(parameters.Clouds, cloud.key), and(contains(variables['Build.DefinitionName'], 'tests-weekly'), contains(parameters.SupportedClouds, cloud.key))) }}:
- ${{ if not(contains(parameters.UnsupportedClouds, cloud.key)) }}:
- stage: ${{ cloud.key }}
dependsOn: []
jobs:
- template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml
parameters:
JobTemplatePath: /eng/pipelines/templates/jobs/live.tests.yml
AdditionalParameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}
EnvVars: ${{ parameters.EnvVars }}
TimeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
Location: ${{ parameters.Location }}
PreSteps:
- ${{ parameters.PreSteps }}
PostSteps:
- ${{ parameters.PostSteps }}
MatrixConfigs:
# Enumerate platforms and additional platforms based on supported clouds (sparse platform<-->cloud matrix).
- ${{ each config in parameters.MatrixConfigs }}:
- ${{ config }}
- ${{ each config in parameters.AdditionalMatrixConfigs }}:
- ${{ config }}
MatrixFilters:
- ${{ each cloudFilter in cloud.value.MatrixFilters }}:
- ${{ cloudFilter }}
- ${{ parameters.MatrixFilters }}
MatrixReplace:
- ${{ each cloudReplace in cloud.value.MatrixReplace }}:
- ${{ cloudReplace }}
- ${{ parameters.MatrixReplace }}
CloudConfig:
SubscriptionConfiguration: ${{ cloud.value.SubscriptionConfiguration }}
SubscriptionConfigurations: ${{ cloud.value.SubscriptionConfigurations }}
Location: ${{ coalesce(parameters.Location, cloud.value.Location) }}
Cloud: ${{ cloud.key }}
18 changes: 18 additions & 0 deletions eng/pipelines/templates/stages/platform-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"matrix": {
"Agent": {
"ubuntu-20.04": {
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general"
},
"windows-2019": {
"OSVmImage": "MMS2019",
"Pool": "azsdk-pool-mms-win-2019-general"
}
},
"GoVersion": [
"1.16.7",
"1.17"
]
}
}
29 changes: 22 additions & 7 deletions eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
parameters:
ServiceDirectory: ''
GoWorkspace: ''
Scope: 'sdk/...'
Image: ''
GoVersion: ''
RunTests: false
- name: ServiceDirectory
type: string
default: ''
- name: GoWorkspace
type: string
default: ''
- name: Scope
type: string
default: 'sdk/...'
- name: Image
type: string
default: ''
- name: GoVersion
type: string
default: ''
- name: RunTests
type: boolean
default: false
- name: EnvVars
type: object
default: {}

steps:

- pwsh: ./eng/scripts/build.ps1
displayName: 'Build'
workingDirectory: '${{parameters.GoWorkspace}}'
Expand Down Expand Up @@ -48,6 +62,7 @@ steps:
workingDirectory: '${{parameters.GoWorkspace}}'
env:
GO111MODULE: 'on'
${{ insert }}: ${{ parameters.EnvVars }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does insert evaluate to here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a way of merging two key/value yaml objects via the template expressions, see https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops#insertion.


- pwsh: ../eng/scripts/create_coverage.ps1 ${{parameters.ServiceDirectory}}
displayName: 'Generate Coverage XML'
Expand Down