Jenkins: How to use a variable from a pre-build shell in the Maven “Goals and options”

后端 未结 6 1556
别跟我提以往
别跟我提以往 2020-12-24 12:20

I have a Maven job in Jenkins. Before the actual build step I have an \"Execute shell\" pre-build step. In that shell I set a variable:

REVISION=$(cat .build         


        
6条回答
  •  忘掉有多难
    2020-12-24 12:35

    I think your best shot is to try the EnvInject plugin for this along with your initial pre-scm step.

    1. You run the pre-scm as you already do.
    2. You use the env inject to load the file for the main job's build steps

    Consider loading your file's content (properties format) or execute a script which will load the file as you want and make a variable available for the rest of the job with the "Prepare an environment for the run" option.

    I hope this helps.

提交回复
热议问题