Conditional variables in pipeline

Problem to solve

I’m trying to create a pipeline which will:

Log into ECR, and pull a list of docker tags and then
Allow me to select a tag from above and run a script using the tags

Step 1 in my pipeline logs in and gets all of the tags and writes them to a file
I can’t figure out how to use that file as an options input to the next stage of the pipeline.

My code currently looks like:

  - get_versions
  - retag

include: 'variables.yaml'

    - docker

  stage: get_versions
    - pwd
    - ls -la
    - bash ./  
    untracked: true

    - get_versions 
  stage: retag
    - ls -la
    - pwd
    - cat versions.yaml

variables.yaml contains a few ENV variables with options which allow me to select an ECR from a populated drop down. This is done outside the pipeline.

Is it possible to add an options variable to a 2nd or 3rd stage in a pipeline, or is this only possible at the initial stage of pipeline execution? It seems possible if you add:

when: manual

but that only lets you specify stuff by typing it in rather than selecting.

Alternatively, what would be ideal is if I could have 2 options in the initial step the first, the ECR repo, would cause the second, the tag to be populated (even if I had to do all the work up front and provide all the info in files rather than dynamically).


Please select whether options apply, and add the version information.