in order to use variables in yml you need to add them to your pipeline > variables:
Pass environmental variables to .yml?
Ingo Speckens
1
Reputation point
Hi community, I tried to add the .env variables but it isn't working. Do I need to pass the variables in the .yml as well? Please help, .yml below.
# .yml
# Docker
# Build and push an image to Azure Container Registry
# https://learn.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: xxx
imageRepository: xxx
containerRegistry: xxx
dockerfilePath: '$(Build.SourcesDirectory)/client/Dockerfile'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(Build.BuildNumber)
latest
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,972 questions
1 answer
Sort by: Most helpful
-
sadomovalex 3,636 Reputation points
2021-06-21T15:07:08.477+00:00