我想在Jenkins中设置主从关系,而无需打开jenkins链接。 是否可以更改config.xml并形成此设置? 从节点的值将作为参数传递,并将放入配置文件中。
答案 0 :(得分:0)
如果我正确理解您的问题,您可以尝试以下解决方案。实际上,我当前的Test框架正在按照你想要的CI进行配置。你需要做的是:
这可以通过以下步骤完成:
例如,您可以将此示例批处理代码用作可配置的预处理步骤:
@echo off
call %WORKSPACE%/jenkins-scripts/set-properties.bat "myRootFolder=/user/project" "rootRefDataFolder=12345" "standartVersion=1.2.3" "alwaysReload=false"
call %WORKSPACE%/jenkins-scripts/do-something-else.bat
这个作为 set-properties.bat :
@echo off
echo ----------------------------------------------------------
SET PROP_NAME=base.Project.properties
echo Task: [Update %PROP_NAME%] started
echo Workspace: %WORKSPACE%
SET PROJECT_PATH=projectPath=%WORKSPACE:\=/%
SET RESULT_FOLDER=testResultFolder=report
SET PROP_PATH=%WORKSPACE%\test\resources
DEL "%PROP_PATH%\%PROP_NAME%"
echo %PROJECT_PATH%>> "%PROP_PATH%\%PROP_NAME%"
echo %RESULT_FOLDER%>> "%PROP_PATH%\%PROP_NAME%"
for %%x in (%*) do echo %%~x>> "%PROP_PATH%\%PROP_NAME%"
echo Current properties:
echo __________________________________________________________
type "%PROP_PATH%\%PROP_NAME%"
echo __________________________________________________________
echo Task: [Update %PROP_NAME%] finished
echo ----------------------------------------------------------
确保设置自己的路径和变量。