My concourse task is something like this:
name: test
plan:
- get: my-repo
- task: my-task
config:
inputs:
- name: my-repo
run:
path: sh
args: [my-repo/examples/run-this.sh]
And the shell script tries to fetch a file in so manner:
CONFIG_FILE=./$name.cfg
When I run the task, concourse throws this error
my-repo/examples/run-this.sh: line xx: can't open name.cfg: no such file
The location of the run-this.sh and name.cfg file are the same. Any pointers will be appreciated!
Even though the two files share the same directory, the dot in
./name.cfg
uses current working directory as a reference point - so it's the directory from which the script is called, not the directory in which the script is stored.The best option to get this to work seems to be to add some intelligence to
run-this.sh
to locate thename.cfg
file based on its own relative location, like this: