11

I'm very new to this pipeline and i'm trying to build a automated way to build the .msi installer file for my application.

I have 2 projects .Net Core and Python, so i created 2 pipelines. The .Net Core pipeline will build and save the files in a location and Python pipeline uses those files(from location) for its dependency and builds a new .msi file, the last portion in the pipeline newsetup.py builds the .msi to which i'll be passing the location of the output files of .Net Core pipeline.

The error i get is Artifact dropcli was not found for build 150.

.Net Core pipeline script:

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(Build.ArtifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    
- task: PublishPipelineArtifact@1
  inputs:
   targetPath: '$(Pipeline.Workspace)'
   artifact: 'dropcli'
   publishLocation: 'pipeline'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Python pipeline script:

- task: DownloadPipelineArtifact@2
  inputs:
    buildType: 'current'
    artifactName: 'dropcli'
    targetPath: '$(Pipeline.Workspace)'

- task: PythonScript@0
  inputs:
    scriptSource: 'filePath'
    scriptPath: 'src/python/newsetup.py'
    arguments: 'bdist_msi $(Pipeline.Workspace)'

Also if i specify the build number somewhere won't it be an issue when a new pipeline is created? Or is that an limitation?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
A Coder
  • 3,039
  • 7
  • 58
  • 129
  • Every pipeline should use its own $(Pipeline.Workspace), so you need to use a shared folder something like $(System.DefaultWorkingDirectory) or anything else to publish and download artifacts. Also add buildnumber to your artifact name.. – Juanma Feliu Apr 06 '21 at 10:31

1 Answers1

17

In your DownloadPipelineArtifact@2 task, the value of buildType is current. This means that you are downloading the artifact in the current run. You should set buildType to specific. Here is an example to download the latest artifact from a specific pipeline:

- task: DownloadPipelineArtifact@2
  inputs:
    buildType: 'specific'
    project: '{project id}'
    definition: '{pipeline id}'
    buildVersionToDownload: 'latest'
    artifactName: 'dropcli'
    targetPath: '$(Pipeline.Workspace)'

You can click "Settings" at the top of the task, it will help you to complete your task more easily.

enter image description here

enter image description here

Click Download Pipeline Artifacts task for detailed information about arguments of this task.

If i specify the build number somewhere won't it be an issue when a new pipeline is created? Or is that an limitation?

As mentioned above, you don't need to specify the build number, and what you need to specify is the pipeline definition id. You can either download the latest artifact of a pipeline or the artifact of a specific build of a pipeline.

Jane Ma-MSFT
  • 4,461
  • 1
  • 6
  • 12