'Argo Workflows: Set container image from enviroment variables

I'm trying to set the container image for a template from environment variables. I've tried this:

- name: sftp-to-gcp-bucket
    script:
      image: "gcr.io/{{$CONTAINER}}/imagename:{{$VERSION}}"
      ...
      ...
      env:
      - name: CONTAINER
        valueFrom:
        secretKeyRef:
          name: enviroment-vars
          key: contenedor
      - name: VERSION
        valueFrom:
        secretKeyRef:
          name: enviroment-vars
          key: version

And I have the k8s secrets set correctly:

Name:         enviroment-vars
Namespace:    argo
Labels:       <none>
Annotations:  <none>

Type:  Opaque

Data
====
container:                  17 bytes
version:                    5 bytes

But the env variables doesn't seem to get injected into the image field... Do I have to make another template to parse the secrets and from that output inject them into the image?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source