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:
stages:
- get_versions
- retag
include: 'variables.yaml'
default:
tags:
- docker
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
get_versions:
stage: get_versions
script:
- pwd
- ls -la
- bash ./populate-versions.sh
artifacts:
untracked: true
retag:
dependencies:
- get_versions
stage: retag
script:
- ls -la
- pwd
- cat versions.yaml
- bash ./pullandretag.sh ${SERVICE} ${DEPLOY_ENVIRONMENT} ${VERSION}
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).
Versions
Please select whether options apply, and add the version information.
- GitLab.com SaaS