I’ve setup one pipeline in azure devops to build container image, push to ACR and deploy to container app with environment variables.
Below is script which i was trying, but gives error.
trigger: none
resources:
- repo: self
variables:
dockerRegistryServiceConnection: 'dockerRegistryServiceConnection'
imageRepository: 'imageRepository'
containerRegistry: 'containerRegistry'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'
group: DevAppSettings
# 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: |
$(tag)
- stage: Deploy
displayName: Deploy to Azure Container Apps
jobs:
- job: Deploy
displayName: Deploy
pool:
vmImage: $(vmImageName)
steps:
- task: AzureCLI@2
displayName: Deploy to Azure Container Apps
inputs:
azureSubscription: 'azureSubscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
envVars=""
for var in $(printenv | cut -d'=' -f1); do
value=${!var}
envVars+=" $var='$value' "
done
az containerapp update
--name pomaster-api-dev
--resource-group POMaster-resource-group
--image pomasterdev.azurecr.io/pomaster:$(Build.BuildId)
--env-vars $envVars
below error i got from pipeline
ERROR: unrecognized arguments: –env-vars
What’s wrong here? Please help!
I am expecting to deploy container image with all variables defined in variable group as environment variables.