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 global environment variables from .jervis.yml file to pipeline_jenkinsfile #126

Open
tairov opened this issue May 8, 2018 · 5 comments

Comments

@tairov
Copy link

tairov commented May 8, 2018

I need to pass some variable from .jervis.yml to Jenkinsfile, but can't figure out how to do that.
I was trying to set variable in env section:

env:
  - MY_VAR=xyz

But can't access that variable in Jenkinsfile

def MY_VAR = env.MY_VAR ?: 'default'
sh "echo $MY_VAR"

Each time it shows default

@samrocketman
Copy link
Owner

At this time, it's not designed that way. I have that planned for secrets (ref #103) but haven't really thought about environment variables.

One of the challenges being that env is supported in matrix builds. I suppose I could allow:

env:
  global:
    - MY_VAR=xyz

From the environment matrix to pass variables. More research would be required to support something like this.

@samrocketman samrocketman changed the title Is there any option to pass some environment variable from .jervis.yml file to pipeline_jenkinsfile? Pass global environment variables from .jervis.yml file to pipeline_jenkinsfile May 8, 2018
@samrocketman
Copy link
Owner

I’ve been using this in production for several years and I plan to implement support for it through #144. This would be launching a shell and getting the same toolchain environment in a Jenkinsfile.

@samrocketman samrocketman added this to the jervis-2.2 milestone Jun 30, 2023
@tairov
Copy link
Author

tairov commented Aug 30, 2023

Hi @samrocketman , by any chance is this feature implemented ? :) do you need help with this?

@samrocketman
Copy link
Owner

@tairov you're welcome to try if you want. My current focus is multiplatform support with the 2.1 release.

@samrocketman
Copy link
Owner

I will plan to do this for 2.2 release

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

No branches or pull requests

2 participants