How to add parameters to the included task files in Concourse CI
Asked Answered
H

1

7

If task file (file: task.yml) in pipeline (pipeline.yml) config needs to contain some {{properties}}, what is a proper way to add them?

In my case, I want to use a custom docker image from repository that uses authentication, and I don't want to hardcode/commit credentials in task yml itself.

Is the a way to do that currently without moving task config to the main pipeline yml?

Clarification: I want to parameterize task.yml file itself (for example, input: {{input_name}}).

Holmann answered 22/4, 2017 at 21:19 Comment(1)
This is soon to come. It has been merged into Master on the Concourse GitHub repo. See > github.com/concourse/concourse/issues/454 ...Glandular
B
3

In your task.yml you can specify required params, e.g:

params:
  USERNAME:
  PASSWORD:

And then provide them in pipeline.yml:

jobs:
- name: my-job 
  plan:
  - get: ci-files
  - task: my-task
    file: ci-files/task.yml
    params:
      USERNAME: {{username}}
      PASSWORD: {{password}}

Configure pipeline as:

fly set-pipeline -p pipeline-name -c pipeline.yml -v=USERNAME=my-username -v=PASSWORD=my-password

Then these params will be available to you as environment variables inside your task.

Barefoot answered 25/4, 2017 at 0:59 Comment(2)
I've meant something entirely different: I want to parameterize task.yml file itself (for example, input: {{input_name}})Holmann
I don't believe that's possible. Only passing params from pipeline as mentioned concourse.ci/task-step.html#task-paramsFarci

© 2022 - 2024 — McMap. All rights reserved.