Home > OS >  Using files in an Azure Dev Ops Pipeline
Using files in an Azure Dev Ops Pipeline

Time:03-04

Just a bit of advice really, What other process can i use to store a JAR file that is being used in a pipeline ? I dont want to store it in a Repo. I was looking at using 'secure files within the library' and then use YAML to get the files down - although there is a 10mb limit on these files.

Looking for a place to store these java JAR files for use within Azure Pipelines and also how would i get hold of them within YAML.

using secure file seems quite simple , although there is a size issue. Also the solution does not need to be secure really.

Using secure files is simple yaml - like below :

- task: DownloadSecureFile@1
  name: caCertificate
  displayName: 'Download CA certificate'
  inputs:
    secureFile: 'myCACertificate.pem'

- script: |
    echo Installing $(caCertificate.secureFilePath) to the trusted CA directory...
    sudo chown root:root $(caCertificate.secureFilePath)
    sudo chmod a r $(caCertificate.secureFilePath)
    sudo ln -s -t /etc/ssl/certs/ $(caCertificate.secureFilePath)

CodePudding user response:

You could use Azure storage account to store your files, please get start from Create a storage account.

Then, use Azure File Copy task to copy files to Azure storage blobs when run on Windows agents. Or you can run the az storage blob upload command as below in Azure CLI task when running on Linux, macOS, or Windows operating systems to upload files to a storage blob.

- task: AzureCLI@2
  inputs:
    azureSubscription: 'My subscription'
    scriptType: 'pscore'
    scriptLocation: 'inlineScript'
    inlineScript: 'az storage blob upload --account-name MyStorageAccount --account-key 0000-0000 -f Path/* -c MyContainer -n NewBlob'

To use this file, you could download it to your target directory by using Azure CLI task with command az storage blob download.

- task: AzureCLI@2
  inputs:
    azureSubscription: 'My subscription'
    scriptType: 'pscore'
    scriptLocation: 'inlineScript'
    inlineScript: 'az storage blob download --account-name MyStorageAccount --account-key 0000-0000 --container-name MyContainer --file Path/to/file --name MyBlob'
  • Related