In this tutorial I will show you how to execute task scripts and using task inputs to have the ability to pass data to concourse for processing.
For my other content on concourse, have a look at the concourse category.
First, let’s run a task on concourse that does not rely on any inputs.
1 2 3 4 5 6 7 8 9
Running execute with the configuration from above:
1 2 3 4 5 6 7
As you can see we have executed the command
uname -a on one of the containers in Concourse.
Tasks Inputs: Specify Path
Now lets say, we have data that needs to be transferred to the container where we are running our tasks. For that we are using inputs.
In this example, we will set the input parameter in our task definition, and override the path with the cli. We will create a couple of files in a folder, then list them in the container where the task is running.
Creating the data:
Our task definition:
1 2 3 4 5 6 7 8 9 10 11 12
As you can see our input name is called
my-input and we will use the cli to map the local folder
my-data-folder to the parameter name:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
As you can see from the above output, the folder was uploaded and placed inside the container where we ran our task.
Task Inputs: Parent Directory
Then we can use parent directories. Running a task that relies on the input path which will be our current working directory. Note: the input name should be the same as the current working directory
The input name will be the only thing that differs, which will look like:
Running the task:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
The source code for this can be found at https://github.com/ruanbekker/concourse-tutorial/tree/master/02-task-inputs
In conjunction with inputs, we can let our task configuration reference a script that we want to execute, and using inputs, we can upload the current working directory to concourse, so then the container has context about the data that it needs.
Our task configuration
1 2 3 4 5 6 7 8 9 10 11
Our executable script
1 2 3 4
Make sure to apply the executable permissions to the script:
With this configuration, it uploads the current working directory to concourse, and the data inside the directory gets placed on the container’s working directory: 03-task-scripts, which is the name of the input.
1 2 3 4 5 6 7 8
The source code for this example can be found at https://github.com/ruanbekker/concourse-tutorial/tree/master/03-task-scripts
That’s it for Task Inputs and Task Scripts on Concourse, please feel free to have a look at my other content about Concourse
Please feel free to show support by, sharing this post, making a donation, subscribing or reach out to me if you want me to demo and write up on any specific tech topic.