Philipp Honsel
Philipp Honsel

Reputation: 182

Download a secure file to repo code in Azure Devops Pipelines

I am creating a Pipeline to automatically build and release a flutter app. On my machine the flutter build appbundle --release works just fine and also signs the app correctly. I reference a key and a properties file, which I both don't want to upload into the repo, but instead use the Library > Secure Files.

How can I either download these files onto my Agent to a specific position, or use the downloaded file path in my build.gradle?

Upvotes: 8

Views: 15509

Answers (2)

Richard H.
Richard H.

Reputation: 1

MS Documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/download-secure-file-v1?view=azure-pipelines&viewFallbackFrom=azure-devops

     - task: DownloadSecureFile@1
        name: gradlePropertyOverrides
        inputs:
          secureFile: 'filename.filenameExtension'

     - task: Gradle@2
        inputs:
          gradleWrapperFile: 'gradlew'
          options: -PpropertyOverridePath=$(gradlePropertyOverrides.secureFilePath) 

Upvotes: -1

iabhee
iabhee

Reputation: 610

You can utilize "Download Secure File task" to download from the library on to your agent.

reference: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-secure-file?view=azure-devops

https://learn.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops

- task: DownloadSecureFile@1
  inputs:
    secureFile: 'secureFile'

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Agent.TempDirectory)'
    Contents: secureFile
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

Upvotes: 16

Related Questions