Skip to content

Commit 1a2836b

Browse files
committed
Update outdated tasks for DownloadBuildArtifacts@0 and vstest@2
1 parent 24bfe56 commit 1a2836b

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

docs/pipelines/process/phases.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -723,35 +723,34 @@ When you run a pipeline on a self-hosted agent, by default, none of the subdirec
723723

724724
## Artifact download
725725

726-
This example YAML file publishes the artifact `WebSite` and then downloads the artifact to `$(Pipeline.Workspace)`. The Deploy job only runs if the Build job is successful.
726+
This example YAML file publishes the artifact `Website` and then downloads the artifact to `$(Pipeline.Workspace)`. The Deploy job only runs if the Build job is successful.
727727

728728
#### [YAML](#tab/yaml/)
729729

730730
```yaml
731-
# test and upload my code as an artifact named WebSite
731+
# test and upload my code as an artifact named Website
732732
jobs:
733733
- job: Build
734734
pool:
735735
vmImage: 'ubuntu-latest'
736736
steps:
737737
- script: npm test
738-
- task: PublishBuildArtifacts@1
738+
- task: PublishPipelineArtifact@1
739739
inputs:
740-
pathtoPublish: '$(System.DefaultWorkingDirectory)'
741-
artifactName: WebSite
740+
artifactName: Website
741+
targetPath: '$(System.DefaultWorkingDirectory)'
742742
743743
# download the artifact and deploy it only if the build job succeeded
744744
- job: Deploy
745745
pool:
746746
vmImage: 'ubuntu-latest'
747747
steps:
748748
- checkout: none #skip checking out the default repository resource
749-
- task: DownloadBuildArtifacts@0
750-
displayName: 'Download Build Artifacts'
749+
- task: DownloadPipelineArtifact@2
750+
displayName: 'Download Pipeline Artifact'
751751
inputs:
752-
artifactName: WebSite
753-
downloadPath: $(Pipeline.Workspace)
754-
752+
artifactName: Website
753+
targetPath: '$(Pipeline.Workspace)'
755754
dependsOn: Build
756755
condition: succeeded()
757756
```

docs/pipelines/process/template-expressions.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,22 @@ in an expression. Only predefined variables can be used in template expressions.
2424
For example, you define a template:
2525

2626
```yaml
27-
# File: steps/msbuild.yml
27+
# File: steps/vsbuild.yml
2828

2929
parameters:
3030
- name: 'solution'
3131
default: '**/*.sln'
3232
type: string
3333

3434
steps:
35-
- task: msbuild@1
35+
- task: VSBuild@1
3636
inputs:
3737
solution: ${{ parameters['solution'] }} # index syntax
38-
- task: vstest@2
38+
- task: VSTest@3
3939
inputs:
40-
solution: ${{ parameters.solution }} # property dereference syntax
40+
testSelector: 'testAssemblies'
41+
testAssemblyVer2: ${{ parameters.solution }} # property dereference syntax
42+
searchFolder: '$(System.DefaultWorkingDirectory)'
4143
```
4244
4345
Then you reference the template and pass it the optional `solution` parameter:
@@ -46,7 +48,7 @@ Then you reference the template and pass it the optional `solution` parameter:
4648
# File: azure-pipelines.yml
4749
4850
steps:
49-
- template: steps/msbuild.yml
51+
- template: steps/vsbuild.yml
5052
parameters:
5153
solution: my.sln
5254
```
@@ -113,9 +115,9 @@ jobs:
113115
steps:
114116
- script: cred-scan
115117
- ${{ parameters.preBuild }}
116-
- task: msbuild@1
118+
- task: VSBuild@1
117119
- ${{ parameters.preTest }}
118-
- task: vstest@2
120+
- task: VSTest@3
119121
- ${{ parameters.preSign }}
120122
- script: sign
121123
```
@@ -150,8 +152,8 @@ jobs:
150152
arch: x86
151153
${{ insert }}: ${{ parameters.additionalVariables }}
152154
steps:
153-
- task: msbuild@1
154-
- task: vstest@2
155+
- task: VSBuild@1
156+
- task: VSTest@3
155157
```
156158

157159
```yaml
@@ -173,24 +175,24 @@ For example, to insert into a sequence in a template:
173175
174176
parameters:
175177
- name: 'toolset'
176-
default: msbuild
178+
default: vsbuild
177179
type: string
178180
values:
179-
- msbuild
181+
- vsbuild
180182
- dotnet
181183
182184
steps:
183185
# msbuild
184186
- ${{ if eq(parameters.toolset, 'msbuild') }}:
185-
- task: msbuild@1
186-
- task: vstest@2
187+
- task: VSBuild@1
188+
- task: VSTest@3
187189
188190
# dotnet
189191
- ${{ if eq(parameters.toolset, 'dotnet') }}:
190-
- task: dotnet@1
192+
- task: UseDotNet@2
191193
inputs:
192194
command: build
193-
- task: dotnet@1
195+
- task: UseDotNet@2
194196
inputs:
195197
command: test
196198
```

docs/pipelines/process/template-parameters.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ steps:
208208
env:
209209
SOLUTION: ${{ parameters.solution }}
210210
displayName: Check for required parameters
211-
- task: msbuild@1
211+
- task: VSBuild@1
212212
inputs:
213213
solution: ${{ parameters.solution }}
214-
- task: vstest@2
214+
- task: VSTest@3
215215
inputs:
216-
solution: ${{ parameters.solution }}
216+
testSelector: 'testAssemblies'
217+
testAssemblyVer2: ${{ parameters.solution }}
218+
searchFolder: '$(System.DefaultWorkingDirectory)'
217219
```
218220

219221
To show that the template fails if it's missing the required parameter:

0 commit comments

Comments
 (0)