I have defined the following job template:
parameters:
- name: prefix
type: string
- name: apps
type: object
- name: containerRegistry
type: string
jobs:
job: Build Docker Images
displayName: Build and Push image
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
- ${{ each app in parameters.apps }}:
- task: Docker@2
displayName: Build and Push image
inputs:
containerRegistry: $(containerRegistry)
repository: ${{ parameters.prefix }}/${{ app }}
Dockerfile: apps/${{ app }}/Dockerfile
tags: $(Build.BuildNumber)
buildContext: $(Build.Repository.LocalPath)
which allows to easily build and push the docker images for the specified apps. I now need to pass the image names to the helm deploy tasks overrideValues parameter. However that parameter expects a string formatted as name=value,name=value
. Is there a way to build this expression from the array? Eg something like
apps: ['hello', 'world']
prefix: 'app'
overrideValues: ${{ join(',', [$(app).image=$(prefix)/$(app) foreach app in apps]) }}