Skip to content

Commit

Permalink
Migrate all usages of task: UseDotNet@2 to template `install-net.ym…
Browse files Browse the repository at this point in the history
…l` (#5045)

#5045
  • Loading branch information
Konrad Jamrozik authored Jan 10, 2023
1 parent 292b1f8 commit d234a19
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 99 deletions.
10 changes: 3 additions & 7 deletions .azure-pipelines/apiview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pr:
- tools/apiview/parsers/js-api-parser

variables:
DotNetRuntimeVersion: '6.x'
PythonVersion: '3.10.9'
WebClientProjectDirectory: 'src/dotnet/APIView/APIViewWeb/Client'
WebProjectPath: 'src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj'
Expand Down Expand Up @@ -165,11 +164,8 @@ stages:
pwsh: true
displayName: 'Start Azurite'

- task: UseDotNet@2
displayName: 'Install .NET'
inputs:
version: '$(DotNetRuntimeVersion)'

- template: /eng/pipelines/templates/steps/install-dotnet.yml

- pwsh: |
dotnet --list-runtimes
dotnet --version
Expand Down Expand Up @@ -204,6 +200,6 @@ stages:
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*.trx'
testRunTitle: 'Windows DotNet $(DotNetRuntimeVersion)'
testRunTitle: 'Tests against Windows .NET'
testResultsFormat: 'VSTest'
mergeTestResults: true
85 changes: 41 additions & 44 deletions eng/pipelines/apiview-review-gen-swagger.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
pr: none

trigger: none

pool:
name: azsdk-pool-mms-win-2022-general
vmImage: MMS2022

variables:
SwaggerParserInstallPath: $(Pipeline.Workspace)/SwaggerApiParser

jobs:
- job: CreateSwaggerReviewCodeFile
displayName: 'Create Swagger API review token file'

variables:
- template: /eng/pipelines/templates/variables/globals.yml

steps:
- script: |
mkdir SwaggerApiParser
workingDirectory: $(Pipeline.Workspace)
displayName: Setup working directory for Swagger Parser.
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'

- script: >
dotnet tool install
Azure.Sdk.Tools.SwaggerApiParser
--version 1.0.0-dev.0.4
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--tool-path $(SwaggerParserInstallPath)
workingDirectory: $(SwaggerParserInstallPath)
displayName: 'Install Swagger APIView Parser'
- template: /eng/pipelines/templates/steps/apiview-review-gen.yml
parameters:
Reviews: $(Reviews)
APIViewURL: $(APIViewURL)
StorageContainerUrl: $(StorageContainerUrl)
ApiviewGenScript: './Create-Apiview-Token-Swagger.ps1'
pr: none

trigger: none

pool:
name: azsdk-pool-mms-win-2022-general
vmImage: MMS2022

variables:
SwaggerParserInstallPath: $(Pipeline.Workspace)/SwaggerApiParser

jobs:
- job: CreateSwaggerReviewCodeFile
displayName: 'Create Swagger API review token file'

variables:
- template: /eng/pipelines/templates/variables/globals.yml

steps:
- script: |
mkdir SwaggerApiParser
workingDirectory: $(Pipeline.Workspace)
displayName: Setup working directory for Swagger Parser.
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- script: >
dotnet tool install
Azure.Sdk.Tools.SwaggerApiParser
--version 1.0.0-dev.0.4
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--tool-path $(SwaggerParserInstallPath)
workingDirectory: $(SwaggerParserInstallPath)
displayName: 'Install Swagger APIView Parser'
- template: /eng/pipelines/templates/steps/apiview-review-gen.yml
parameters:
Reviews: $(Reviews)
APIViewURL: $(APIViewURL)
StorageContainerUrl: $(StorageContainerUrl)
ApiviewGenScript: './Create-Apiview-Token-Swagger.ps1'
ParserPath: $(SwaggerParserInstallPath)/SwaggerApiParser
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ stages:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: MMSUbuntu22.04
steps:
- task: UseDotNet@2
displayName: Tools
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- pwsh: |
dotnet build tools/${{ parameters.ToolName }} --configuration Release
displayName: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ stages:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: MMSUbuntu22.04
steps:
- task: UseDotNet@2
displayName: Tools
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- pwsh: |
dotnet build tools/${{ parameters.ToolName }} --configuration Release
displayName: Build
Expand Down
11 changes: 3 additions & 8 deletions eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ parameters:
- name: DotNetCoreVersion
type: string
default: ''
- name: SkipDotNetInstall
type: boolean
default: false
- name: NoWarn
type: boolean
default: false
Expand Down Expand Up @@ -114,11 +111,9 @@ stages:
- job: Test

steps:
- task: UseDotNet@2
condition: eq(${{ parameters.SkipDotNetInstall }}, false)
displayName: 'Use .NET Core sdk ${{ coalesce( parameters.DotNetCoreVersion, variables.DotNetCoreVersion) }}'
inputs:
version: '${{ coalesce( parameters.DotNetCoreVersion, variables.DotNetCoreVersion) }}'
- template: /eng/pipelines/templates/steps/install-dotnet.yml
parameters:
DotNetCoreVersion: ${{ parameters.DotNetCoreVersion }}

- script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) $(Warn) --logger trx'
displayName: 'Test'
Expand Down
9 changes: 4 additions & 5 deletions eng/pipelines/templates/steps/install-dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# As of 12/20/2022 this is work in progress.
# Please see:
# https://github.com/Azure/azure-sdk-tools/issues/5009
# and linked PRs.
parameters:
# Use this parameter if you want to override the .NET SDK set by global.json
- name: DotNetCoreVersion
Expand All @@ -17,4 +13,7 @@ steps:
${{ if eq( 'parameters.DotNetCoreVersion', '') }}:
useGlobalJson: true
${{ else }}:
version: ${{ parameters.DotNetCoreVersion }}
version: ${{ parameters.DotNetCoreVersion }}

# Future work: add NuGet packages caching. See:
# https://github.com/Azure/azure-sdk-tools/issues/5086
1 change: 0 additions & 1 deletion eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
variables:
OfficialBuildId: $(Build.BuildNumber)
skipComponentGovernanceDetection: true
DotNetCoreVersion: '6.x'
NotificationsCreatorVersion: '1.0.0-dev.20230108.1'
PipelineOwnersExtractorVersion: '1.0.0-dev.20230105.1'
6 changes: 1 addition & 5 deletions src/dotnet/Mgmt.CI.BuildTools/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ stages:
vmImage: 'windows-2022'

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk $(DotNetCoreVersion)'
inputs:
packageType: sdk
version: $(DotNetCoreVersion)
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- script: 'dotnet pack $(ProjectFile) -o $(Build.ArtifactStagingDirectory) -warnaserror $(VersioningProps)'
displayName: 'Build and Package'
Expand Down
27 changes: 6 additions & 21 deletions tools/test-proxy/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ stages:
name: $(Pool)

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- script: 'dotnet test /p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) --filter "Category=Integration" --logger trx $(Build.SourcesDirectory)/tools/test-proxy/'
displayName: 'Test'
Expand All @@ -44,7 +41,7 @@ stages:
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*.trx'
testRunTitle: '$(OS) AssetSync Tests against $(DotNetCoreVersion)'
testRunTitle: '$(OS) AssetSync tests against .NET'
testResultsFormat: 'VSTest'
mergeTestResults: true

Expand All @@ -66,10 +63,7 @@ stages:
name: $(Pool)

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- template: /eng/pipelines/templates/steps/test-proxy-local-tool.yml
parameters:
Expand All @@ -94,10 +88,7 @@ stages:
CLI_TEST_DOCKER_TAG: localproxyinstance

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- pwsh: |
./prepare.ps1
Expand Down Expand Up @@ -144,10 +135,7 @@ stages:
CLONE_LOCATION: "$(Agent.BuildDirectory)/js_repo"

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- task: NodeTool@0
inputs:
Expand Down Expand Up @@ -201,10 +189,7 @@ stages:
CLONE_LOCATION: "$(Agent.BuildDirectory)/python_repo"

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: '6.x'
- template: /eng/pipelines/templates/steps/install-dotnet.yml

- template: /eng/pipelines/templates/steps/use-python-version.yml
parameters:
Expand Down

0 comments on commit d234a19

Please sign in to comment.