Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add parameters to the included task files in Concourse CI

Tags:

concourse

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

like image 541
Max Romanovsky Avatar asked Oct 29 '22 08:10

Max Romanovsky


1 Answers

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.

like image 90
Maria S Avatar answered Dec 30 '22 15:12

Maria S