cf-resource icon indicating copy to clipboard operation
cf-resource copied to clipboard

vars_files can never be resolved to paths that work

Open ShoryuKyzan opened this issue 5 years ago • 3 comments

Concourse 5.5.1 vars_files can never be resolved to paths that work.

... inside resources

  - name: development
    type: cf
    source:
      api: ...
      username: ...
      password: ...
      organization: ...
      space: ...

... inside tasks of the pipeline

      - put: development
        inputs: [put]
        params:
          manifest: put/manifest.yml
          vars_files:
            - put/<path to file>

Always fails with vars file file not found from the cf push command. Incorrect Usage: The specified path 'put/sreteam.yml' does not exist. And the file does exist, as checked by prior steps.

I have seen other versions of this with the magic directory /tmp/build/put/. Perhaps that is for older versions of concourse? I assume that is working for whoever wrote it but when I try it /tmp/build/put/ seems to be some kind of magic directory I can't carry over as an output from other tasks. The build working directory seems to be at /tmp/build/. When I copy things into /tmp/build/put the file is still not found. When you have just the filename in the vars_files input it will say /tmp/build/put/ is not found either.

It would seem that the working directory of the cf push command isn't /tmp/build/ in that container but something else. I note that os.Args[1] is concatenated to the manifest file path in main.go. Theres no problem finding the manifest file.

Workaround:

After reading some code I found that if I define path parameter, now vars file will be relative to that folder because it will chdir into it first before running the command.

ShoryuKyzan avatar Sep 25 '19 16:09 ShoryuKyzan

We're having the same issue. @ShoryuKyzan can you explain your workaround in more detail?

mamachanko avatar Oct 16 '19 07:10 mamachanko

Bit late but incase this helps someone, just put the path to the vars files relative to the path parameter like:

- put: cf
  params:
    path: first-input-directory
    manifest: first-input-directory/manfiest.yml
    vars_files:
      - ../second-input-directory/vars.yml

danworth avatar Jan 24 '20 10:01 danworth

facing issue 'Expected to find variables' error even after defining vars_files with relative to path And all the parameters defined in vars file matches with manifest's, no issue with parameters definition

sainath19 avatar Mar 11 '20 18:03 sainath19