porter icon indicating copy to clipboard operation
porter copied to clipboard

Make it easier to reference/drop credentials into the bundle directory

Open carolynvs opened this issue 6 years ago • 1 comments

Instead of forcing people to code in the path where their bundle is placed inside the cnab environment, we should have a bundle-dir template variable, just like we do in the Dockerfile.

So that instead of having to copy credentials into my bundle directory like this:

credentials:
  - name: gcloud-key-file
    path: /cnab/app/gcloud.json

I could do this:

credentials:
  - name: gcloud-key-file
    path: "{{ porter.bundle-dir}}/gcloud.json"

Alternatively, maybe just using a relative path for the destination should drop it into /cnab/app?

credentials:
  - name: gcloud-key-file
    path: gcloud.json

So when porter processes the paths for parameters and credentials, it would convert relative paths to absolute paths under the bundle directory? 🤔

When they reference the file later in their bundle it would look like this:

install:
  - gcloud:
      description: "Authenticate"
      groups:
        - auth
      command: activate-service-account
      flags:
        key-file: gcloud.json

Or later when we have template functions and they need the absolute path:

install:
  - gcloud:
      description: "Authenticate"
      groups:
        - auth
      command: activate-service-account
      flags:
        key-file: "{{ porter.path(bundle.credentials.gcloud-key-file) }}"

carolynvs avatar Aug 05 '19 15:08 carolynvs

@carolynvs also based on my understanding, when generating the creds provided you specified an absolute path that happens to exist in both your host machine and the container it will work even without copying them (e.g /root/.ssh/id_rsa.pub).

Please let me know if you want me to open another issue, in case you confirm I'm correct about it and consider it's an actual issue.

ferantivero avatar Mar 11 '20 13:03 ferantivero