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

Allow passing custom environment variables through sdk #409

Closed
SassNinja opened this issue Jan 24, 2023 · 2 comments
Closed

Allow passing custom environment variables through sdk #409

SassNinja opened this issue Jan 24, 2023 · 2 comments

Comments

@SassNinja
Copy link

What is the problem you are trying to solve by the feature?

Our pipelines build the frontend assets (yves) at multiple stages

  1. for acceptance tests (using "docker/sdk up")
  2. for deployment in cluster (using "docker/sdk export images")

I need to extend the frontend build process (webpack) so that it executes certain code (upload source maps to sentry) only if it's at a specific stage in our gitlab pipeline. My first idea was to define some env vars in the gitlab-ci.yml and access it through process.env. Unfortunately this doesn't work because the frontend build process lives in the docker/sdk and I can't pass custom env vars to it.

What is the solution do you propose?

There are two possible solutions

  1. allow passing through custom environment variables to the underlying call of the frontend build process
  2. provide information about the executed command (e.g. as env var) so that I know within the build process whether it has been triggered by "docker/sdk up" or by "docker/sdk export images"

While I doubt the former solution is already implemented (at least I couldn't find anything that looks promising), I'm still hoping the latter approach is somewhere hidden. Anyway I'd appreciate any hint how my problem could be solved.

What changes in deploy.yml format do you propose?

no idea

What changes in command line interface do you propose?

no idea either – maybe support of passing through custom env vars when calling "docker/sdk export images"

What alternatives have you considered?

I've thought about modifying the sdk though this is no real solution regarding the maintenance effort to keep it up-to-date.

@alexanderM91
Copy link
Collaborator

Hi @SassNinja,
I am not fully sure that I got your request but as an assumption you can:

  • Provide necessary environment variables via deployment file via
image:
    tag: spryker/php:8.1
   ...
    environment:
        ENVIRONMENT_VAR_VALUE: 'env_var_value'
  • Extend npm command on the application level with necessary environment variables like npm run yves --env-var=value.
  • Access it in the necessary frontend related process via process.env.env-var.

Thank you.

@alexanderM91
Copy link
Collaborator

Hi,
I am going to close an issue.
Let's reopen it in case of necessity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants