Skip to content

Commit

Permalink
Use latest download and publish artifacts approach (microsoft#341)
Browse files Browse the repository at this point in the history
Uses syntactic sugar for downloading and publishing artifacts. Also replaces (Download|Publish)BuildArtifacts with (Download|Publish)PipelineArtifact.
  • Loading branch information
rozele authored Nov 18, 2020
1 parent 72b84c7 commit 4916f57
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
12 changes: 4 additions & 8 deletions .azdo/templates/jobs/build/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,11 @@ jobs:
reportDirectory: $(Build.SourcesDirectory)/**/benchcovrepresults
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'

- task: PublishPipelineArtifact@1
- publish: $(Build.ArtifactStagingDirectory)/prerelease
displayName: Publish prerelease NuGet packages
inputs:
artifactName: $(artifactNamePrerelease)
targetPath: $(Build.ArtifactStagingDirectory)/prerelease
artifact: $(artifactNamePrerelease)

- task: PublishPipelineArtifact@1
- publish: $(Build.ArtifactStagingDirectory)/release
displayName: Publish release NuGet packages
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
artifactName: $(artifactNameRelease)
targetPath: $(Build.ArtifactStagingDirectory)/release
artifact: $(artifactNameRelease)
7 changes: 2 additions & 5 deletions .azdo/templates/jobs/build/extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,5 @@ jobs:
contents: '**/*.vsix'
targetFolder: $(Build.ArtifactStagingDirectory)

- task: PublishPipelineArtifact@1
displayName: Publish extension packages
inputs:
artifactName: $(artifactName)
targetPath: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)
artifact: $(artifactName)
28 changes: 13 additions & 15 deletions .azdo/templates/jobs/nlu/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ jobs:
--service luis
--delete-appsettings

- task: DownloadBuildArtifacts@0
condition: ne(variables['skipCompare'], 'true')
displayName: Download test results from master
- task: DownloadPipelineArtifact@2
condition: and(succeeded(), ne(variables['skipCompare'], 'true'))
displayName: Download NLU results from master
inputs:
buildType: specific
source: specific
project: $(System.TeamProject)
pipeline: $(Build.DefinitionName)
buildVersionToDownload: latestFromBranch
branchName: refs/heads/master
artifactName: statistics
runVersion: latestFromBranch
runBranch: refs/heads/master
artifact: nlu

- task: DotNetCoreCLI@2
condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['skipCompare'], 'true'))
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), ne(variables['skipCompare'], 'true'))
displayName: Compare the NLU text results with baseline
inputs:
command: custom
Expand All @@ -72,11 +72,11 @@ jobs:
--expected models/tests.json
--actual $(Build.ArtifactStagingDirectory)/results.json
--test-settings models/compare.yml
--baseline $(System.ArtifactsDirectory)/$(nluResults)/statistics.json
--baseline $(Pipeline.Workspace)/nlu/statistics.json
--output-folder $(Build.ArtifactStagingDirectory)

- task: DotNetCoreCLI@2
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['skipCompare'], 'true'))
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['skipCompare'], 'true')))
displayName: Compare the NLU text results without baseline
inputs:
command: custom
Expand All @@ -94,8 +94,6 @@ jobs:
testResultsFormat: NUnit
testResultsFiles: $(Build.ArtifactStagingDirectory)/**/TestResult.xml

- task: PublishBuildArtifacts@1
displayName: Publish build artifacts
condition: succeededOrFailed()
inputs:
artifactName: statistics
- publish: $(Build.ArtifactStagingDirectory)
displayName: Publish NLU results
artifact: nlu
15 changes: 8 additions & 7 deletions .azdo/templates/steps/install-dotnet-nlu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,32 @@ steps:
artifactName: artifactName

# Note: only required when building dotnet-nlu from source
- task: DownloadPipelineArtifact@2
- download: current
displayName: Download NuGet packages
inputs:
artifact: $(artifactName)
artifact: $(artifactName)

# Note: only --add-source required when building dotnet-nlu from source
# Note: --add-source and --version only required when building dotnet-nlu from source
- task: DotNetCoreCLI@2
displayName: Install dotnet-nlu
inputs:
command: custom
custom: tool
arguments: install dotnet-nlu
--add-source $(Pipeline.Workspace)
--add-source $(Pipeline.Workspace)/$(artifactName)
--tool-path $(Agent.TempDirectory)/bin
--version $(nuget.version.prerelease)

# Note: only --add-source required when building dotnet-nlu from source
# Note: --add-source and --version only required when building dotnet-nlu from source
- task: DotNetCoreCLI@2
displayName: Install NLU provider
condition: ne('${{ parameters.service }}', '')
inputs:
command: custom
custom: tool
arguments: install dotnet-nlu-${{ parameters.service }}
--add-source $(Pipeline.Workspace)
--add-source $(Pipeline.Workspace)/$(artifactName)
--tool-path $(Agent.TempDirectory)/bin
--version $(nuget.version.prerelease)

- bash: echo "##vso[task.prependpath]$(Agent.TempDirectory)/bin"
displayName: Prepend .NET Core CLI tool path
5 changes: 5 additions & 0 deletions .config/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<packageSources>
</packageSources>
</configuration>

0 comments on commit 4916f57

Please sign in to comment.