是否可以在 Hudson/Jenkins 中用参数化字符串替换整个存储库 URL?
在 Hudson/Jenkins 中,是否可以用字符串参数替换 Subversion 模块存储库 URL 中的整个字符串?我不想只替换版本或类似的内容,我想替换整个网址。
因此,当我运行构建时,我会收到输入 URL 的提示,我会输入类似“http://scm.work.corp/svn/com.work.package/tags/project-4.0.0 .RELEASE”,它会检查并构建它。
能够替换“com.work.package”和“project-4.0.0.RELEASE”部分同样可以接受。我基本上希望它成为一项可以构建任何版本的工作。
In Hudson/Jenkins, is it possible to replace the entire string in the Subversion Module Repository URL with a String parameter? I don't want to just replace just the version or anything like that, I want to replace the entire url.
So, when I run the build, I'd get a prompt for the URL and I'd put something like "http://scm.work.corp/svn/com.work.package/tags/project-4.0.0.RELEASE" and it would check that out and build it.
Being able to substitute the "com.work.package" and "project-4.0.0.RELEASE" parts would be just as acceptable. I basically want it to be one job that can build any release.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是的,你可以。但是您不能让 Jenkins/Hudson 监视 SVN 的更改。即使参数到位,这对我来说也不能正常工作。但是,如果您从没有参数化存储库 URL 的作业监控 SVN,让该作业触发下游作业,将整个存储库 URL 作为参数传递,然后让下游作业使用存储库 URL 参数,那么它似乎可以工作。
这就是我们为构建内容所做的事情。我们有一项作业可以根据您开始作业时使用的存储库 URL 从 SVN 构建产品。然后我们有许多触发作业来监视某些分支;当注意到更改时,启动构建作业并将其 URL 传递给它。
Yes, you can. But you can't have Jenkins/Hudson monitor the SVN for changes. Even with parameters in place, that didn't work for me properly. But if you monitor the SVN from a job that does not have the Repository URL parameterized, have that job trigger a downstream job passing the entire Repository URL as a parameter, then have the downstream job use the Repository URL parameter, then it seems to work.
This is what we do for our build stuff. We have one job that can build the product from SVN, based on the Repository URL that you start the job with. Then we have a number of trigger jobs that monitor certain branches; when a change is noted, the startup the build job and pass their URL to it.
如果 Hudson/Jenkins 事先不知道 URL,那么它如何进行持续构建集成呢?
而且,如果您不断更改 URL,Hudson/Jenkins 如何进行更新?您必须让 Hudson/Jenkins 每次都进行新的签出,或者让它使用 svn switch 命令。
像 Hudson/Jenkins 这样的工具的全部目的是进行连续构建,而您希望阻止它这样做。既然您不进行持续构建,为什么还要使用像 Hudson/Jenkins 这样的工具呢?为什么不编写自己的 Ant 脚本来检查您想要的内容,然后进行构建?
每个分支和每个模块都应该有自己的 Hudson/Jenkins 作业,并且使用模板插件,您可以轻松地将一个作业复制为另一个作业的模板。因此,设置您需要的所有构建并不是那么困难。
If Hudson/Jenkins doesn't know the URL in advance, how is it suppose to do continuous build integration?
And, how does Hudson/Jenkins do an update if you keep changing the URL? You'll have to get Hudson/Jenkins to either do a fresh checkout each time, or get it to use the
svn switch
command.The whole purpose of a tool like Hudson/Jenkins is to do continuous builds which you want to stop it from doing. Since you're not doing continuous builds, why bother with a tool like Hudson/Jenkins? Why not write your own Ant script that will checkout what you want and then do the build?
Each branch and each module should have its own Hudson/Jenkins job, and with the template plugin, you easily copy one job to be the template for another job. So, it's not all that difficult to setup all the builds you need.
是的,你可以,我遇到了同样的问题,但将其更改为 $VARIABLE 并且似乎有效,唯一的问题是你必须包含一个“。”在本地模块目录中。我花了很长时间才发现这一点。
Yes you can, I had the same issue but changed it to $VARIABLE and seemed to work the only issue was that you have to include a "." in the Local module directory. It took me a long time to find this out.
你可以做到,但你不能让 Jenkins 为你管理 svn。使用您的字符串创建参数化构建,然后在执行步骤中执行
svn co ${parameter_you_selected}
以及您的构建步骤的其他内容(调用 ant 脚本、makefile、rakefile 等)You can do it, but you can't have Jenkins manage svn for you. Create a parametrized build, with your strings, then in the execute step, do a
svn co ${parameter_you_selected}
plus whatever else your build steps are (call ant scripts, makefiles, rakefiles, etc)我想我应该指定我的用例。
我明白哈德森的目的。我想要这样做的唯一原因是让 Hudson 为用户指定的版本执行单个构建,以便可以触发我们使用的插件(声纳),而不必将其添加到每个 pom 中并将其附加到每个阶段。我们手动进行发布,因此我们不希望 Hudson 来处理这个问题。但是,我们确实希望获得关于我们的版本的声纳报告,因此这个用例。
然而,这实际上比我想象的要容易。我简单地进行了参数化构建并将 ${PARAMETER} 放入 svn 存储库 url 中。现在,Jenkins 给了我一个错误,说这是一个无效的 URL,但实际上构建工作按照我的预期进行。尽管出现错误警告,我很高兴我尝试了它。
I suppose I should have specified my use case.
I understand the purpose of Hudson. The only reason I want this is to have Hudson perform a single build for a release that the user specifies so that a plugin we use (sonar) can be triggered without having to add it in every pom and attach it to every phase. We do our releases manually so we don't want Hudson to handle that. However, we do want sonar reports on our releases, thus this use case.
However, this actually turned out to be easier than I expected. I simple did a parameterized build and put ${PARAMETER} in the svn repository url. Now, Jenkins given me an error saying that's an invalid URL, but actually doing the build works as I expected it. I'm glad I tried it out despite that error warning.
是的,你可以。检查使用 Hudson 构建特定的 SVN 修订版。在本例中,它只是参数化 URL 的后缀。在您的情况下,您需要“com.work.package”和“project-4.0.0.RELEASE”的2个参数。
希望有帮助!
Yes you can. Check Building a specific SVN revision with Hudson. In this case it just parameterizes the suffix of the URL. In your case you need 2 params for "com.work.package" and "project-4.0.0.RELEASE".
Hope it helps!