How can I execute a Concourse task script from another resource's directory?

703 views Asked by At

Having this task configuration:

config:
  platform: linux
  inputs:
    - name: resource_to_run_in
    - name: resource_with_scripts
  run:
    path: resource_with_scripts/script.sh
    dir: resource_to_run_in

I get the following error:

Backend error: Exit status: 500, message: {"Type":"ExecutableNotFoundError","Message":"exec failed: container_linux.go:344: starting container process caused \"exec: \\\"resource_with_scripts/script.sh\\\": stat resource_with_scripts/script.sh: no such file or directory\"\n","Handle":"","ProcessID":"","Binary":""}

I was expecting Concourse to run the absolute path of script.sh in the directory of the resource resource_to_run_in.

How can I achieve this?

1

There are 1 answers

0
Gabriel Petrovay On

The only way I found is to use dot-navigation:

config:
  platform: linux
  inputs:
    - name: resource_to_run_in
    - name: resource_with_scripts
  run:
    path: ../resource_with_scripts/script.sh
    dir: resource_to_run_in

This way it works, still I wish Concourse would resolve these resource names to absolute paths at runtime (without displaying them to the user)