6

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}}).

Max Romanovsky
  • 2,824
  • 5
  • 30
  • 37
  • This is soon to come. It has been merged into `Master` on the Concourse GitHub repo. See > https://github.com/concourse/concourse/issues/454 ... – Lars Bingchong Jan 08 '19 at 10:21

1 Answers1

2

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.

Maria S
  • 184
  • 1
  • 4
  • 2
    I've meant something entirely different: I want to parameterize `task.yml` file itself (for example, `input: {{input_name}}`) – Max Romanovsky May 25 '17 at 19:20
  • I don't believe that's possible. Only passing params from pipeline as mentioned https://concourse.ci/task-step.html#task-params – codecraig Jun 13 '17 at 14:35