Problem to solve
When using a component, I’d like to use an array input, specifically for the tags used by the runner, and then check for the existence of a tag that should always exist. If that tag does not exist, I’d like to add it,
I’m wondering if it would even be possible. CI/CD Steps seems like it may support this use case as it allows for inputs and outputs. The caveat being I’m not sure if the job would start if the job that calls the steps uses the step output for the tags as its initially missing the required tags? Just wondering if anyone has run into this or has alternate solutions.
Steps are still considered experimental and we would prefer not to use them until they are stable and in less of a state of flux. The goal is just to be able to validate the input array, and append to it if necessary.
Configuration
Below is a small example truncated for brevity. We have a working component, but would like to automate the default tag if possible
The component spec:
spec:
inputs:
build_docs_folder:
description: "The folder containing the generated HTML documentation."
default: "${CI_PROJECT_DIR}/docs/"
... # removed for example
python_image_tag:
description: "Python image tag"
default: 3.11-slim
tags:
default: []
type: array
description: List of tags
The component yaml:
build_docs:
image: python:$[[ inputs.python_image_tag ]]
stage: $[[ inputs.stage ]]
variables:
... # removed for exaple
tags: $[[ inputs.tags ]]
Using the compnent:
include:
component: $COMPONENT_PATH
inputs:
tags: ["tag1", "tag2"]
We would like to be able to check the inputs.tags for the existence of “default_tag” and if it doesn’t exist modify it to be ["default_tag", "tag1", "tag2"]
. Please let me know if you need more information.
Versions
- Self-managed
-
GitLab.com
SaaS - Dedicated
- Self-hosted Runners