46,186 questions
How to use env file in pipeline
Yauheni Kisialiou
20
Reputation points
if some one could help with the problem of .env file in azure pipeline. I saved my .env file in "Secret files" and the pipeline part regarding the Maven goal execution looks like this:
- task: DownloadSecureFile@1
inputs:
secureFile: '.env'
- task: CopyFiles@2
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: '**\.env'
TargetFolder: $(Build.SourcesDirectory)
cleanTargetFolder: false
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '17'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'verify'
The DownloadSecureFile@1 and CopyFiles@2 works fine:
found 1 files
Copying /home/vsts/work/_temp/.env to /home/vsts/work/1/s/.env
But the goal fails, it looks like .env file is not picked up or not seen... If I hardcode variables in the application.yaml and thus avoid using .env then everything works fine...
Community Center Not monitored
Sign in to answer