getporter / porter

Porter enables you to package your application artifact, client tools, configuration and deployment logic together as an installer that you can distribute, and install with a single command.
https://porter.sh
Apache License 2.0
1.23k stars 203 forks source link

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

Open carolynvs opened 5 years ago

carolynvs commented 5 years ago

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) }}"
ferantivero commented 4 years ago

@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.