{"id":296886,"date":"2020-01-09T09:00:24","date_gmt":"2020-01-09T09:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296886"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-01-09T09:00:24","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296886","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f HotFix \u0432 Maven \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c TeamCity"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/483242\/\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 HotFix \u0432 Maven \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Teamcity.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c HotFix \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0440\u0430\u043d\u0447 \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c HotFix<\/li>\n<li>\u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0440\u0435\u043b\u0438\u0437\u0435<\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0442\u044c bugfix \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u043c \u0431\u0440\u0430\u043d\u0447\u0435<\/li>\n<li>\u0412\u044b\u043a\u0430\u0442\u0438\u0442\u044c \u0442\u0435\u0433 bugfix \u0432\u0435\u0440\u0441\u0438\u0438<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0443\u043d\u043a\u0442\u044b 1,3,4 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0442\u0435\u043c\u0435, \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u0432\u0430\u0436\u043d\u0443\u044e \u0438 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u2014 <strong>\u0432\u0435\u0440\u0441\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f. \u041a\u0440\u0430\u0442\u043a\u043e \u043e Semver \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2b5\/f94\/c42\/2b5f94c422afdddba324172ff2fafc6a.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <a href=\"http:\/\/www.8bytes.net\/2017\/12\/11\/semver-semanticheskoe-versionirovanie\/\">1<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/semver.org\/lang\/ru\/\">Semver<\/a> \u0438 <a href=\"https:\/\/trunkbaseddevelopment.com\/\">Trunk-Based Development<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 Trunk-Based Development \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0431\u0440\u0430\u043d\u0447. \u0412\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f (hotfix) \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430 \u043a\u043e\u043c\u043c\u0438\u0442\u044f\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0442 \u0431\u0440\u0430\u043d\u0447.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0435\u0449\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>CI \u0441\u0431\u043e\u0440\u043a\u0430<\/p>\n<p>  <\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430<\/p>\n<p>  <\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0440\u0430\u043d\u0447\u0430 \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u0430<\/p>\n<p>  <\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 bugfix \u0432\u0435\u0440\u0441\u0438\u0438<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1c5\/c1b\/8dc\/1c5c1b8dc8386c58f0449bef64034ea2.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>Git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u043f\u043e\u0441\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/gitlab.com\/anton_patsev\/automation-maven-hotfix\">https:\/\/gitlab.com\/anton_patsev\/automation-maven-hotfix<\/a>.<\/li>\n<li>Teamcity \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0430\u0433\u0435\u043d\u0442. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 Teamcity \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0430\u0433\u0435\u043d\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/JetBrains\/teamcity-docker-samples\/blob\/master\/compose-ubuntu\/docker-compose.yml\">docker-compose<\/a><\/li>\n<li>\u0422\u0430\u043c \u0433\u0434\u0435 \u0443 \u0432\u0430\u0441 Teamcity \u0430\u0433\u0435\u043d\u0442, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b java, maven, git<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 Teamcity \u043f\u0440\u043e\u0435\u043a\u0442 &#171;Automation Maven Hotfix&#187; \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043c 4 \u0442\u0430\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p>CI Build (CI \u0441\u0431\u043e\u0440\u043a\u0430)<\/p>\n<p>  <\/li>\n<li>\n<p>Create branch for release (\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0440\u0430\u043d\u0447\u0430 \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u0430)<\/p>\n<p>  <\/li>\n<li>\n<p>Maven increment bugfix (\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 bugfix \u0432\u0435\u0440\u0441\u0438\u0438))<\/p>\n<p>  <\/li>\n<li>\n<p>Maven release (\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430)<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tr\/w7\/wm\/trw7wm4ezmga_h5opy2l6jptsjy.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"obschie-nastroyki\"><strong>\u041e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/strong><\/h3>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0441\u0435\u0445 \u0442\u0430\u0441\u043a\u0430\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0433\u0430\u043b\u043a\u0443 &#171;<strong>Clean build: Delete all files in the checkout directory before the build<\/strong>&#171;, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043e\u0442\u0441\u0442\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u044d\u0442\u043e\u0439 \u0433\u0430\u043b\u043a\u0438 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 VCS. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 VCS \u043e\u0431\u0432\u0435\u0434\u0435\u043d\u043d\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/a2\/pk\/in\/a2pkinpahr-3q5viu9b1ptpoboi.png\"><\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e VCS \u0438\u0441\u043f\u043e\u043b\u044c\u0443\u044e\u0442 \u0441\u0445\u0435\u043c\u0443 HTTPS. \u0412 <strong>Branch specification:<\/strong> \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0431\u0440\u0430\u043d\u0447\u0438 \u0438 \u0432\u0441\u0435 \u0442\u0435\u0433\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">+:refs\/heads\/* +:refs\/tags\/*<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 4 Configuration Parameters.<\/p>\n<p>  <\/p>\n<ul>\n<li>BRANCH_FOR_INCREMENT<\/li>\n<li>TAG_FROM_VERSION<\/li>\n<li>TEAM_USER<\/li>\n<li>TEAM_USER_EMAIL<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435 value \u0432 BRANCH_FOR_INCREMENT \u0438 TAG_FROM_VERSION \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i6\/hb\/av\/i6hbavy70skqahcff1lapsjqdh4.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043a\u0430\u0447\u0430\u0442\u044c\/\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447. \u0412\u043e \u0432\u0441\u0435\u0445 \u0442\u0430\u0441\u043a\u0430\u0445 \u043a\u0440\u043e\u043c\u0435 CI Build \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yv\/qf\/nc\/yvqfncwkbsoshgk3vay6l3v2rvu.png\"><\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u0441\u043a\u0435 \u043a\u0440\u043e\u043c\u0435 CI Build \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Build Features \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <strong>Maven release<\/strong><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i6\/hb\/av\/i6hbavy70skqahcff1lapsjqdh4.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"ci-build\">CI Build**.<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0442\u0430\u0441\u043a\u0435 <strong>CI Build<\/strong> \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0448\u0430\u0433 <strong>mvn clean test<\/strong><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tu\/16\/h-\/tu16h-8v82uscogf9wx3nqnccua.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"maven-release\"><strong>Maven release<\/strong><\/h3>\n<p>  <\/p>\n<p>\u0412 \u0442\u0430\u0441\u043a\u0435 <strong>Maven release<\/strong> 2 \u0448\u0430\u0433\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0447\u0442\u043e \u0431\u0440\u0430\u043d\u0447 \u044d\u0442\u043e <strong>master<\/strong>. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u043d\u0447 \u043d\u0435 <strong>master<\/strong>, \u0442\u043e \u0442\u0430\u0441\u043a\u0430 \u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">BRANCH=$(git branch | grep \\* | cut -d ' ' -f2) echo \"$BRANCH\" if [[ \"$BRANCH\" != \"master\" ]]; then   echo 'Branch is not master';   echo 'Aborting';   exit 1; fi<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hw\/zh\/vt\/hwzhvtdrnjtw1rdkug7j0g6_hvm.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 <strong>mvn release:prepare<\/strong> c \u043e\u043f\u0446\u0438\u0435\u0439 <strong>&#8212;batch-mode<\/strong><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d-\/7w\/sx\/d-7wsxiobalnzjpsfqtwerogi5k.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"create-branch-for-release\"><strong>Create branch for release<\/strong><\/h3>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c hotfix \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0440\u0430\u043d\u0447. \u042d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0441\u043a\u0430 <strong>Create branch for release<\/strong>. \u0423 \u043d\u0435\u0435 2 \u0448\u0430\u0433\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0447\u0442\u043e \u0431\u0440\u0430\u043d\u0447 \u043d\u0435 <strong>master<\/strong>, \u0438 \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0447\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>pom.xml<\/strong> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u043e \u0441\u043b\u043e\u0432\u043e <strong>SNAPSHOT<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">BRANCH=$(git branch | grep \\* | cut -d ' ' -f2) echo \"$BRANCH\" if [[ \"$BRANCH\" == \"master\" ]]; then   echo 'Branch is master';   echo 'Aborting';   exit 1; fi  echo \"Get version package from pom.xml\" version=`python -c \"import xml.etree.ElementTree as ET; print(ET.parse(open('pom.xml')).getroot().find('{http:\/\/maven.apache.org\/POM\/4.0.0}version').text)\"`  echo \"Check SNAPSHOT\" if [[ $version == \"*SNAPSHOT*\" ]]; then     echo \"******************* W A R N I N G *************************\"     echo \"************ You are create branch for SNAPSHOTS ******************\"     echo \"***********************************************************\"     exit 1 fi<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ap\/ky\/xp\/apkyxp675ywbv6m2lrjchon7gds.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0432 developerConnection \u0441\u0445\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441 HTTPS \u043d\u0430 GIT.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c developerConnection \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 pom.xml developerConnection=$(xmllint -xpath \"\/*[local-name() = 'project' ]\/\/*[local-name() = 'developerConnection']\/text()\" pom.xml | sed  's|scm:git:ssh:\/\/||') echo developerConnection echo $developerConnection # \u0417\u0434\u0435\u0441\u044c \u043c\u0435\u043d\u044f\u0435\u043c \/ \u043d\u0430 : \u0432 URL \u0434\u043b\u044f git_remote_url git_remote_url=$(echo $developerConnection| sed 's\/gitlab.com\\\/\/gitlab.com:\/g') echo git_remote_url echo $git_remote_url  git remote set-url origin $git_remote_url  # \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0432\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c Teamcity \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f user \u0438 email \u0438\u0437 ~\/.gitconfig, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0445 \u0437\u0434\u0435\u0441\u044c echo 'git config user.name %TEAM_USER%' git config user.name %TEAM_USER% echo 'git config user.email %TEAM_USER_EMAIL%' git config user.email %TEAM_USER_EMAIL%  # \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 pom.xml echo \"Get version package from pom.xml\" version=`python -c \"import xml.etree.ElementTree as ET; print(ET.parse(open('pom.xml')).getroot().find('{http:\/\/maven.apache.org\/POM\/4.0.0}version').text)\"` echo $version  # \u041f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u0431\u0435\u0437 fetch \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u043e \u043e\u0448\u0438\u0431\u043a\u0443. git fetch  if [ `git branch -a | egrep \"${version}$\"` ] then     echo \"Branch exists\"     exit 1 fi  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u0440\u0430\u043d\u0447 \u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0432 \u0444\u0430\u0439\u043b\u0435 pom.xml echo \"Create branch\" git checkout -b $version  # \u0427\u0438\u0441\u0442\u044b\u0439 git \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. git config --global push.default simple  # \u041f\u0443\u0448\u0438\u043c \u0432 \u0432\u0435\u0442\u043a\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0443\u044e \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0432 pom.xml echo \"Push release branch\" git push --set-upstream origin $version<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3e\/3j\/yd\/3e3jydfdnlg6avoxzwwy5kubmke.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"maven-increment-bugfix\"><strong>Maven increment bugfix<\/strong><\/h3>\n<p>  <\/p>\n<p>\u0422\u0430\u0441\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 6 \u0447\u0430\u0441\u0442\u0435\u0439. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c, \u043d\u043e \u0438 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0442\u043e \u0431\u0440\u0430\u043d\u0447 \u043d\u0435 <strong>master<\/strong>. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u043d\u0447 <strong>master<\/strong> \u0442\u0430\u0441\u043a\u0430 \u043f\u0430\u0434\u0430\u0435\u0442. <\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">BRANCH=$(git branch | grep \\* | cut -d ' ' -f2) echo \"$BRANCH\" if [[ \"$BRANCH\" == \"master\" ]]; then   echo 'Branch is master';   echo 'Aborting';   exit 1; fi  # \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 pom.xml echo \"Get version package from pom.xml\" BRANCH=`python -c \"import xml.etree.ElementTree as ET; print(ET.parse(open('pom.xml')).getroot().find('{http:\/\/maven.apache.org\/POM\/4.0.0}version').text)\"` # \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c checkout \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0439 \u0431\u0440\u0430\u043d\u0447. # \u0418\u043d\u0430\u0447\u0435 git status \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 detached \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0431\u0440\u0430\u043d\u0447\u0443. # \u041d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b git status \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0440\u0430\u043d\u0447 git checkout $BRANCH # \u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e bash \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e Teamcity \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. echo \"##teamcity[setParameter name='BRANCH_FOR_INCREMENT' value='$BRANCH']\"<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aw\/kd\/o9\/awkdo9irrlxyqfutph53lgtusqc.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 Maven \u0448\u0430\u0433 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 bugfix \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 pom.xml.<\/p>\n<p>  <\/p>\n<p><strong>Goals:<\/strong> \u0443 maven \u0432\u0441\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">build-helper:parse-version versions:set -DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion} versions:commit<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hg\/j-\/xy\/hgj-xyeo4zgh7zucznk7kfp_qeq.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u0442\u0438\u0439 \u0448\u0430\u0433 \u2014 \u0432\u044b\u0432\u043e\u0434 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 Git status \u0438 \u0434\u0440\u0443\u0433\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">echo 'cat pom.xml' cat pom.xml echo 'git status' git status echo 'git remote -v' git remote -v echo 'git branch' git branch<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y2\/nl\/l3\/y2nll3lgpjtixjf5dwohvdoqevm.png\"><\/p>\n<p>  <\/p>\n<p>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u0448\u0430\u0433 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0432 developerConnection \u0441\u0445\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441 HTTPS \u043d\u0430 GIT.<\/p>\n<p>  <\/p>\n<p>\u0418 \u043f\u0443\u0448\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0432\u0435\u0442\u043a\u0443, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 Teamcity \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 %BRANCH_FOR_INCREMENT%<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c developerConnection \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 pom.xml developerConnection=$(xmllint -xpath \"\/*[local-name() = 'project' ]\/\/*[local-name() = 'developerConnection']\/text()\" pom.xml | sed  's|scm:git:ssh:\/\/||') echo developerConnection # \u0417\u0434\u0435\u0441\u044c \u043c\u0435\u043d\u044f\u0435\u043c \/ \u043d\u0430 : \u0432 URL \u0434\u043b\u044f git_remote_url git_remote_url=$(echo $developerConnection| sed 's\/gitlab.com\\\/\/gitlab.com:\/g') echo git_remote_url echo $git_remote_url  git remote set-url origin $git_remote_url  # \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0432\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c Teamcity \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f user \u0438 email \u0438\u0437 ~\/.gitconfig, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0445 \u0437\u0434\u0435\u0441\u044c echo 'git config user.name %TEAM_USER%' git config user.name %TEAM_USER% echo 'git config user.email %TEAM_USER_EMAIL%' git config user.email %TEAM_USER_EMAIL% echo 'git add .' git add . echo 'git commit -m \"Increment bugfix\"' git commit -m \"Increment bugfix\"  git push --set-upstream origin %BRANCH_FOR_INCREMENT%<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9e\/kx\/aa\/9ekxaa0fnm3sfve2iem246iihuy.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u044f\u0442\u044b\u0439 \u0448\u0430\u0433 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 <strong>pom.xml<\/strong> \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0435\u0435 \u0432 <strong>Teamcity<\/strong> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>TAG_FROM_VERSION<\/strong>. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435 \u0447\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 <strong>pom.xml<\/strong> \u0431\u0435\u0437 \u0431\u0443\u043a\u0432\u044b v \u0432\u043f\u0435\u0440\u0435\u0434\u0438. \u0410 \u0442\u0435\u0433, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0436\u0435 \u0441 \u0431\u0443\u043a\u0432\u043e\u0439 v \u0432\u043d\u0430\u0447\u0430\u043b\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">echo \"Get version package from pom.xml\" VERSION_AFTER_CHANGE=`python -c \"import xml.etree.ElementTree as ET; print(ET.parse(open('pom.xml')).getroot().find('{http:\/\/maven.apache.org\/POM\/4.0.0}version').text)\"` echo $VERSION_AFTER_CHANGE echo \"##teamcity[setParameter name='TAG_FROM_VERSION' value='v$VERSION_AFTER_CHANGE']\"<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4a\/7t\/2y\/4a7t2yc_wgfyhwtmqgw_pnecquo.png\"><\/p>\n<p>  <\/p>\n<p>\u0428\u0435\u0441\u0442\u043e\u0439 \u0448\u0430\u0433 \u2014 \u0442\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <strong>bugfix<\/strong> \u0432\u0435\u0440\u0441\u0438\u0438. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>Maven<\/strong> \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u043e\u043f\u0446\u0438\u0435\u0439 \u0432 <strong>Goal<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0446\u0438\u044f <strong>Goals<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">-Dtag=%TAG_FROM_VERSION% scm:tag<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eq\/lo\/32\/eqlo32gfwn7hx4nnkoyhl9ir5y0.png\"><\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/483242\/\"> https:\/\/habr.com\/ru\/post\/483242\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/483242\/\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 HotFix \u0432 Maven \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Teamcity.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c HotFix \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0440\u0430\u043d\u0447 \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c HotFix<\/li>\n<li>\u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0440\u0435\u043b\u0438\u0437\u0435<\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0442\u044c bugfix \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u043c \u0431\u0440\u0430\u043d\u0447\u0435<\/li>\n<li>\u0412\u044b\u043a\u0430\u0442\u0438\u0442\u044c \u0442\u0435\u0433 bugfix \u0432\u0435\u0440\u0441\u0438\u0438<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0443\u043d\u043a\u0442\u044b 1,3,4 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-296886","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296886"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296886\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}