BigW Consortium Gitlab

Commit fca02e24 by Eric Eastwood

Update styling and use Gitlab::Utils.to_boolean

parent de0c4730
......@@ -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
......
......@@ -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
......
---
title: Add yellow favicon to differientate canary environment
merge_request: 12477
author:
type: changed
......@@ -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
......
......@@ -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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment