On Fri, May 9, 2025 at 4:33 AM Michael Peddie michael.peddie@gallagher.com wrote:
Hi, I am trying to make use of environment variables defined on my lava-server inside interactive tests.
tests run on the worker (dispatcher) not on a server unless it's the same machine. Could you share more details on how you define the variables?
I have had some success with this, but I am not sure why one method works over the other. For example, I do something like the following: echo 'wget --user=some-name --password=${SECRET_PASSWORD}' > somefile.sh
for downloading the easiest is to use artifact tokens that are defined in your user profile. This can be used in the download stage of deployment. It might not be what you're attempting, but I'm just pointing out it's there and it's very convenient:
- deploy: images: image: headers: Authentication: ARTIFACT_TOKEN url: http://example.com/my_file
And that works just fine. But when I already have a script (say it exists on the DUT already) that just takes it as a parameter, it doesn't work. Example: some_script.sh -p ${SECRET_PASSWORD} -u some-name
scripts in the test shell are executed in the context of the shell. Variables in this shell are defined in the job definition or test definition https://github.com/Linaro/test-definitions/blob/master/automated/linux/wlan-...
These parameters become env variables for the script that executes the test.
I have also tried accessing it directly in the script, similar to what somefile.sh would look like on the inside, but had no success with that. I have tried exporting the environment variable as another one to see if that would work, but to no avail.
Is there something I'm missing? What I can I do to achieve this without hardcoding it anywhere in my scripts?
I'm missing the detail how you define the variable. Please share that and we can try to figure out the solution.
Best Regards, Milosz