使用 GIT 在 Jenkins 中构建

Build in Jenkins using GIT

我试图为 GIT 存储库的远程主机中的代码创建一个构建作业。但是我们有兴趣从 GIT 中的其他分支进行构建。分支说明符在这种情况下会有帮助吗?

是 - 在作业上指定分支将从该分支跟踪和构建。

来自 Jenkins GIT 插件:

Specify the branches if you'd like to track a specific branch in a repository. If left blank, all branches will be examined for changes and built.

The syntax is of the form: REPOSITORYNAME/BRANCH. In addition, BRANCH is recognized as a shorthand of /BRANCH, '' is recognized as a wildcard, and '' is recognized as wildcard that includes the separator '/'. Therefore, origin/branches* would match origin/branches-foo but not origin/branches/foo, while origin/branches would match both origin/branches-foo and origin/branches/foo.

If you are using namespaces to structure branches (e.g. feature1/master, or team1/requestA/rel-1.0) you have to specify the full branch specifier (including "remotes/"): remotes/REPOSITORYNAME/BRANCH/WITH/NAMESPACE. E.g. "remotes/origin/feature1/master" A specific revision can be checked out by specifying the SHA1 hash of that revision in this field.

是的。我已经使用 'Branch specifier' 一段时间了,它按预期工作。