How to pass output of task to put?


For example:


- name: jenkins-integration-demo
  - get: trigger-concourse
    trigger: true

  - task: show-new-build
      platform: linux
        type: docker-image
        source: {repository: busybox}
      - name: trigger-concourse

  - put: triggered-by-concourse
      buildParams: msg=Triggered-by-concourse

In this job, I do a task, then do a put. Now I want to take some info and use the info as buildParams for put, how to archive that?


Hello, I see you are learning Concourse, welcome!. You will go faster if you start with a tutorial:

This will allow you to understand Concourse, instead of going from one roadblock to another :slight_smile:


I have done the tutorial. I learned how to pass data from a task to next task. But I haven’t seen how to pass data from task to put. Also I don’t see how to pass data from a job to next job.


Are you sure you’ve done the whole tutorial? This part specifically answers your question :wink:

Its essentially the same as passing data from task to task. All outputs of previous tasks are implicitly mounted to put containers.

The only way to pass data from job to job is by putting/getting to/from resources. This part of the tutorial covers it.


Yes, I have done both of them. The tutorial shows how to pass data via files. But my question is how to pass data via like variables. For example, with my sample in the question, say the task generates a message, e.g. “message generated by task 1”, and I want to pass the message to buildParams of put. Is it possible?

From the tutorial, looks like Concourse can like only copy a task’s output files to following task’s input folder, is that true?


No. You can’t pass variables between steps in a job. The way I usually get around that is to write the variables into a file, passing that along, then sourcing the file at the start of the next task. For passing them to a put I don’t think it’s possible.