Download a secure file to repo code in Azure Devops Pipelines
302
You can utilize "Download Secure File task" to download from the library on to your agent.
https://docs.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)'
Author by
Philipp Honsel
Updated on January 03, 2023Comments
-
Philipp Honsel over 1 year
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 theLibrary > 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
? -
Philipp Honsel about 2 yearsI already found this task, but this task downloads the file somewhere onto my agent machine. But I need it in a specific location, so that I can use this location in my build.gradle
-
Ia1 about 2 yearsYes, the task downloads the file under $(Agent.TempDirectory) on your agent machine and you can use copyFiles task to copy it to your target location which can reference in your properties file.
-
Philipp Honsel about 2 yearsThanks! This did in fact work after I changed the $(Build.ArtifactStagingDirectory) to $(Build.SourcesDirectory), since I need it in relation to my code.
-
Ia1 about 2 yearsOh great. Glad that helped :)