gitazure-devopsazure-pipelines

Azure Artifacts Feed instead of cloning repository


I thinking how to optimize the process of cloning the repository which consist of the tarballs, which in turn are huge so downloading them is time-consuming. From time to time it throws errors during the downloading using the git clone (even with --depth flag) or simply throwing timed-out message. Would be the beneficial to decrease time of downloading using the Azure Artifacts Feed where I would manually put that tarball first, and do something like that in pipeline?

steps:
- task: DownloadPackage@1
  inputs:
    feed: 'MyFeed'
    package: 'Coinn-package'
    version: '9.3'
    path: '$(Build.ArtifactStagingDirectory)/Inventory'

First of all I am not sure if it is a dedicated to tarball files, according to the documentation it covers rather other types of files like Python or Maven etc. Second, I am not sure if my tarballs are not too big, they weight even 1GB. And the last one, if it is a good approach using Azure Artifacts Feed for that.


Solution

  • Yes, you can use Azure Artifacts Feed instead of cloning repository.

    I would suggest you use the Universal Packages type. Universal Packages can handle large files up to 4 TB. Unlike other package types, Universal Packages support various file types. Universal Packages are primarily designed for use within Azure DevOps Services. They're fully integrated with Azure DevOps Services.

    At the same time, you should know that depending on the size and number of packages, storage costs can add up. Azure Artifacts provides 2 GiB of free storage for each organization.

    Steps to Publish and Download Universal Packages:

    1. Publish the Universal Package:

      - task: UniversalPackages@0
        displayName: Publish a Universal Package
        inputs:
          command: publish
          publishDirectory: '$(Build.ArtifactStagingDirectory)'
          vstsFeedPublish: '<projectName>/<feedName>'
          vstsFeedPackagePublish: '<Package name>'
          packagePublishDescription: '<Package description>'
      
    2. Download the Universal Package:

      - task: UniversalPackages@0
        displayName: Download a Universal Package
        inputs:
          command: download
          vstsFeed: '<projectName>/<feedName>'
          vstsFeedPackage: '<packageName>'
          vstsPackageVersion: '<packageVersion>'
          downloadDirectory: '$(Build.SourcesDirectory)\\someFolder'
      

    Or you can use Azure CLI command to Publish and Download Universal Packages.

    az artifacts universal publish --organization https://dev.azure.com/<YOUR_ORGANIZATION> --project <PROJECT_NAME> --scope project --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <PACKAGE_DIRECTORY> --description <PACKAGE_DESCRIPTION>
    
    az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION_NAME> --project <PROJECT_NAME> --scope project --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <DOWNLOAD_PATH>