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

Environment Variables #19

Closed
otaviof opened this issue Jul 10, 2023 · 2 comments
Closed

Environment Variables #19

otaviof opened this issue Jul 10, 2023 · 2 comments
Labels
enhancement New feature or request s2i Source-to-Image

Comments

@otaviof
Copy link
Contributor

otaviof commented Jul 10, 2023

The s2i build workflow supports setting environment variables:

$ s2i build --help |grep env
  -e, --env string                       Specify an single environment variable in NAME=VALUE format
  -E, --environment-file string          Specify the path to the file with environment

S2I Tasks rendered by this project should leverage the setting, like for instance on task-buildpacks repository ENV_VARS param.

A practical approach is receiving the params via STDIN and loop over the key-value pairs:

steps:
  - name: example
    args: [ "$(params.ENV_VARS[*])" ]

Then, on s2i-generate.sh script can loop over the arguments to store on a file, for instance:

for kv in "${@}"; do
    # ...
done

The set of key-value should be stored on a temporary location (/s2i-generate/s2i.env?), informed to s2i using --environment-file flag.

@otaviof otaviof added the enhancement New feature or request label Jul 10, 2023
@otaviof otaviof changed the title S2I's Environment Variables [S2I] Environment Variables Jul 11, 2023
@otaviof otaviof added the s2i Source-to-Image label Jul 11, 2023
@otaviof otaviof changed the title [S2I] Environment Variables Environment Variables Jul 11, 2023
@otaviof
Copy link
Contributor Author

otaviof commented Jul 11, 2023

Example type array param:

- name: ENV_VARS
  type: array
  description: List of environment variables...
  default: []

@Aneesh-M-Bhat
Copy link
Contributor

I tried it with the array type and there was an issue related to tekton, so i've given it go using a comma-separated string which will then be looped over and used, PTAL, since this was needed for s2i-dotnet, i have clubed both of them together, and you can take a look at the PR: #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request s2i Source-to-Image
Projects
None yet
Development

No branches or pull requests

2 participants