java - Jenkins: Export environment variables from a class extending SimpleBuildWrapper -


i have jenkins plugin wrote source environment variables secrets in hashicorp vault.

for part works way expect, except when expect shell command aware of environment variables set. setting environment variables in overridden setup method of simplebuildwrapper class.

here relevant snippet of how setting environment variables:

for (vaultsecretvalue value : vaultsecret.getsecretvalues()) {   context.env(value.getenvvar(), values.get(value.getvaultkey())); } 

if add build step echo environment variable returns expected output, however, if use external command in build step expects variable set there appears issues, aws cli:

aws --region us-east-1 ec2 describe-instances 

if take same environment variable values , export them in local terminal result of above command expect.

my question is, when extending simplebuildwrapper, there step i'm missing ensure environment variables exported each subsequent shell command?

please let me know if can provide more information.

update

i have checked output of /usr/bin/env , environment variables set. think may issue of how implementing calls vault self may issue. update question accordingly either answer or more relevant information.

is there step i'm missing ensure environment variables exported each subsequent shell command?

no. there test coverage , works.

you can run /usr/bin/env before aws … see sure getting set , narrow down problem.


Comments