0

I've wrote a script to create a job in jenkins, next in that script I want to get environment variables and set them.

So I want to use "envInject" plugin in my script, but I don't know how can I call or bring it to my python script?

Any help is appreciated. Thanks

1 Answer 1

1

In Python env variables can be accessed through os.environ

import os
print os.environ['BUILD_NUMBER']

see your jenkins_site/jenkins/env-vars.html for more info on build vars available

Sign up to request clarification or add additional context in comments.

3 Comments

what do you mean about "build number" ?
build_number is environment variable that is available within jenkins node upon build execution and contains build number.
How can I use "envInject" plugin with it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.