You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/07/16 03:59:56 UTC

[lucenenet] branch master updated: azure-pipelines.yml: Fixed broken checkout and relative paths in the Publish stage (required for Publish symbols path task)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new 88e6b5f  azure-pipelines.yml: Fixed broken checkout and relative paths in the Publish stage (required for Publish symbols path task)
88e6b5f is described below

commit 88e6b5fc2f74190931691fe996a3f70eadca841a
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Jul 16 06:51:05 2020 +0700

    azure-pipelines.yml: Fixed broken checkout and relative paths in the Publish stage (required for Publish symbols path task)
---
 azure-pipelines.yml                              | 76 +++++++++++++-----------
 build/azure-templates/publish-nuget-packages.yml |  6 +-
 build/azure-templates/publish-test-binaries.yml  |  6 +-
 build/azure-templates/publish-test-results.yml   |  2 +-
 build/azure-templates/run-tests-on-os.yml        |  2 +-
 5 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 1e10718..5779f83 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -85,6 +85,7 @@ variables:
 - name: NuGetArtifactDirectory # NuGet binaries directory
   value: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
 
+
 stages:
 - stage: Build_Stage
   displayName: 'Build Stage:'
@@ -94,7 +95,6 @@ stages:
     pool:
       vmImage: 'windows-2019'
 
-
     variables:
       PublishTempDirectory: '$(Build.BinariesDirectory)/publish'
 
@@ -103,6 +103,11 @@ stages:
     - checkout: self # self represents the repo where the initial Pipelines YAML file was found
       fetchDepth: 1  # the depth of commits to ask Git to fetch
 
+    - powershell: |
+        $configuration = if ($env:BUILDCONFIGURATION) { $env:BUILDCONFIGURATION } else { "Release" }
+        Write-Host "##vso[task.setvariable variable=BuildConfiguration;]$configuration"
+      displayName: 'Setup Default Variable Values'
+
     - task: UseDotNet@2
       displayName: 'Use .NET Core sdk 3.1.301'
       inputs:
@@ -134,7 +139,9 @@ stages:
         '$(PackageVersion)' | Out-File -FilePath "$dir/$(PackageVersionFileName)" -Force
         '$(FileVersion)' | Out-File -FilePath "$dir/$(FileVersionFileName)" -Force
         '$(Build.BuildNumber)' | Out-File -FilePath "$dir/$(BuildNumberFileName)" -Force
-        
+      displayName: 'Persist Versions to Files'
+
+    - pwsh: |
         # Generate a lucene.testsettings.json file for use with the test framework
         $nightly = if ($Env:IsNightly -eq 'true') { 'true' } else { 'false' }
         $weekly = if ($Env:IsWeekly -eq 'true') { 'true' } else { 'false' }
@@ -159,7 +166,8 @@ stages:
                         """multiplier"": ""$multiplier""`n`t" +
                     "}`n}"
         Out-File -filePath "$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)" -encoding UTF8 -inputObject $fileText
-      displayName: 'Persist Variables to Files'
+      displayName: 'Persist Test Settings to lucene.testsettings.json'
+      condition: and(succeeded(), ne(variables['RunTests'], 'false'))
 
     # If this is a release pipeline, copy the build.bat and Version.props files as version artifacts, which will 
     # overwrite the build.bat and Version.props files of the release.
@@ -186,33 +194,29 @@ stages:
       displayName: 'Copy .pdb Files to: /$(DebugArtifactName)'
       inputs:
         SourceFolder: '$(System.DefaultWorkingDirectory)'
-        Contents: |
-         **\**\bin\**\*.pdb
+        Contents: '**/bin/$(BuildConfiguration)/**/*.pdb'
         TargetFolder: '$(Build.ArtifactStagingDirectory)/$(DebugArtifactName)'
 
-    - ${{ if ne(variables['RunTests'], 'false') }}:
-      - template: 'build/azure-templates/publish-test-binaries.yml'
-        parameters:
-          publishDirectory: $(PublishTempDirectory)
-          framework: 'netcoreapp3.1'
-          binaryArtifactName: '$(BinaryArtifactName)'
-          testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
-
-    - ${{ if ne(variables['RunTests'], 'false') }}:
-      - template: 'build/azure-templates/publish-test-binaries.yml'
-        parameters:
-          publishDirectory: $(PublishTempDirectory)
-          framework: 'netcoreapp2.1'
-          binaryArtifactName: '$(BinaryArtifactName)'
-          testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
-
-    - ${{ if ne(variables['RunTests'], 'false') }}:
-      - template: 'build/azure-templates/publish-test-binaries.yml'
-        parameters:
-          publishDirectory: $(PublishTempDirectory)
-          framework: 'net48'
-          binaryArtifactName: '$(BinaryArtifactName)'
-          testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+    - template: 'build/azure-templates/publish-test-binaries.yml'
+      parameters:
+        publishDirectory: $(PublishTempDirectory)
+        framework: 'netcoreapp3.1'
+        binaryArtifactName: '$(BinaryArtifactName)'
+        testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+
+    - template: 'build/azure-templates/publish-test-binaries.yml'
+      parameters:
+        publishDirectory: $(PublishTempDirectory)
+        framework: 'netcoreapp2.1'
+        binaryArtifactName: '$(BinaryArtifactName)'
+        testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+
+    - template: 'build/azure-templates/publish-test-binaries.yml'
+      parameters:
+        publishDirectory: $(PublishTempDirectory)
+        framework: 'net48'
+        binaryArtifactName: '$(BinaryArtifactName)'
+        testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
 
     - task: PublishPipelineArtifact@1
       displayName: 'Publish Artifact: $(NuGetArtifactName)'
@@ -372,20 +376,24 @@ stages:
       vmImage: 'windows-2019'
 
     steps:
-    - checkout: none # self represents the repo where the initial Pipelines YAML file was found
+      # We checkout here because we need to publish the source code along with the symbols for debugging
+    - checkout: self # self represents the repo where the initial Pipelines YAML file was found
+      fetchDepth: 1  # the depth of commits to ask Git to fetch
+
     - template: 'build/azure-templates/show-all-environment-variables.yml'
 
     - task: DownloadPipelineArtifact@0
       displayName: 'Download Build Artifacts: $(VersionArtifactName)'
       inputs:
         artifactName: '$(VersionArtifactName)'
-        targetPath: version
+        targetPath: '$(System.DefaultWorkingDirectory)/$(VersionArtifactName)'
 
-        
+      # For debugging this pipeline
     - powershell: | 
         Get-ChildItem -Path $(System.DefaultWorkingDirectory)
     - powershell: | 
-        Get-ChildItem -Path version
+        Get-ChildItem -Path '$(VersionArtifactName)'
+
       # NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
       # the version cannot be passed to the Index Sources & Publish Symbols task.
     - powershell: |
@@ -419,14 +427,14 @@ stages:
       displayName: 'Download Build Artifacts: $(NuGetArtifactName)'
       inputs:
         artifactName: '$(NuGetArtifactName)'
-        targetPath: nuget
+        targetPath: '$(System.DefaultWorkingDirectory)/$(NuGetArtifactName)'
 
 
     - task: DownloadPipelineArtifact@0
       displayName: 'Download Build Artifacts: $(VersionArtifactName)'
       inputs:
         artifactName: '$(VersionArtifactName)'
-        targetPath: version
+        targetPath: '$(System.DefaultWorkingDirectory)/$(VersionArtifactName)'
         
     - template: 'build/azure-templates/show-all-files.yml' # Uncomment for debugging
 
diff --git a/build/azure-templates/publish-nuget-packages.yml b/build/azure-templates/publish-nuget-packages.yml
index f718bcc..94e93d6 100644
--- a/build/azure-templates/publish-nuget-packages.yml
+++ b/build/azure-templates/publish-nuget-packages.yml
@@ -44,13 +44,13 @@ steps:
   displayName: 'Download Build Artifacts: ${{ parameters.nugetArtifactName }}'
   inputs:
     artifactName: '${{ parameters.nugetArtifactName }}'
-    targetPath: nuget
+    targetPath: '$(System.DefaultWorkingDirectory)/${{ parameters.nugetArtifactName }}'
 
 - task: DownloadPipelineArtifact@0
   displayName: 'Download Build Artifacts: ${{ parameters.debugArtifactName }}'
   inputs:
     artifactName: '${{ parameters.debugArtifactName }}'
-    targetPath: debug
+    targetPath: '$(System.DefaultWorkingDirectory)/${{ parameters.debugArtifactName }}'
 
 - task: NuGetCommand@2
   displayName: 'NuGet push'
@@ -63,7 +63,7 @@ steps:
 - task: PublishSymbols@2
   displayName: 'Publish symbols path'
   inputs:
-    SymbolsFolder: '${{ parameters.debugArtifactName }}'
+    SymbolsFolder: '$(System.DefaultWorkingDirectory)/${{ parameters.debugArtifactName }}'
     SearchPattern: |
       **/bin/**/*.pdb
       !${{ parameters.testSymbolFilesConvention }}
diff --git a/build/azure-templates/publish-test-binaries.yml b/build/azure-templates/publish-test-binaries.yml
index ae620f8..436b8c0 100644
--- a/build/azure-templates/publish-test-binaries.yml
+++ b/build/azure-templates/publish-test-binaries.yml
@@ -19,16 +19,19 @@
 # to the binary publish subdirectory for the provided target
 # framework, and then publishes to an pipeline artifact.
 
+# NOTE: Depends on environment varable $(RunTests)
+
 parameters:
   publishDirectory: '' # The path of the root publish staging directory where the binaries can be found $(PublishTempDirectory)
   framework: '' # The target framework
   binaryArtifactName: '' # The prefix of the binary artifact to publish $(BinaryArtifactName)
-  testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/lucene.testsettings.json' #The name of the 
+  testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/lucene.testsettings.json' #The name of the lucene test settings file
 
 steps:
 - pwsh: |
     Copy-Item -Path "${{ parameters.testSettingsFilePath }}" -Destination "${{ parameters.publishDirectory }}/${{ parameters.framework }}/" -Force
   displayName: 'Copy lucene.testsettings.json File to: ${{ parameters.publishDirectory }}/${{ parameters.framework }}'
+  condition: and(succeeded(), ne(variables['RunTests'], 'false'))
 
 - task: PublishPipelineArtifact@1
   displayName: 'Publish Artifact: ${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
@@ -36,3 +39,4 @@ steps:
     targetPath: '${{ parameters.publishDirectory }}/${{ parameters.framework }}'
     artifact: '${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
     publishLocation: 'pipeline'
+  condition: and(succeeded(), ne(variables['RunTests'], 'false'))
diff --git a/build/azure-templates/publish-test-results.yml b/build/azure-templates/publish-test-results.yml
index c60fea6..9de28db 100644
--- a/build/azure-templates/publish-test-results.yml
+++ b/build/azure-templates/publish-test-results.yml
@@ -69,7 +69,7 @@ steps:
     } else {
         Write-Host "WARNING: File not found: $testResultsFileName"
     }
-    Write-Host "##vso[task.setvariable variable=TestResultsFileExists;]$testResultsFileExists"      
+    Write-Host "##vso[task.setvariable variable=TestResultsFileExists;]$testResultsFileExists"
   displayName: 'Parse Test Results File'
 
 - task: PublishTestResults@2
diff --git a/build/azure-templates/run-tests-on-os.yml b/build/azure-templates/run-tests-on-os.yml
index 1308f7c..8549a45 100644
--- a/build/azure-templates/run-tests-on-os.yml
+++ b/build/azure-templates/run-tests-on-os.yml
@@ -57,7 +57,7 @@ steps:
   displayName: 'Download Build Artifacts: ${{ parameters.binaryArtifactName }} to $(System.DefaultWorkingDirectory)\$(parameters.framework)'
   inputs:
     artifactName: '${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
-    targetPath: ${{ parameters.framework }}
+    targetPath: '$(System.DefaultWorkingDirectory)/${{ parameters.framework }}'
 
 - powershell: | 
     Get-ChildItem -Path $(System.DefaultWorkingDirectory)