3
我已经创建了一个参数化的Jenkins作业,我将变量从Java传递到该作业。如何通过Java将文件传递给Jenkins
这里是Java:
final HttpClient client = new HttpClient();
final PostMethod buildMethod = new PostMethod(Constants.SVN2GIT_QA_URL);
buildMethod.setParameter(Constants.GIT_URL_PARAM, gitUrl);
buildMethod.setParameter(Constants.PASSWORD_PARAM, password);
buildMethod.setParameter(Constants.SVN2GIT_COMMAND, svn2gitCommand);
buildMethod.setParameter(Constants.SVN2GIT_EMAIL, email);
buildMethod.setParameter(Constants.REPO_NAME, repoName);
client.executeMethod(buildMethod);
所以这是非常简单的,因为我只是路过String
s到工作。但是,现在我想通过Jenkins的File Parameter
将A File
传递给工作。
我看到的一件事是詹金斯的File Parameter
有File Location
和File Description
。所以不确定如何将其设置为来自Java的参数。
这可能吗?
将文件设置为字符串然后在Jenkins端重新创建文件会更简单吗?这只是一个文本文件。 –
类似的,但在Groovy。你可以从中提取java。 http://stackoverflow.com/questions/33840277/how-to-make-http-call-with-file-in-groovy-to-upload-a-file-and-build-arguments – Jayan