CI/CD components - access file content within the component

Hello,

I have a component with the following directory structure:

├── LICENSE.md
├── README.md
└── templates
    └── lint
        ├── configuration.yaml
        └── template.yml

Inside my template.yml, I am calling a cli that supports passing a configuration file. It’s neat because it would let me create a component without the need of exposing all of the flags the tool support in spec:inputs part of the component.

For instance:

spec:
  inputs:
    job-prefix:
      description: "Define a prefix for the job name"
    job-stage:
      default: test
    configuration_file:
      default: configuration.yaml
---
"$[[ inputs.job-prefix ]]-hadolint":
  stage: $[[ inputs.job-stage ]]
  image:
    name: "registry.hub.docker.com/hadolint/hadolint:latest-alpine"
    entrypoint: [""]
  script:
    - hadolint -c $[[ inputs.configuration_file ]] Containerfile

When calling the component, it seems that the file configuration.yaml is not available to the pipeline that calls it. I may have been misguided by the doc here

Is it possible to do something like this?

EDIT: it seems some people also have the same question on Reddit

FYI, discussion continues in CI/CD Catalog: Feedback issue about inputs, components and catalog (#407556) · Issues · GitLab.org / GitLab · GitLab

1 Like