简体   繁体   中英

Can we have two Build.ArtifactStagingDirectory location for one repo in one azure-pipeline yaml file to publish two different debian installer

I want to create two debian installers ( packageName1 & packageName2 ) in same repo of azure-pipeline with same feed . Below is the task of my azure-pipeline.yaml file

          - task: PublishBuildArtifacts@1
            displayName: 'Publish artifacts'
            inputs:
              pathtoPublish: '$(Build.ArtifactStagingDirectory)'
              artifactName: 'Installer package and anti-virus scan results'
        
          - task: UniversalPackages@0
            displayName: Publish univeral package-1
            inputs:
              command: publish
              publishDirectory: '$(Build.ArtifactStagingDirectory)'
              vstsFeedPublish: '$(packageFeed)'
              vstsFeedPackagePublish: '$(packageName1)'
              packagePublishDescription: ''
              versionOption: custom
              versionPublish: $(packageVersion1)
            condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))

          - task: UniversalPackages@0
            displayName: Publish univeral package-2
            inputs:
              command: publish
              publishDirectory: '$(Build.ArtifactStagingDirectory)'
              vstsFeedPublish: '$(packageFeed)'
              vstsFeedPackagePublish: '$(packageName2)'
              packagePublishDescription: ''
              versionOption: custom
              versionPublish: $(packageVersion2)
            condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))

But when I am downloading artifact for one of the package installer through az command:

az artifacts universal download \
  --organization "https://myplatform.visualstudio.com/" \
  --feed "my-feed" \
  --name $packageName1 \
  --version $packageVersion1 \
  --path .

the packages and files of packageName2 are also getting downloaded. I feel that's because I am using same Build.ArtifactStagingDirectory location to store/publish the artifacts for both packages. Can I use different location for both installer packages?

You can create a subfolder under Build.ArtifactStagingDirectory for each project and publish each artifact separately.

There aren't 'multiple artifact directories', but you can create as many folders under the directory as you want and then pass the subfolder into the build and publish tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM