Reputation: 3551
I have a build pipeline that publishes a release artifact for consumption by the release pipeline.
pool:
name: Azure Pipelines
demands:
- npm
- msbuild
steps:
- task: Cache@2
displayName: 'npm Cache'
inputs:
key: 'npm | "$(Agent.OS)" | $(System.DefaultWorkingDirectory)/ABCDashboard/Angular/package-lock.json'
path: '$(System.DefaultWorkingDirectory)/ABCDashboard/Angular/node_modules'
cacheHitVar: 'CACHE_RESTORED'
restoreKeys: 'npm | "$(Agent.OS)"'
- task: Npm@1
displayName: 'npm ci'
inputs:
command: ci
workingDir: ABCDashboard/Angular
verbose: false
condition: eq(variables['CACHE_RESTORED'],False)
- task: Npm@1
displayName: 'npm custom: angular build'
inputs:
command: custom
workingDir: ABCDashboard/Angular
verbose: false
customCommand: 'run-script build -- --prod'
- task: NuGetCommand@2
displayName: 'NuGet restore'
- task: MSBuild@1
displayName: '.Net build | Build solution (No need to build test as well)'
inputs:
solution: 'ABCDashboard/*.csproj'
msbuildArchitecture: x64
configuration: Release
msbuildArguments: '/p:OutputPath=$(Build.ArtifactStagingDirectory)'
clean: true
- task: Snyk.snyk-security-scan.custom-build-release-task.SnykSecurityScan@0
displayName: 'Snyk scan for open source vulnerabilities'
inputs:
serviceConnectionEndpoint: SnykAuthFreeTier
failOnIssues: false
testDirectory: ABCDashboard
additionalArguments: '-d --all-projects'
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/_PublishedWebsites/ABCDashboard'
inputs:
SourceFolder: ABCDashboard
Contents: |
Bundles/**
!(packages.config|phantomjs-license.txt)
TargetFolder: '$(Build.ArtifactStagingDirectory)/_PublishedWebsites/ABCDashboard'
- script: |
cd $(Build.ArtifactStagingDirectory)/_PublishedWebsites/ABCDashboard
ls -ltr
displayName: 'List artifacts under $(Build.ArtifactStagingDirectory)/_PublishedWebsites/ABCDashboard'
enabled: false
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/Release'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)/_PublishedWebsites/ABCDashboard'
Contents: |
assets/**
bin/**
Bundles/**
Content/**
Scripts/**
Views/**
Web.config
Web.Dev.config
Web.Test.config
Web.Prod.config
Web.Beta.config
Web.Sandbox.config
ApplicationInsights.config
*.asax
*.ico
*.txt
TargetFolder: '$(Build.ArtifactStagingDirectory)/Release'
- task: ArchiveFiles@2
displayName: 'Archive $(Build.ArtifactStagingDirectory)/Release'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/Release'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/Release/$(Build.BuildId).zip'
verbose: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Release'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Release'
ArtifactName: Release
I am looking into Azure Devops Artifacts, and from what I understand, we can create feeds to store those published build artifacts?
From my understanding, those kind of build artifacts my pipeline publishes are considered "Universal Packages"? and If so, I would have to add a Universal Package task like so in order for the build artifact (e.g. Release) to be stored in the Artifacts feed?
- task: UniversalPackages@0
displayName: 'Universal publish'
inputs:
command: publish
vstsFeedPublish: 'feedname'
vstsFeedPackagePublish: test
versionOption: custom
versionPublish: 1.1.0
I had already gone ahead and created a feed, do I just wait for next time I run a pipeline for a Release artifact to show up in the feed? or do I have to add "upstream sources" first? If upstream sources is a required step, I selected "Azure Artifacts feed in this organization" as the upstream source type and then when going over the configuration setting, for some reason, it's complaining that "This feed has no available views to be used as an upstream source" despite defined views as shown here:
Upvotes: 1
Views: 2168
Reputation: 35574
Based on your requirement, you can use feed to store Build artifacts.
From my understanding, those kind of build artifacts my pipeline publishes are considered "Universal Packages"?
Your understanding is correct. You can use Universal Package Publish task to upload the build artifacts to Azure Feed.
Do i just wait for next time I run a pipeline for a Release artifact to show up in the feed? or do i have to add "upstream sources" first?
You don't need to add upstream sources for the feed.
To publish the Universal Package, you can directly use Universal Package Publish task in Pipeline.
For example:
- task: UniversalPackages@0
displayName: 'Universal publish'
inputs:
command: publish
vstsFeedPublish: 'name'
vstsFeedPackagePublish: kevintest
Result:
To use the published Universal Package, you can directly use Universal Package download task.
For example:
- task: UniversalPackages@0
displayName: 'Universal download'
inputs:
command: download
vstsFeed: 'name'
vstsFeedPackage: 'name'
vstsPackageVersion: 0.0.1
Upvotes: 2