diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-21 13:38:03 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-21 13:38:03 +0100 |
commit | ef73fe300c047d659c5bb665f200531efa95ac0b (patch) | |
tree | 15ba8daa1509d6a934567275d99ec10054e6fef4 | |
parent | a9a603e707b2e56416a96f1db041f264d79166cb (diff) | |
download | gitlab-ce-ef73fe300c047d659c5bb665f200531efa95ac0b.tar.gz |
Use Gitlab::REVISION over reading HEAD sha from gitsentry-clientside-releases
-rw-r--r-- | app/assets/javascripts/raven/index.js | 4 | ||||
-rw-r--r-- | lib/gitlab/gon_helper.rb | 1 | ||||
-rw-r--r-- | spec/javascripts/raven/index_spec.js | 9 | ||||
-rw-r--r-- | spec/javascripts/raven/raven_config_spec.js | 36 |
4 files changed, 25 insertions, 25 deletions
diff --git a/app/assets/javascripts/raven/index.js b/app/assets/javascripts/raven/index.js index f82824c0940..edc2293915f 100644 --- a/app/assets/javascripts/raven/index.js +++ b/app/assets/javascripts/raven/index.js @@ -6,9 +6,9 @@ const index = function index() { currentUserId: gon.current_user_id, whitelistUrls: [gon.gitlab_url], isProduction: process.env.NODE_ENV, - release: process.env.HEAD_COMMIT_SHA, + release: gon.revision, tags: { - HEAD_COMMIT_SHA: process.env.HEAD_COMMIT_SHA, + revision: gon.revision, }, }); diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 6200bd460ea..21f2e6b6970 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -12,6 +12,7 @@ module Gitlab gon.katex_js_url = ActionController::Base.helpers.asset_path('katex.js') gon.sentry_dsn = current_application_settings.clientside_sentry_dsn if current_application_settings.clientside_sentry_enabled gon.gitlab_url = Gitlab.config.gitlab.url + gon.revision = Gitlab::REVISION if current_user gon.current_user_id = current_user.id diff --git a/spec/javascripts/raven/index_spec.js b/spec/javascripts/raven/index_spec.js index e8fe6b32c43..a503a54029f 100644 --- a/spec/javascripts/raven/index_spec.js +++ b/spec/javascripts/raven/index_spec.js @@ -6,7 +6,7 @@ describe('RavenConfig options', () => { const currentUserId = 'currentUserId'; const gitlabUrl = 'gitlabUrl'; const isProduction = 'isProduction'; - const headCommitSHA = 'headCommitSHA'; + const revision = 'revision'; let indexReturnValue; beforeEach(() => { @@ -14,10 +14,11 @@ describe('RavenConfig options', () => { sentry_dsn: sentryDsn, current_user_id: currentUserId, gitlab_url: gitlabUrl, + revision, }; process.env.NODE_ENV = isProduction; - process.env.HEAD_COMMIT_SHA = headCommitSHA; + process.env.HEAD_COMMIT_SHA = revision; spyOn(RavenConfig, 'init'); @@ -30,9 +31,9 @@ describe('RavenConfig options', () => { currentUserId, whitelistUrls: [gitlabUrl], isProduction, - release: headCommitSHA, + release: revision, tags: { - HEAD_COMMIT_SHA: headCommitSHA, + revision, }, }); }); diff --git a/spec/javascripts/raven/raven_config_spec.js b/spec/javascripts/raven/raven_config_spec.js index d2f4f9ac6fb..b31a7c28ebe 100644 --- a/spec/javascripts/raven/raven_config_spec.js +++ b/spec/javascripts/raven/raven_config_spec.js @@ -25,7 +25,9 @@ describe('RavenConfig', () => { }); describe('init', () => { - const options = {}; + const options = { + currentUserId: 1, + }; beforeEach(() => { spyOn(RavenConfig, 'configure'); @@ -54,34 +56,28 @@ describe('RavenConfig', () => { it('should not call setUser if there is no current user ID', () => { RavenConfig.setUser.calls.reset(); - RavenConfig.init({ - sentryDsn: '//sentryDsn', - ravenAssetUrl: '//ravenAssetUrl', - currentUserId: undefined, - whitelistUrls: ['//gitlabUrl'], - isProduction: true, - }); + options.currentUserId = undefined; + + RavenConfig.init(options); expect(RavenConfig.setUser).not.toHaveBeenCalled(); }); }); describe('configure', () => { - let options; let raven; let ravenConfig; + const options = { + sentryDsn: '//sentryDsn', + whitelistUrls: ['//gitlabUrl'], + isProduction: true, + release: 'revision', + tags: { + revision: 'revision', + }, + }; beforeEach(() => { - options = { - sentryDsn: '//sentryDsn', - whitelistUrls: ['//gitlabUrl'], - isProduction: true, - release: 'release', - tags: { - HEAD_COMMIT_SHA: 'headCommitSha', - }, - }; - ravenConfig = jasmine.createSpyObj('ravenConfig', ['shouldSendSample']); raven = jasmine.createSpyObj('raven', ['install']); @@ -116,6 +112,8 @@ describe('RavenConfig', () => { RavenConfig.configure.call(ravenConfig); expect(Raven.config).toHaveBeenCalledWith(options.sentryDsn, { + release: options.release, + tags: options.tags, whitelistUrls: options.whitelistUrls, environment: 'development', ignoreErrors: ravenConfig.IGNORE_ERRORS, |