What is the relationship between Environment and Parameters in Jenkinsfile Parameterized Builds?

前端 未结 1 1121
感动是毒
感动是毒 2021-02-08 01:57

I recently ran into something of a puzzler while working on some Jenkins builds with a coworker. He\'s been using params.VARIABLE and env.VARIABLE int

1条回答
  •  暖寄归人
    2021-02-08 02:45

    Basically this works as follows

    • env contains all environment variables
    • Jenkins pipeline automatically creates a global variable for each environment variable
    • params contains all build parameters
    • Jenkins also automatically creates an environment variable for each build parameter (and as a consequence of second point a global variable).

    Environment variables can be overridden or unset but params is an immutable Map and cannot be changed. Best practice is to always use params when you need to get a build parameter.

    0 讨论(0)
提交回复
热议问题