Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porter always resolves file parameters using the value strategy #3349

Open
erikced opened this issue Mar 10, 2025 · 0 comments
Open

Porter always resolves file parameters using the value strategy #3349

erikced opened this issue Mar 10, 2025 · 0 comments
Labels
bug Oops, sorry!

Comments

@erikced
Copy link

erikced commented Mar 10, 2025

Describe the bug

When resolving file parameters, the source strategy (i.e. type) e.g. env, value etc is ignored and porter always assumes that the provided hint is either a path to a file or a base64-encoded string with the file contents.

To Reproduce

Use the following bundle

schemaType: Bundle
schemaVersion: 1.0.1
name: porter-file-param-test
version: 0.1.0
description: "An example Porter configuration"
registry: localhost:5000
mixins: [exec]
parameters:
  - { name: data-file, type: file, path: data-file, applyTo: [install] }
  - { name: data-string, type: string, path: data-string, applyTo: [install] }
install:
  - exec: { description: "Install", command: /usr/bin/bash, arguments: [-c, 'printf "data-file: %s\ndata-string: %s\n" "$(cat data-file)" "$(cat data-string)"'] }
uninstall:
  - exec: { description: "Uninstall", command: /bin/true }

and parameter set

parameters:
  - { name: data-file, source: { env: DATA } }
  - { name: data-string, source: { env: DATA } }
  1. Create example data files: echo this is DATA > DATA && echo this is my-data > my-data
  2. Apply the parameter set porter apply parameters.yaml
  3. Install the bundle DATA=my-data porter install --parameter-set test test
  4. Note that the string data has been resolved to the value of DATA (my-data) whereas the file data has been read from a file with the same name as the environment variable.
❯ DATA='my-data' porter install --parameter-set=test test --force
Just-in-time resolving credentials...
Just-in-time resolving parameters...
executing install action from porter-file-param-test (installation: /test)
Install
data-file: this is DATA
data-string: my-data
execution completed successfully!

Expected behavior

Porter resolves the value using the provided strategy, then checks if it is the path to a local file or base64-encoded data.

Version

porter v1.2.1

@erikced erikced added the bug Oops, sorry! label Mar 10, 2025
@erikced erikced changed the title Porter assumes file parameter should always be resolved using the value strategy Porter always resolves file parameters using the value strategy Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Oops, sorry!
Projects
None yet
Development

No branches or pull requests

1 participant