{"id":481,"date":"2015-06-28T19:08:22","date_gmt":"2015-06-28T14:08:22","guid":{"rendered":"http:\/\/www.stonemillkids.com\/?p=481"},"modified":"2016-10-03T00:25:23","modified_gmt":"2016-10-02T19:25:23","slug":"gitlab-changing-the-projects-default-labels","status":"publish","type":"post","link":"http:\/\/www.stonemillkids.com\/index.php\/2015\/06\/28\/gitlab-changing-the-projects-default-labels\/","title":{"rendered":"GitLab &#8211; Changing the Project&#8217;s Default Labels"},"content":{"rendered":"<p>After setting up GitLab, I wanted to create a project workflow using Labels.\u00a0 However, I did not like the default ones.\u00a0 I set them up a my first Test project, but wanted to replicate the Labels across all future projects.\u00a0 There was a lot of googling and grepping involved, but I found out how to do it.<\/p>\n<p>All of the default labels are created in the file:<\/p>\n<pre>\/opt\/gitlab\/embedded\/service\/gitlab-rails\/lib\/gitlab\/issues_labels.rb\r\n<\/pre>\n<p><strong>I saved a backup of the existing issues_labels.rb<\/strong>, then I edited my to follow my desired workflow\u00a0 is basically involved setting a color and default text for each of my new labels as follows:<\/p>\n<pre>module Gitlab\r\n    class IssuesLabels\r\n \u00a0\u00a0  \u00a0\u00a0 class &lt;&lt; self\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     def generate(project)\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0         orange = '#D99100'\r\n     \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     dk_orange = '#D95100'\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0    \u00a0\u00a0\u00a0 lt_green\u00a0 = '#A8D659'\r\n                dk_green\u00a0 = '#5CB85C'\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0    \u00a0\u00a0\u00a0\u00a0 lt_blue = '#A8DEEE'\r\n \u00a0\u00a0\u00a0    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 grey = '#7F8C8D'\r\n \u00a0\u00a0    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue = '#428BCA'\r\n \u00a0\u00a0   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lt_orange = '#F0AD4E'\r\n \u00a0\u00a0   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lt_red = '#D9534F'\r\n\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     labels = [\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     { title: \"Bug\", color: orange },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Bug - KI\", color: dk_orange },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Dev - Design\", color: dk_green },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Dev - Unit Test\", color: dk_green },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Dev - Validation\", color: dk_green },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Dev - Verification\", color: dk_green },\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0           { title: \"Dev - Backlog\", color: lt_green },\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0           { title: \"Documentation\", color: lt_blue },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Enhancement\", color: lt_blue },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Evaluated - Dropped\", color: grey },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Evaluated - Duplicated\", color: grey },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"New\", color: blue },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Support\", color: lt_orange },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Priority - Critical\", color: lt_red },\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { title: \"Priority - Low\", color: lt_blue }\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]\r\n\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0labels.each do |label|\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 project.labels.create(label)\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0end\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0end\r\n        end\r\n    end\r\nend\r\n<\/pre>\n<p>Afterwards a restart of GitLab was required<\/p>\n<pre>$ gitlab-ctl restart\r\n<\/pre>\n<p>Now when I create a new project, I will get the default Labels I use in my workflow.<\/p>\n<p>&#8211; Update 5\/31\/16 &#8211; After running both a &#8220;gitlab-crl upgrade&#8221; as well as the &#8216;yum update all&#8221; my custom settings still exist.<\/p>\n<p>&#8211; Update 10\/2\/16 &#8211; a cut and paste from above may cause GitLab (specifically unicorn) to not start.\u00a0 Here my current <a href=\"http:\/\/www.stonemillkids.com\/wp-content\/uploads\/2016\/09\/issues_labels.rb\"><u><span style=\"color: #0066cc;\">issues_labels.rb<\/span><\/u><\/a>\u00a0in case you need the raw file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After setting up GitLab, I wanted to create a project workflow using Labels.\u00a0 However, I did not like the default ones.\u00a0 I set them up a my first Test project, but wanted to replicate the Labels across all future projects.\u00a0 There was a lot of googling and grepping involved, but I found out how to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":740,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,14],"tags":[42,31,50,45],"_links":{"self":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/481"}],"collection":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/comments?post=481"}],"version-history":[{"count":3,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":901,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/posts\/481\/revisions\/901"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/media\/740"}],"wp:attachment":[{"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/media?parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/categories?post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.stonemillkids.com\/index.php\/wp-json\/wp\/v2\/tags?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}