Pipeline template array variable

We have many microservices written with PHP/Symfony. The pipeline for most of them looks like:

  1. build the image
  2. prepare the image for testing(install phpunit, etc)
    3…7. Run some tests in parallel(steps may differ between microservice)
  3. push the image to registry

I want to know if there is any possibility to create steps from 3-7 dinamically from a list of {name, command} using pipeline templates?
I am thinking at something like:

kind: template
load: plugin.yaml
data:
  name: name
  image: image
  testSteps:
    - name: unit
      commmand: "phpunit --filter Unit"
    - name: security
      command: "bin/console symfony:security-check"
    ...

Hey @beniamin

At the minute there’s no support for the above.

Cheers,
Eoin

@Eoin_Mcafee looping through arrays is supported by the Go template engine. Would the below template work with the sample that beniamin provided?

kind: pipeline
type: docker
name: default

steps:
{{range .input.testSteps}}
  - name: {{.name}}
    image: php
    commands:
    - {{.command}}
{{end}}

  - name: publish
    image: plugins/docker
    settings:
      repo: {{ .input.image }}

@bradrydzewski your example seems to work.
Is there any way to “print” the compiled(final) pipeline?

@beniamin this feature does not currently exist. We brainstormed adding a CLI command and API endpoint to generate yaml files from templates, for testing purposes. This is definitely something we are interested in, but not something we are actively working on.