From deeb14df4ab18f1cba3f96459030c9bdd4fd9433 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Wed, 3 Jul 2019 12:56:25 +0200 Subject: [PATCH] Bug 1562367 - Remove feature to remap actions to landfill.bugzilla.org landfill.bugzilla.org is very out of date which makes it unsuitable for testing with data in its current form. --- README.md | 15 --- bugherder/index.html | 1 - bugherder/js/Remapper.js | 169 ------------------------------- bugherder/js/Step.js | 36 +------ bugherder/js/ViewerController.js | 3 +- bugherder/js/bugherder.js | 19 +--- test/SpecRunner.html | 1 - 7 files changed, 7 insertions(+), 237 deletions(-) delete mode 100644 bugherder/js/Remapper.js diff --git a/README.md b/README.md index a968ae3..3e56700 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,6 @@ NOTES ON TESTING ---------------- Adding "?debug=1" shows how all changesets were identified, and shows what changesets Bugherder decided were affected by a backout. -Adding "?remap=1" allows you to divert output to the bzapi sandbox bugzilla at [landfill.bugzilla.org](https://://landfill.bugzilla.org/bzapi_sandbox/). -If you use this option, you will be presented with a table of all the bugs associated with changesets. You can then enter a bug number from bzapi that output will be sent to. You don't need to enter a new bug number for every single bug shown, but only those you do enter will be transmitted, other bugs will be ignored. - -Bugherder will not check the existence of any bugs you enter - be careful! Each bug number entered must be unique - that **will** be checked, as apparently I can't follow my own instructions. You will probably want to review the pushlog - if the push for the only bug you entered was backed out, then nothing will be sent. - -When testing target milestone setting, the equivalent bug in landfill must be filed in the *mcMerge Test Product* product, or the submission will fail. - -There are various checkbox options at the bottom of the screen: -* an option to add [inbound] to some random bug whiteboards, to allow you to test it's removal on submission -* an option to add checkin-needed to some random bug whiteboards, to allow you to test it's removal on submission. Be careful of bugs with additional keywords - if they are not defined on landfill (and they probably won't be), the submission will fail -* an option to throw up an alert - hacky, I know - partway through the submission process, to allow you to jump over to the landfill bug, and mid-air Bugherder -* a useful option to ignore the real bug status, and set it to NEW, as you will likely be working with historic pushlogs when testing - -If you do not enter any diversion bugs on the remap page, you will return to live mode, with changes going to [bugzilla.mozilla.org](https://bugzilla.mozilla.org/). - Running the Node.js static server locally ----------------------------------------- diff --git a/bugherder/index.html b/bugherder/index.html index 6765b18..e982c3b 100644 --- a/bugherder/index.html +++ b/bugherder/index.html @@ -17,7 +17,6 @@ - Bugherder diff --git a/bugherder/js/Remapper.js b/bugherder/js/Remapper.js deleted file mode 100644 index 6f93187..0000000 --- a/bugherder/js/Remapper.js +++ /dev/null @@ -1,169 +0,0 @@ -"use strict"; - -// The "remapper" will be shown when using the right incantation in the query string. -// It is an unsophisticated debug/testing shim, to allow submissions to be sent to -// the bzapi_sandbox bugzilla on landfill.bugzilla.org. Note that each unique real bug -// must be mapped to a unique landfill bug. If testing target milestone setting, the bug -// must be filed in the 'mcMerge Test Product' component. -// -// You do not have to supply a new bug number for every bug: however, only the bugs you -// have specified a new bug number for will be submitted. -// -// If you don't specify any, you will drop in to normal mode, and the changes will go -// to bugzilla.mozilla.org -var Remapper = { - - makeHTMLForBug: function rm_makeHTMLForBug(id) { - var html = '
Remap bug for bug ' + id + '
'; - html += '
'; - return html; - }, - - - makeHTMLForOptions: function rm_makeHTMLForOptions() { - var html = '
'; - html += '

Other options:

' - html += '
Display an alert after fetching last_change_time (to allow you to mid-air the change)'; - html += '
'; - html += '
Set bug statuses to NEW (to allow you testing of bug resolution)'; - html += '
'; - html += '
Add checkin-needed into keywords (to allow testing of checkin-needed removal)'; - html += '
'; - html += '
Ignore comments (i.e. override the "Don\'t duplicate comments" mechanism)'; - html += '
'; - html += '
'; - return html; - }, - - makeHTMLForSubmit: function rm_makeHTMLForSubmit() { - var html = '
'; - html += ' '; - html += '
'; - return html; - }, - - - onSubmit: function rm_onSubmit() { - var remaps = {items: 0}; - - for (var b in BugData.bugs) { - var val = $("#"+b).val().trim(); - if (val != '' && Config.strictBugNumRE.test(val)) { - remaps[b] = val; - remaps.items = remaps.items + 1; - } - } - - // Double-check that all the remapped bug numbers are unique - // in order to counter my own stupidity - var rm = []; - var count = 0; - for (b in remaps) { - if (b == 'items') - continue; - count++; - if (rm.indexOf(remaps[b]) == -1) - rm.push(remaps[b]); - } - if (rm.length < count) { - this.error("Some redirects are not unique"); - return; - } - - if ($('#new').prop('checked')) { - if (remaps.items == 0) { - this.error('You need to redirect at least 1 bug for status changing to work!'); - return; - } - for (b in remaps) { - if (b == 'items') - continue; - if (b in BugData.bugs) { - BugData.bugs[b].status = 'NEW'; - BugData.bugs[b].resolution = ''; - BugData.bugs[b].canResolve = true; - } - } - } - - if ($('#checkin').prop('checked')) { - if (remaps.items == 0) { - this.error('You need to redirect at least 1 bug for checkin-needed to work!'); - return; - } - var checkinSingle = false; - for (b in remaps) { - if (b == 'items') - continue; - if (b in BugData.bugs) { - if (BugData.bugs[b].keywords.length == 0 && checkinSingle == false) { - BugData.bugs[b].keywords.push('checkin-needed'); - checkinSingle = true; - } - } - } - } - - if ($('#comments').prop('checked')) { - for (b in remaps) { - if (b == 'items') - continue; - if (b in BugData.bugs) { - BugData.bugs[b].comments = [{text: 'Dummy comment'}]; - } - } - } - - if ($('#midair').prop('checked')) { - if (remaps.items == 0) { - this.error('You need to redirect at least 1 bug for debug midairs to work!'); - return; - } - remaps.midair = true; - } else - remaps.midair = false; - - UI.clearErrorMessage(); - bugherder.onRemap(remaps); - }, - - - addSubmitListener: function rm_AddSubmitListener() { - var self = this; - var submitCallback = function rm_AddSubmitCallback(e) { - e.preventDefault(); - - self.onSubmit(); - } - - $('#remapSubmit').one('click', submitCallback); - }, - - - error: function rm_error(message) { - UI.showErrorMessage(message); - this.addSubmitListener(); - }, - - - show: function rm_show() { - // Hide any previous viewer output - UI.hide("viewerOutput"); - $("#viewerOutput").empty(""); - - var helpText = 'Enter bug numbers from the bzapi_sandbox bugzilla that output for a particular'; - helpText += ' bug should be redirected to. Please ensure that each bug is mapped to an unique sandbox bug!'; - helpText += '
Note: if you do not supply any redirect bug numbers, you will return to normal mode'; - helpText += ', and changes will go to bugzilla.mozilla.org!'; - $("#viewerOutput").append('

' + helpText + '

'); - - for (var b in BugData.bugs) - $("#viewerOutput").append(this.makeHTMLForBug(b)); - - $("#viewerOutput").append(this.makeHTMLForOptions()); - $('#viewerOutput').append(this.makeHTMLForSubmit()); - this.addSubmitListener(); - UI.show("viewerOutput"); - $("html")[0].scrollIntoView(); - } -} diff --git a/bugherder/js/Step.js b/bugherder/js/Step.js index ba0b7c8..72df201 100644 --- a/bugherder/js/Step.js +++ b/bugherder/js/Step.js @@ -47,12 +47,6 @@ function Step(name, callbacks, isBackout) { this.statusChangeBugs = []; this.haveComment = []; - var options = {}; - if (Step.remaps.items > 0) { - options.url = "https://bugzilla-dev.allizom.org/rest"; - } - this.unprivilegedLoader = bz.createClient(options); - constructAttachedBugs(false); if (this.hasBackouts) constructAttachedBugs(true); @@ -186,9 +180,6 @@ Step.prototype.createBug = function Step_createBug(bugID, info) { bug.flags[0].id = BugData.bugs[bugID].testsuiteFlagID; } - if (bugID in Step.remaps) { - bug.id = Step.remaps[bugID]; - } return bug; } @@ -199,13 +190,11 @@ Step.prototype.createBug = function Step_createBug(bugID, info) { Step.prototype.constructData = function Step_constructData() { this.sendData = []; for (var bug in this.bugInfo) { - if (Step.remaps.items == 0 || bug in Step.remaps) { - var info = this.bugInfo[bug]; - var data = this.createBug(bug, info); + var info = this.bugInfo[bug]; + var data = this.createBug(bug, info); - if (data) - this.sendData.push(data); - } + if (data) + this.sendData.push(data); } }; @@ -216,7 +205,6 @@ Step.prototype.onSubmitError = function Step_onSubmitError(where, msg, i) { // - an invalid api key was supplied // - the bug we were trying to load is a security bug (shouldn't happen, unless someone // changed the bug underneath us after the initial bug data load) - // - a tester remapped to a non-existant bug on landfill, (they should know better :)) // If we've failed trying to get the time/token on our very first bug, let's just put it // down to api key, and abandon this submit attempt // If we failed in the i-1th bug too, again abandon all hope. (Did you change your password while bugherder was working?!?) @@ -339,10 +327,6 @@ Step.prototype.getLastChangeAndToken = function Step_getLastChangeAndToken(i, ca Step.prototype.submit = function Step_submit(i) { - // we start with an utterly unsophisticated hack for debugging/testing - if (Step.remaps.items > 0 && Step.remaps.midair) - alert('MID-AIR TIME!'); - var self = this; var callback = function Step_submitCallback(errmsg, data) { if (errmsg) @@ -368,16 +352,6 @@ Step.prototype.postSubmit = function Step_postSubmit(i) { this.sent.push(sent); var bugID = sent.id; - // If we were in remapping mode, we need to reverse the mapping! - for (var k in Step.remaps) { - if (k == 'items') - continue; - if (Step.remaps[k] == bugID) { - bugID = k; - break; - } - } - var info = this.bugInfo[bugID]; // Disallow resolving if we just resolved the bug @@ -1014,8 +988,6 @@ Step.prototype.getHelpText = function Step_getHelpText() { if (this.statusChangeBugs.length > 0 && Config.treeInfo[Config.treeName].unconditionalFlag) helpText += '
- Submitted bugs will have ' + bugherder.statusFlag + ' set to "fixed"'; - if (Step.remaps && 'items' in Step.remaps && Step.remaps.items > 0) - helpText += '
Note: You are in debug mode. Only remap bugs will be submitted, and will be submitted to landfill.bugzilla.org!'; return helpText; }; diff --git a/bugherder/js/ViewerController.js b/bugherder/js/ViewerController.js index b93ae39..bbd8933 100644 --- a/bugherder/js/ViewerController.js +++ b/bugherder/js/ViewerController.js @@ -1,8 +1,7 @@ "use strict"; var ViewerController = { - init: function vc_Init(remap, resume) { - this.remap = remap; + init: function vc_Init(resume) { this.currentStep = -1; this.maxStep = -1; this.steps = []; diff --git a/bugherder/js/bugherder.js b/bugherder/js/bugherder.js index 3a47e19..b5cce69 100644 --- a/bugherder/js/bugherder.js +++ b/bugherder/js/bugherder.js @@ -4,7 +4,6 @@ var bugherder = { debug: false, expand: false, milestone: null, - remap: false, resume: false, tree: null, trackingFlag: null, @@ -376,25 +375,13 @@ var bugherder = { return; } - this.remaps = {items: 0}; - - if (this.remap) - Remapper.show(); - else - this.showSteps(); - }, - - - onRemap: function mcM_onRemap(remaps) { - this.remaps = remaps; this.showSteps(); }, showSteps: function mcM_showSteps() { - Step.remaps = this.remaps; Viewer.expand = this.expand; - ViewerController.init(this.remap, this.resume); + ViewerController.init(this.resume); Viewer.init(); // How many stages do we have? @@ -471,8 +458,6 @@ var bugherder = { this.debug = (paramsObj['debug'][0] == '1'); if ('expand' in paramsObj) this.expand = (paramsObj['expand'][0] == '1'); - if ('remap' in paramsObj) - this.remap = (paramsObj['remap'][0] == '1'); if ('resume' in paramsObj) this.resume = (paramsObj['resume'][0] == '1'); @@ -538,7 +523,7 @@ var bugherder = { } // Maintain various parameters across page loads - var persisted = ['debug', 'expand', 'remap', 'resume']; + var persisted = ['debug', 'expand', 'resume']; persisted.forEach(persist, this); var newURL = document.location.href.split('?')[0]; diff --git a/test/SpecRunner.html b/test/SpecRunner.html index e288684..9b8abb2 100644 --- a/test/SpecRunner.html +++ b/test/SpecRunner.html @@ -25,7 +25,6 @@ -