summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2018-03-27 12:59:14 -0500
committerEric Eastwood <contact@ericeastwood.com>2018-03-27 13:13:48 -0500
commitfca02e24768ea11d2f04a58437cb5557fd3c93fa (patch)
treeff4ec31775938eccad3ab642388f10165adeb702
parentde0c4730bb83b94195678e5ad4865ea648e6585f (diff)
downloadgitlab-ce-fca02e24768ea11d2f04a58437cb5557fd3c93fa.tar.gz
Update styling and use Gitlab::Utils.to_boolean
-rw-r--r--app/helpers/page_layout_helper.rb3
-rw-r--r--app/serializers/status_entity.rb15
-rw-r--r--changelogs/unreleased/add-canary-favicon.yml5
-rw-r--r--spec/helpers/page_layout_helper_spec.rb5
-rw-r--r--spec/serializers/status_entity_spec.rb5
-rw-r--r--vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml2
6 files changed, 26 insertions, 9 deletions
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb
index bb782060e9b..a8397b03d63 100644
--- a/app/helpers/page_layout_helper.rb
+++ b/app/helpers/page_layout_helper.rb
@@ -39,8 +39,9 @@ module PageLayoutHelper
end
def favicon
- return 'favicon-yellow.ico' if ENV['CANARY'] == 'true'
+ return 'favicon-yellow.ico' if Gitlab::Utils.to_boolean(ENV['CANARY'])
return 'favicon-blue.ico' if Rails.env.development?
+
'favicon.ico'
end
diff --git a/app/serializers/status_entity.rb b/app/serializers/status_entity.rb
index 1338068068a..a7c2e21e92b 100644
--- a/app/serializers/status_entity.rb
+++ b/app/serializers/status_entity.rb
@@ -7,13 +7,14 @@ class StatusEntity < Grape::Entity
expose :details_path
expose :favicon do |status|
- dir = 'ci_favicons'
-
- if ENV['CANARY']
- dir = File.join(dir, 'canary')
- elsif Rails.env.development?
- dir = File.join(dir, 'dev')
- end
+ dir =
+ if Gitlab::Utils.to_boolean(ENV['CANARY'])
+ File.join('ci_favicons', 'canary')
+ elsif Rails.env.development?
+ File.join('ci_favicons', 'dev')
+ else
+ 'ci_favicons'
+ end
ActionController::Base.helpers.image_path(File.join(dir, "#{status.favicon}.ico"))
end
diff --git a/changelogs/unreleased/add-canary-favicon.yml b/changelogs/unreleased/add-canary-favicon.yml
new file mode 100644
index 00000000000..57d1f55249d
--- /dev/null
+++ b/changelogs/unreleased/add-canary-favicon.yml
@@ -0,0 +1,5 @@
+---
+title: Add yellow favicon to differientate canary environment
+merge_request: 12477
+author:
+type: changed
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb
index baf927a9acc..b77114a8152 100644
--- a/spec/helpers/page_layout_helper_spec.rb
+++ b/spec/helpers/page_layout_helper_spec.rb
@@ -50,6 +50,11 @@ describe PageLayoutHelper do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
expect(helper.favicon).to eq 'favicon-blue.ico'
end
+
+ it 'has yellow favicon for canary' do
+ stub_env('CANARY', 'true')
+ expect(helper.favicon).to eq 'favicon-yellow.ico'
+ end
end
describe 'page_image' do
diff --git a/spec/serializers/status_entity_spec.rb b/spec/serializers/status_entity_spec.rb
index 16431ed4188..11dc974a5cf 100644
--- a/spec/serializers/status_entity_spec.rb
+++ b/spec/serializers/status_entity_spec.rb
@@ -25,5 +25,10 @@ describe StatusEntity do
allow(Rails.env).to receive(:development?) { true }
expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/dev/favicon_status_success.ico')
end
+
+ it 'contains a canavary namespaced favicon if canary env' do
+ stub_env('CANARY', 'true')
+ expect(entity.as_json[:favicon]).to match_asset_path('/assets/ci_favicons/canary/favicon_status_success.ico')
+ end
end
end
diff --git a/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml b/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml
index 1f8024167f5..6e5fe97cf6d 100644
--- a/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml
+++ b/vendor/gitlab-ci-yml/autodeploy/Kubernetes-with-canary.gitlab-ci.yml
@@ -28,7 +28,7 @@ build:
canary:
stage: canary
script:
- - CANARY=true command canary
+ - command canary
environment:
name: production
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_DOMAIN