我正试图找出一种方法来在Git中的项目上创建构建标记。
我的想法是让詹金斯做标记,如下文所示。
根据本文:http://www.nailedtothex.org/roller/kyle/entry/configuring-automatic-push-by-successfully
我的理解是,版本号的生成方式如下:
(Major version).(Minor version).(Revision number).(Build number)
1.2.3 (11BCF) <- Build number, should correspond with a revision in source control
^ ^ ^
| | |
| | +--- Minor bugs, spelling mistakes, etc.
| +----- Minor features, major bug fixes, etc.
+------- Major version, UX changes, file format changes, etc.我有4个层次的项目,生产,测试,巩固,开发。
发行版看起来就像
PRODUCTION (generate deploy build only if major/minor/revision number changes)
^ (send to STABLE repository)
|
TEST (generate deploy build only if major/minor/revision number changes)
^
|
CONSOLIDATION (generate all of the time)
^
|
DEVELOPMENT (generate all of the time)如何修复$BUILD_NUMBER,使其($BUILD_NUMBER)根据:(主要版本).(次要版本).(修订编号).(版本号)生成
我可以将什么传递给Jenkins作业(在配置期间),以便它识别(主要版本).(次要版本)中的更改(修订编号)
有什么更好的方法来实现这一点吗?
提亚
发布于 2017-12-31 19:51:43
您不能更改由Jenkins顺序管理的BUILD_NUMBER。
但是,您可以确保您的Jenkins作业构建步骤中的一个生成一个标记(遵循符号学惯例),然后使用使用这些版本信息生成的属性文件最后一次重新编译项目。
见"将现有标记应用于Git中的新提交“。
这使用了ktoso/maven-git-commit-id-plugin maven插件。
它允许您的项目在运行时引用此生成的属性(key/ SHA1 )文件,在该文件中您可以找到Git SHA1,但也可以找到Git SHA1。
该插件将为您运行git describe:
描述结果的格式定义为:
v1.0-2-g2414721-DEV
^ ^ ^ ^
| | | \-- if a dirtyMarker was given, it will appear here if the repository is in "dirty" state
| | \---------- the "g" prefixed commit id. The prefix is compatible with what git-describe would return - weird, but true.
| \------------- the number of commits away from the found tag. So "2414721" is 2 commits ahead of "v1.0", in this example.
\----------------- the "nearest" tag, to the mentioned commit.https://stackoverflow.com/questions/48039228
复制相似问题