Scenario:
- configure an Azure DevOps yaml deployment pipeline for a front-end app
- the front-end resources are published to Azure Artifacts as an NPM package
- Azure DevOps pipeline promotes initial package to a number of stages
Approach:
- Alt. 1: explicit "Download Package" task to download npm package from Azure Artifacts feed
displayName: "Artifacts - download"
inputs:
packageType: 'npm'
feed: '38a52be4-9352-453e-af97-5c3b448652f0/38a52be4-9352-453e-af97-5c3b448652f0'
view: '070e33c7-f5c8-4561-8186-5c3b448652f0'
definition: '1f32cfbf-1427-4b27-8476-5c3b448652f0'
version: '1.0.1'
downloadPath: '$(System.ArtifactsDirectory)'
This sort of works, but it requires either to specify a hard-coded version inside the yaml-definition or else a wildcard "*" (latest version). Ideally, the version could be specified at runtime via the "Run Pipeline"-dialog. However, this requires for the package to be configured as a resource (Alt. 2)
- Alt. 2: specify a "package" resource on top of the yaml-definition.
According to the docs, there are number of possible resources: pipelines, builds, repositories, containers, packages and webhooks. In this case, "packages" resource seems approriate.
resources:
packages:
- package: contoso
type: npm
connection: pat-contoso
name: yourname/contoso
version: 7.130.88
trigger: true
However, the docs are lacking, only providing one example for GitHub packages.
I can't find any example, specifically for an "Azure Artifacts" package.
Who can share a working "package"-configuration, specifically for Azure Artifacts?