Merge pull request #160 from sharelatex/report-build-to-sentry

add grunt version target to report version to sentry
This commit is contained in:
Brian Gough 2015-03-18 13:23:31 +00:00
commit 27d59eeac9
4 changed files with 94 additions and 73 deletions

View file

@ -9,6 +9,8 @@ module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-requirejs'
grunt.loadNpmTasks 'grunt-execute'
grunt.loadNpmTasks 'grunt-bunyan'
grunt.loadNpmTasks 'grunt-sed'
grunt.loadNpmTasks 'grunt-git-rev-parse'
config =
execute:
@ -123,6 +125,20 @@ module.exports = (grunt) ->
reporter: grunt.option('reporter') or 'spec'
grep: grunt.option("grep")
"git-rev-parse":
version:
options:
prop: 'commit'
sed:
version:
path: "app/views/sentry.jade"
pattern: '@@COMMIT@@',
replacement: '<%= commit %>',
release:
path: "app/views/sentry.jade"
pattern: "@@RELEASE@@"
replacement: process.env.BUILD_NUMBER || "(unknown build)"
availabletasks:
tasks:
@ -273,3 +289,4 @@ module.exports = (grunt) ->
grunt.registerTask 'run', "Compile and run the web-sharelatex server", ['compile', 'bunyan', 'execute']
grunt.registerTask 'default', 'run'
grunt.registerTask 'version', "Write the version number into sentry.jade", ['git-rev-parse', 'sed']

View file

@ -51,79 +51,7 @@ html(itemscope, itemtype='http://schema.org/Product')
block scripts
script(src="#{jsPath}libs/jquery-1.11.1.min.js")
script(src="#{jsPath}libs/angular-1.3.0-beta.14.min.js")
- if (typeof(sentrySrc) != "undefined")
- if (sentrySrc.match(/^([a-z]+:)?\/\//i))
script(src="#{sentrySrc}")
- else
script(src="#{jsPath}libs/#{sentrySrc}")
- if (typeof(sentrySrc) != "undefined")
script(type="text/javascript").
if (typeof(Raven) != "undefined" && Raven.config) {
Raven.config("#{sentryPublicDSN}", {
// Ignore list based off: https://gist.github.com/1878283
ignoreErrors: [
'DealPly',
// Random plugins/extensions
'top.GLOBALS',
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
'originalCreateNotification',
'canvas.contentDocument',
'MyApp_RemoveAllHighlights',
'http://tt.epicplay.com',
'Can\'t find variable: ZiteReader',
'jigsaw is not defined',
'ComboSearch is not defined',
'http://loading.retry.widdit.com/',
'atomicFindClose',
// Facebook borked
'fb_xd_fragment',
// ISP optimizing proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
'bmi_SafeAddOnload',
'EBCallBackMessageReceived',
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
'conduitPage'
],
ignoreUrls: [
// Facebook flakiness
/graph\.facebook\.com/i,
// Facebook blocked
/connect\.facebook\.net\/en_US\/all\.js/i,
// Woopra flakiness
/eatdifferent\.com\.woopra-ns\.com/i,
/static\.woopra\.com\/js\/woopra\.js/i,
// Chrome extensions
/extensions\//i,
/^chrome:\/\//i,
// Other plugins
/127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb
/webappstoolbarba\.texthelp\.com\//i,
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
/a\.disquscdn\.com/i,
/platform\.twitter\.com/i,
/pstatic\.datafastguru\.info/i
],
shouldSendCallback: function(data) {
// only send a fraction of errors
var sampleRate = 1.00;
return (Math.random() <= sampleRate);
},
dataCallback: function(data) {
// remove circular references from object
var cache = [];
var s = JSON.stringify(data, function(k, v) { if (typeof v === 'object' && v !== null) { if (cache.indexOf(v) !== -1) return "[circular]"; cache.push(v); }; return v; });
return JSON.parse(s);
}
// we highly recommend restricting exceptions to a domain in order to filter out clutter
// whitelistUrls: ['example.com/scripts/']
}).install();
}
- if (typeof(user) != "undefined" && typeof (user.email) != "undefined")
script(type="text/javascript").
if (typeof(Raven) != "undefined" && Raven.setUserContext) {
Raven.setUserContext({email: '#{user.email}'});
}
include sentry
script.
window.sharelatex = {
siteUrl: '#{settings.siteUrl}',

View file

@ -0,0 +1,74 @@
- if (typeof(sentrySrc) != "undefined")
- if (sentrySrc.match(/^([a-z]+:)?\/\//i))
script(src="#{sentrySrc}")
- else
script(src="#{jsPath}libs/#{sentrySrc}")
- if (typeof(sentrySrc) != "undefined")
script(type="text/javascript").
if (typeof(Raven) != "undefined" && Raven.config) {
Raven.config("#{sentryPublicDSN}", {
release: '@@RELEASE@@',
tags: { 'commit': '@@COMMIT@@' },
// Ignore list based off: https://gist.github.com/1878283
ignoreErrors: [
'DealPly',
// Random plugins/extensions
'top.GLOBALS',
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
'originalCreateNotification',
'canvas.contentDocument',
'MyApp_RemoveAllHighlights',
'http://tt.epicplay.com',
'Can\'t find variable: ZiteReader',
'jigsaw is not defined',
'ComboSearch is not defined',
'http://loading.retry.widdit.com/',
'atomicFindClose',
// Facebook borked
'fb_xd_fragment',
// ISP optimizing proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
'bmi_SafeAddOnload',
'EBCallBackMessageReceived',
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
'conduitPage'
],
ignoreUrls: [
// Facebook flakiness
/graph\.facebook\.com/i,
// Facebook blocked
/connect\.facebook\.net\/en_US\/all\.js/i,
// Woopra flakiness
/eatdifferent\.com\.woopra-ns\.com/i,
/static\.woopra\.com\/js\/woopra\.js/i,
// Chrome extensions
/extensions\//i,
/^chrome:\/\//i,
// Other plugins
/127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb
/webappstoolbarba\.texthelp\.com\//i,
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
/a\.disquscdn\.com/i,
/platform\.twitter\.com/i,
/pstatic\.datafastguru\.info/i
],
shouldSendCallback: function(data) {
// only send a fraction of errors
var sampleRate = 1.00;
return (Math.random() <= sampleRate);
},
dataCallback: function(data) {
// remove circular references from object
var cache = [];
var s = JSON.stringify(data, function(k, v) { if (typeof v === 'object' && v !== null) { if (cache.indexOf(v) !== -1) return "[circular]"; cache.push(v); }; return v; });
return JSON.parse(s);
}
// we highly recommend restricting exceptions to a domain in order to filter out clutter
// whitelistUrls: ['example.com/scripts/']
}).install();
}
- if (typeof(user) != "undefined" && typeof (user.email) != "undefined")
script(type="text/javascript").
if (typeof(Raven) != "undefined" && Raven.setUserContext) {
Raven.setUserContext({email: '#{user.email}'});
}

View file

@ -60,6 +60,8 @@
"grunt-available-tasks": "0.4.1",
"grunt-contrib-requirejs": "0.4.1",
"grunt-execute": "0.1.5",
"grunt-git-rev-parse": "^0.1.4",
"grunt-sed": "^0.1.1",
"bunyan": "0.22.1",
"grunt-bunyan": "0.5.0"
}