0

Do you guys know a way to split nested parameters such as "myubuntu:1" into $image and $tag so i can pass it on my yaml templates?

parameters:
- name: base_images
  type: object
  default:
    public:
      amazon1: "amazonlinux:1"
      amazon2: "amazonlinux:2"
    private:
      ubuntu1: "myubuntu:1.2"
      ubuntu2: "myubuntu:2.0"

steps:
- ${{ each version in parameters.base_images.public }}:
  - template: <path to my template>...
      parameters:
        image_type: ${{ value }}   # public
        image_name: ${{ value }}   # amazonlinux
        image_tag: ${{ value }}    # 1

i tried several methods on splitting the value but none of them works and im running out of ideas.

PANDA MAN
  • 172
  • 1
  • 16
  • Does this answer your question? [How to pass complex DevOps pipeline template parameter to script](https://stackoverflow.com/questions/59972329/how-to-pass-complex-devops-pipeline-template-parameter-to-script) – Ecstasy May 27 '22 at 09:26
  • 1
    @DeepDave-MT actually i end up using powershell script $image_name,$image_tag = "".split(":") echo "##vso[task.setvariable variable=image_name;]$image_name" echo "##vso[task.setvariable variable=image_tag;]$image_tag" – PANDA MAN May 30 '22 at 05:33

0 Answers0