{"id":5166,"date":"2018-08-19T19:45:24","date_gmt":"2018-08-19T19:45:24","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=5166"},"modified":"2018-08-19T19:45:24","modified_gmt":"2018-08-19T19:45:24","slug":"what-is-install-verified-label-in-gerrit","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-install-verified-label-in-gerrit\/","title":{"rendered":"What is &#8220;Install Verified label&#8221; in Gerrit?"},"content":{"rendered":"<p>What is &#8220;Install Verified label&#8221; in Gerrit?<\/p>\n<p>The Verified label was originally invented by the Android Open Source Project to mean &#8216;compiles, passes basic unit tests&#8217;. Some CI tools expect to use the Verified label to vote on a change after running.<\/p>\n<p>During site initialization the administrator may have chosen to configure the default Verified label for all projects. In case it is desired to configure it at a later time, administrators can do this by adding the following to project.config in All-Projects:<\/p>\n<p><strong>[label &#8220;Verified&#8221;]<\/strong><br \/>\nfunction = MaxWithBlock<br \/>\nvalue = -1 Fails<br \/>\nvalue = 0 No score<br \/>\nvalue = +1 Verified<br \/>\ncopyAllScoresIfNoCodeChange = true<br \/>\nThe range of values is:<\/p>\n<p>-1 Fails<br \/>\nTried to compile, but got a compile error, or tried to run tests, but one or more tests did not pass.<br \/>\nAny -1 blocks submit.<\/p>\n<p>0 No score<br \/>\nDidn\u2019t try to perform the verification tasks.<\/p>\n<p>+1 Verified<br \/>\nCompiled (and ran tests) successfully.<br \/>\nAny +1 enables submit.<\/p>\n<p>For a change to be submittable, the change must have a +1 Verified in this label, and no -1 Fails. Thus, -1 Fails can block a submit, while +1 Verified enables a submit.<\/p>\n<p>Additional values could also be added to this label, to allow it to behave more like Code-Review (below). Add -2 and +2 entries to the label.Verified.value fields in project.config to get the same behavior.<\/p>\n<p><strong>As an example, the popular gerrit-trigger plugin for Jenkins\/Hudson can set labels at:<\/strong><\/p>\n<ul>\n<li>The start of a build<\/li>\n<li>A successful build<\/li>\n<li>An unstable build (tests fails)<\/li>\n<li>A failed build<\/li>\n<\/ul>\n<p>Usually the range chosen for this verdict is the Verified label. Depending on the size of your project and discipline of involved developers you might want to limit access right to the +1 Verified label to the CI system only. That way it\u2019s guaranteed that submitted commits always get built and pass tests successfully.<\/p>\n<p>If the build doesn\u2019t complete successfully the CI system can set the Verified label to -1. However that means that a failed build will block submit of the change even if someone else sets Verified +1. Depending on the project and how much the CI system can be trusted for accurate results, a blocking label might not be feasible. A recommended alternative is to set the label Code-review to -1 instead, as it isn\u2019t a blocking label but still shows a red label in the Gerrit UI. Optionally, to enable the possibility to deliver different results (build error vs unstable for instance), it\u2019s also possible to set Code-review +1 as well.<\/p>\n<p>If pushing new changes is granted, it\u2019s possible to automate cherry-pick of submitted changes for upload to other branches under certain conditions. This is probably not the first step of what a project wants to automate however, and so the push right can be found under the optional section.<\/p>\n<p><strong>Suggested access rights to grant, that won\u2019t block changes:<\/strong><br \/>\nRead on &#8216;refs\/heads\/*&#8217; and &#8216;refs\/tags\/*&#8217;<br \/>\nLabel: Code-Review with range &#8216;-1&#8217; to &#8216;0&#8217; for &#8216;refs\/heads\/*&#8217;<br \/>\nLabel: Verified with range &#8216;0&#8217; to &#8216;+1&#8217; for &#8216;refs\/heads\/*&#8217;<\/p>\n<p><strong>Optional access rights to grant:<\/strong><br \/>\nLabel: Code-Review with range &#8216;-1&#8217; to &#8216;+1&#8217; for &#8216;refs\/heads\/*&#8217;<br \/>\nPush to &#8216;refs\/for\/refs\/heads\/*&#8217;<\/p>\n<p><strong>Reference<\/strong><br \/>\nhttps:\/\/gerrit-review.googlesource.com\/Documentation\/config-labels.html#label_Verified<br \/>\nhttps:\/\/gerrit-review.googlesource.com\/Documentation\/access-control.html#examples_cisystem<br \/>\nhttps:\/\/groups.google.com\/forum\/#!topic\/repo-discuss\/FdN29piSmEQ<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is &#8220;Install Verified label&#8221; in Gerrit? The Verified label was originally invented by the Android Open Source Project to mean &#8216;compiles, passes basic unit tests&#8217;. Some CI tools expect&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4994],"tags":[945,5006],"class_list":["post-5166","post","type-post","status-publish","format-standard","hentry","category-gerrit","tag-gerrit","tag-install-verified-label"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=5166"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5166\/revisions"}],"predecessor-version":[{"id":5170,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5166\/revisions\/5170"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}