You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How does this cover setting environment variables? For me, it seems like this will only set a parameter/params value, but no env one. Playing around with it seems to be indicate that this might be achieved by using binding.getVariable('env').newValue = 'test', but it might make sense to actually document this as well.
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
The text was updated successfully, but these errors were encountered:
ℹ Also, I was actually looking to add a 'Jenkins global variable' to mock the RUN_DISPLAY_URL Blue Ocean variable, so I added that to the example also.
importcom.lesfurets.jenkins.unit.BasePipelineTestclassTestExampleJobextendsBasePipelineTest {
@Override@BeforeEachvoidsetUp() {
super.setUp()
// Define environment variable
addEnvVar('MY_ENV_VAR', '0')
// Assigns false to a job parameter ENABLE_TEST_STAGE
addParam('ENABLE_TEST_STAGE', 'false')
// Defines the previous execution status
binding.getVariable('currentBuild').previousBuild = [result: 'UNSTABLE']
// Define Jenkins global variable
binding.setVariable('RUN_DISPLAY_URL', 'https://jenkins.io')
}
@TestvoidverifyParam() {
assertEquals('false', binding.getVariable('params')['ENABLE_TEST_STAGE'])
}
}
I can make a pull request with some docs improvements when I have time. I'm loving this project! 😄🙏
Describe your use-case which is not covered by existing documentation.
In the documentation inside the README we have:
JenkinsPipelineUnit/README.md
Lines 151 to 172 in c8fa326
How does this cover setting environment variables? For me, it seems like this will only set a parameter/params value, but no env one. Playing around with it seems to be indicate that this might be achieved by using
binding.getVariable('env').newValue = 'test'
, but it might make sense to actually document this as well.Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
The text was updated successfully, but these errors were encountered: