I'm trying to configure a CI that will produce NuGet packages as artifacts on Azure DevOps (that will be later pushed to my NuGet server).
For this, I'm using Builds Pipelines on Azure DevOps, the YAML version.
I have 3 projects that should build packages. I'm using NuGetCommand@2 to accomplish this task :
- task: NuGetCommand@2
inputs:
command: pack
packagesToPack: $(Build.SourcesDirectory)/src/HTS_MessageEngine.Communication/HTS_MessageEngine.Communication.csproj
majorVersion: $(majorVersion)
minorVersion: $(minorVersion)
patchVersion: $(patchVersion)
versioningScheme: byPrereleaseNumber
However, I have to duplicate this block 3 times, for each project. Is there a way to specify an array of projects in the packagesToPack parameter? So far, the version is the same for each package, so I don't need three different blocks...
Note: these 3 projects are all 3 NetStandard and properties for package building are stored in csproj directly
Passing variables between tasks in the same job Set the value with the command echo "##vso[task. setvariable variable=FOO]some value" In subsequent tasks, you can use the $(FOO) syntax to have Azure Pipelines replace the variable with some value.
To use a variable group, open your pipeline. Select Variables > Variable groups, and then choose Link variable group. In a build pipeline, you see a list of available groups. In a release pipeline, for example, you also see a drop-down list of stages in the pipeline.
In this article, you'll learn how to set up and run your canvas app tests built in the Test Studio by using a YAML pipeline in Azure DevOps Services. You can use a public project on GitHub—Microsoft/PowerAppsTestAutomation—to: Automate the operations of signing in to your application.
For above code I got this exception running a build:
my-template.yml (Line: 1, Col: 12): Unexpected value ''
but this works for me:
# my-template.yml
parameters:
- name: projects
type: object
default: {}
steps:
- ${{ each project in parameters.projects }}:
- task: PublishBuildArtifacts@1
displayName: 'Publish ${{ project }}
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/${{ project }}.zip'
and then:
# ci.yml
steps:
- template: my-template.yml
parameters:
projects:
- test1
- test2
you can use each function (if its available at all at this point in time):
# my-template.yml
parameters:
steps:
- ${{ each project in parameters.projects }}:
- task: PublishBuildArtifacts@1
displayName: Publish ${{ project }}
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/${{ project }}.zip'
# ci.yml
steps:
- template: my-template.yml
parameters:
projects:
- test1
- test2
Github PR for this functionality: https://github.com/Microsoft/azure-pipelines-yaml/pull/2#issuecomment-452748467
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With