jenkinsci / jenkinsci/release-plugin

[JENKINS-23973] environment variables for release plugin are not affecting prebuild step!

Open
#112 0 comments 0 reactions 0 assignees View on GitHub
component:release-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
24
Forks
46
PR merge metrics
No merged PRs in 30d

Description

We have environment variables set up at the beginning at "Prepare an environment for the run" and used through the entire build.

We need to modify some of them in case of release run. We set the new values by using Inject environment variable at "Before release build".

Override build parameters is checked.

We need updated values before and during SCM runs, which is a prebuild step, but it not happened. The original values are used before and during SCM runs, and new values are injected only at build step.

What is really strange that release parameters are available at prebuild steps, as expected!

See the fragment of the build log below. INTEGRITY_PROJECT variable is holding path to the branch of the project in SCM repository. There is a default value for the standard, not release build. For release run, it should be modified based on the release parameter DEVELOPMENT_PATH.

It became properly modified but not at prebuild step, where it is used, but only at build step, which is too late!



[EnvInject] - Loading node environment variables.

[EnvInject] - Preparing an environment for the build.

[EnvInject] - Keeping Jenkins system variables.

[EnvInject] - Keeping Jenkins build variables.

[EnvInject] - Injecting as environment variables the properties content

INTEGRITY_PROJECT=/repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj

[EnvInject] - Variables injected successfully.

[EnvInject] - Injecting contributions.

Building in workspace D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen

Running Prebuild steps

[NGMP.Testplan.Joule.4140.Module.Frozen] $ cmd /c call C:\Windows\TEMP\hudson5103745806814541490.bat

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>REM ---Before SCM runs

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>REM @​echo DEVELOPMENT_PATH=Rev_13_Bug_Fix

DEVELOPMENT_PATH=Rev_13_Bug_Fix

INTEGRITY_PROJECT=/repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>exit 0

Success build forhudson.tasks.BatchFile@​17f5bbc

Change Log: http://ds-jenk2-1.biotronik.com:8080/job/NGMP-Testplan.Joule-4140-Module-Test-Frozen/16/changes

Build Log: http://ds-jenk2-1.biotronik.com:8080/job/NGMP-Testplan.Joule-4140-Module-Test-Frozen/16/console

Preparing to execute si projectinfo for /repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj

Preparing to execute si viewproject for #/repository/CorporateMeasurementTechnologies#s=SWProduction/SWProduction.pj#s=TestPlans/TestPlans.pj#TestplanModule/Joule_4140_Module_Test_Frozen

Checkout directory is D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen\Sandbox\SWProduction\Testplans\TestplanModule\Joule_4140_Module_Test_Frozen

A clean copy is requested; deleting contents of D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen\Sandbox\SWProduction\Testplans\TestplanModule\Joule_4140_Module_Test_Frozen

Populating clean workspace...

Successfully checked out 119 files!

Saving current Integrity Project configuration...

Writing build change log...

Change log successfully generated: D:\Program Files (x86)\Jenkins\jobs\NGMP-Testplan.Joule-4140-Module-Test-Frozen\builds\2014-07-24_10-42-03\changelog.xml

[EnvInject] - Injecting environment variables from a build step.

[EnvInject] - Injecting as environment variables the properties content

INTEGRITY_PROJECT=#/repository/CorporateMeasurementTechnologies#s=SWProduction/SWProduction.pj#s=TestPlans/TestPlans.pj#TestplanModule/Joule_4140_Module_Test_Frozen#d=Rev_13_Bug_Fix

---
Originally reported by gremlm, imported from: environment variables for release plugin are not affecting prebuild step!


  • assignee: petehayes
  • status: Open
  • priority: Major
  • component(s): release-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251223-222157

Raw content of original issue

We have environment variables set up at the beginning at "Prepare an environment for the run" and used through the entire build.
We need to modify some of them in case of release run. We set the new values by using Inject environment variable at "Before release build".
Override build parameters is checked.
We need updated values before and during SCM runs, which is a prebuild step, but it not happened. The original values are used before and during SCM runs, and new values are injected only at build step.

What is really strange that release parameters are available at prebuild steps, as expected!
See the fragment of the build log below. INTEGRITY_PROJECT variable is holding path to the branch of the project in SCM repository. There is a default value for the standard, not release build. For release run, it should be modified based on the release parameter DEVELOPMENT_PATH.
It became properly modified but not at prebuild step, where it is used, but only at build step, which is too late!



[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Injecting as environment variables the properties content
INTEGRITY_PROJECT=/repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj

[EnvInject] - Variables injected successfully.
[EnvInject] - Injecting contributions.
Building in workspace D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen
Running Prebuild steps
[NGMP.Testplan.Joule.4140.Module.Frozen] $ cmd /c call C:\Windows\TEMP\hudson5103745806814541490.bat

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>REM ---Before SCM runs

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>REM @echo DEVELOPMENT_PATH=Rev_13_Bug_Fix

DEVELOPMENT_PATH=Rev_13_Bug_Fix
INTEGRITY_PROJECT=/repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj

D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen>exit 0
Success build forhudson.tasks.BatchFile@17f5bbc
Change Log: http://ds-jenk2-1.biotronik.com:8080/job/NGMP-Testplan.Joule-4140-Module-Test-Frozen/16/changes
Build Log: http://ds-jenk2-1.biotronik.com:8080/job/NGMP-Testplan.Joule-4140-Module-Test-Frozen/16/console
Preparing to execute si projectinfo for /repository/CorporateMeasurementTechnologies/SWProduction/TestPlans/TestplanModule/Joule_4140_Module_Test_Frozen/project.pj
Preparing to execute si viewproject for #/repository/CorporateMeasurementTechnologies#s=SWProduction/SWProduction.pj#s=TestPlans/TestPlans.pj#TestplanModule/Joule_4140_Module_Test_Frozen
Checkout directory is D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen\Sandbox\SWProduction\Testplans\TestplanModule\Joule_4140_Module_Test_Frozen
A clean copy is requested; deleting contents of D:\Jenkins_ROOT\NGMP.Testplan.Joule.4140.Module.Frozen\Sandbox\SWProduction\Testplans\TestplanModule\Joule_4140_Module_Test_Frozen
Populating clean workspace...

Successfully checked out 119 files!

Saving current Integrity Project configuration...
Writing build change log...
Change log successfully generated: D:\Program Files (x86)\Jenkins\jobs\NGMP-Testplan.Joule-4140-Module-Test-Frozen\builds\2014-07-24_10-42-03\changelog.xml
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties content
INTEGRITY_PROJECT=#/repository/CorporateMeasurementTechnologies#s=SWProduction/SWProduction.pj#s=TestPlans/TestPlans.pj#TestplanModule/Joule_4140_Module_Test_Frozen#d=Rev_13_Bug_Fix

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.