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

Pass environment variables to k6 arguments #162

Open
yorugac opened this issue Nov 2, 2022 · 0 comments
Open

Pass environment variables to k6 arguments #162

yorugac opened this issue Nov 2, 2022 · 0 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@yorugac
Copy link
Collaborator

yorugac commented Nov 2, 2022

Feature Description

At the moment, to pass environment variable as part of arguments string in k6-operator, one has to use external tooling, scripts, etc.
Kubernetes supports passing environment variables as argument for pods with specific format. Its equivalent in k6 CRD would be something like this:

arguments: --tag pod="$(HOSTNAME)"
runner:
  env:
      - name: HOSTNAME
        value: ...

Attempt to use the above snippet results in k6 error due to escaped double quotes in --tag option:

time="2022-10-31T14:16:36Z" level=error msg="invalid argument \"pod=\\\"bar\\\"\" for \"--tag\" flag: parse error on line 1, column 5: bare \" in non-quoted-field"

Find solution to pass environment variables in arguments of k6 CRD.

Suggested Solution (optional)

Adding support for passing environment variables in the above format would mean parsing arguments string in full and removing unnecessary escapes for --tag.
Alternatively, establish another approach to pass environment variables to arguments in k6-operator.

Already existing or connected issues / PRs (optional)

This came up in forum question: https://community.k6.io/t/k6-operator-pass-local-environment-variable-as-test-wide-tag/5015

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

No branches or pull requests

1 participant