Add 302 redirects from TBPL to Treeherder

RESOLVED FIXED

Status

defect
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: emorley, Assigned: emorley)

Tracking

Details

Attachments

(2 attachments)

This is bug 1054977 comment 6's step #1:

(In reply to Ed Morley (Away 23rd March -> 1st April) [:edmorley] from comment #6)
> Rough plan:
> 0) Ensure bug 1050477 (mcMerge migration) is complete.
> 1) Add 302 entries to the in-repo .htaccess to redirect users to Treeherder
> (https://hg.mozilla.org/webtools/tbpl/file/default/.htaccess).
> 2) Ask for the TBPL import-buildbot-data.py cron to be stopped (for both
> prod and dev). At this point TBPL won't be consuming any resources beyond
> the redirects.
> 3) Announce TBPL EOL to dev.tree-management.
> 4) Presuming those 302s work ok, convert them to 301s after a day or two
> (http://getluky.net/2010/12/14/301-redirects-cannot-be-undon/)
...
Blocks: tbpl-eol
Summary: Add 302 redirects to treeherder → Add 302 redirects from TBPL to Treeherder
We'll also 302 redirect mcMerge, which depends on bug 1050477.
Depends on: 1050477
Notes:

https://tbpl.mozilla.org/mcmerge/.*
-> https://mcmerge.paas.allizom.org/.*

For TBPL, since it uses custom tree names, it makes the redirects more annoying. As such, I think I'll only add specific redirects (ie &revision and &author) for Try, and for the rest, I'll just redirect to the repo on treeherder with no additional URL params.

https://tbpl.mozilla.org/?tree=TBPL-REPO-NAME&rev=REV
-> https://treeherder.mozilla.org/#/jobs?repo=REPO&revision=REV

https://tbpl.mozilla.org/?tree=TBPL-REPO-NAME&pusher=EMAIL
-> https://treeherder.mozilla.org/#/jobs?repo=REPO&author=EMAIL

https://tbpl.mozilla.org/?tree=TBPL-REPO-NAME
-> https://treeherder.mozilla.org/#/jobs?repo=REPO

And for anything else:
https://tbpl.mozilla.org/.*
-> https://treeherder.mozilla.org/
Feedback from anyone welcome; it works well enough when I tested locally, but I think the best way to check for sure is just to land it and try it out on tbpl-dev before deploying. I've intentionally used 302s for now, since it's hard to unbreak 301s once in production - we can convert them to 301s later.

* Redirects mcMerge to the new paas instance.
* Excludes the cache directory from all rules, so we can still access the
  revision info / data-import logs.
* Returns a 403 forbidden rather than redirecting, for things under php/, so API
  consumers get a more obvious failure mode.
* Redirects common trees to the appropriate URL on Treeherder (for all others,
  redirects to the Treeherder homepage).
* For the common trees, preserves/converts the pusher or revision filter params,
  but removes any others since they'd require overly complex mapping to their
  equivalents on Treeherder.
* For anything else, just redirect to the Treeherder homepage.
Testcases, when this lands on tbpl-dev...

eg:
$ curl -Is "http://tbpl/?tree=Try&rev=8d25899e86a6" | egrep '(HTTP|Location)'
HTTP/1.1 302 Found
Location: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8d25899e86a6

==

Should redirect to Treeherder with all params preserved:
https://tbpl-dev.allizom.org/?tree=Try&rev=8d25899e86a6
https://tbpl-dev.allizom.org/?tree=Try&pusher=email@mozilla.com
https://tbpl-dev.allizom.org/?tree=Try
https://tbpl-dev.allizom.org/?tree=Mozilla-Inbound&rev=7c491d4a0e06
https://tbpl-dev.allizom.org/?tree=Mozilla-Inbound

Will have unrecognised params removed, but others preserved:
https://tbpl-dev.allizom.org/?foo=1&tree=Try&rev=8d25899e86a6&bar=2
https://tbpl-dev.allizom.org/?foo=1&tree=Try&pusher=email@mozilla.com&bar=2
https://tbpl-dev.allizom.org/?foo=1&tree=Try&bar=2

Should redirect to Treeherder homepage with params discarded:
https://tbpl-dev.allizom.org
https://tbpl-dev.allizom.org/
https://tbpl-dev.allizom.org/?tree=unknownTree
https://tbpl-dev.allizom.org/?pusher=email@mozilla.com&tree=Try
https://tbpl-dev.allizom.org/?foo=1
https://tbpl-dev.allizom.org/robots.txt
https://tbpl-dev.allizom.org/non-existent

Should redirect to mcMerge's paas instance with params preserved:
https://tbpl-dev.allizom.org/mcmerge
https://tbpl-dev.allizom.org/mcmerge/
https://tbpl-dev.allizom.org/mcmerge/?cset=2a404169de2d&tree=mozilla-central

Should return a 403 forbidden:
https://tbpl-dev.allizom.org/php
https://tbpl-dev.allizom.org/php/
https://tbpl-dev.allizom.org/php/getRevisionBuilds.php?branch=try&ignore_deprecation_notice=1&rev=bf1b63230977

Should still be accessible:
https://tbpl-dev.allizom.org/cache
https://tbpl-dev.allizom.org/cache/
https://tbpl-dev.allizom.org/cache/revision_info.txt
Attachment #8581156 - Attachment mime type: application/x-shellscript → text/plain
Comment on attachment 8581151 [details] [diff] [review]
Add 302 redirects from TBPL to Treeherder/mcMerge

The testcases looked fine locally, so I've landed this to allow for further testing on tbpl-dev (eg I'd rather find out now than later if mod_rewrite isn't enabled etc).

https://hg.mozilla.org/webtools/tbpl/rev/73ad7a52c30e
Looks fine to me :-)

$ ./tbpl-redirect-testing.sh

https://tbpl-dev.allizom.org/?tree=Try&rev=8d25899e86a6
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8d25899e86a6

https://tbpl-dev.allizom.org/?tree=Try&pusher=email@mozilla.com
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try&author=email@mozilla.com

https://tbpl-dev.allizom.org/?tree=Try
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try

https://tbpl-dev.allizom.org/?tree=Mozilla-Inbound&rev=7c491d4a0e06
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=7c491d4a0e06

https://tbpl-dev.allizom.org/?tree=Mozilla-Inbound
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound

https://tbpl-dev.allizom.org/?foo=1&tree=Try&rev=8d25899e86a6&bar=2
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8d25899e86a6

https://tbpl-dev.allizom.org/?foo=1&tree=Try&pusher=email@mozilla.com&bar=2
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try&author=email@mozilla.com

https://tbpl-dev.allizom.org/?foo=1&tree=Try&bar=2
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try

https://tbpl-dev.allizom.org
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/?tree=unknownTree
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/?pusher=email@mozilla.com&tree=Try
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/#/jobs?repo=try

https://tbpl-dev.allizom.org/?foo=1
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/robots.txt
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/non-existent
-> HTTP/1.1 302 Found
-> Location: https://treeherder.mozilla.org/

https://tbpl-dev.allizom.org/mcmerge
-> HTTP/1.1 302 Found
-> Location: https://mcmerge.paas.allizom.org/

https://tbpl-dev.allizom.org/mcmerge/
-> HTTP/1.1 302 Found
-> Location: https://mcmerge.paas.allizom.org/

https://tbpl-dev.allizom.org/mcmerge/?cset=2a404169de2d&tree=mozilla-central
-> HTTP/1.1 302 Found
-> Location: https://mcmerge.paas.allizom.org/?cset=2a404169de2d&tree=mozilla-central

https://tbpl-dev.allizom.org/php
-> HTTP/1.1 403 Forbidden

https://tbpl-dev.allizom.org/php/
-> HTTP/1.1 403 Forbidden

https://tbpl-dev.allizom.org/php/getRevisionBuilds.php?branch=try&ignore_deprecation_notice=1&rev=bf1b63230977
-> HTTP/1.1 403 Forbidden

https://tbpl-dev.allizom.org/cache
-> HTTP/1.1 301 Moved Permanently
-> Location: https://tbpl-dev.allizom.org/cache/

https://tbpl-dev.allizom.org/cache/
-> HTTP/1.1 200 OK

https://tbpl-dev.allizom.org/cache/revision_info.txt
-> HTTP/1.1 200 OK
Deployed now, since we'll need a couple of days to check it's working before switching things off, and we want to switch TBPL off before the end of the month. The EOL announcement also said "end of the month" rather than 31st March specifically, so I don't see this as contrary to that.

I've tested against tbpl-prod using the attached script (with domain edited), and everything works fine.

If others want to verify in-browser, try the following subset of those tests:

https://tbpl.mozilla.org
https://tbpl.mozilla.org/?tree=Mozilla-Inbound
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=7c491d4a0e06
https://tbpl.mozilla.org/?tree=Try
https://tbpl.mozilla.org/?tree=Try&rev=8d25899e86a6
https://tbpl.mozilla.org/mcmerge/

Deploy log:

[localhost] out: Changelog: https://hg.mozilla.org/webtools/tbpl/pushloghtml?fromchange=e6720cf640e1&tochange=73ad7a52c30e
[2015-03-29 07:47:30] [localhost] running: cd /data/genericrhel6/src/tbpl.mozilla.org/tbpl && hg pull -u -v -r 73ad7a52c30e
[2015-03-29 07:47:32] [localhost] finished: cd /data/genericrhel6/src/tbpl.mozilla.org/tbpl && hg pull -u -v -r 73ad7a52c30e (2.001s)
[localhost] out: pulling from http://hg.mozilla.org/webtools/tbpl
[localhost] out: searching for changes
[localhost] out: all local heads known remotely
[localhost] out: adding changesets
[localhost] out: adding manifests
[localhost] out: adding file changes
[localhost] out: added 2 changesets with 2 changes to 2 files
[localhost] out: resolving manifests
[localhost] out: removing mcmerge/LICENSE
[localhost] out: removing mcmerge/README.md
[localhost] out: removing mcmerge/css/opensans.woff
[localhost] out: removing mcmerge/css/style.css
[localhost] out: removing mcmerge/images/background.png
[localhost] out: removing mcmerge/images/holly.png
[localhost] out: removing mcmerge/images/sky.png
[localhost] out: removing mcmerge/images/snowy.jpg
[localhost] out: removing mcmerge/index.html
[localhost] out: removing mcmerge/js/BugData.js
[localhost] out: removing mcmerge/js/Config.js
[localhost] out: removing mcmerge/js/ConfigurationData.js
[localhost] out: removing mcmerge/js/DebugUI.js
[localhost] out: removing mcmerge/js/FlagLoader.js
[localhost] out: removing mcmerge/js/PushData.js
[localhost] out: removing mcmerge/js/Remapper.js
[localhost] out: removing mcmerge/js/Step.js
[localhost] out: removing mcmerge/js/Summary.js
[localhost] out: removing mcmerge/js/UI.js
[localhost] out: removing mcmerge/js/Utils.js
[localhost] out: removing mcmerge/js/Viewer.js
[localhost] out: removing mcmerge/js/ViewerController.js
[localhost] out: removing mcmerge/js/mcMerge.js
[localhost] out: removing mcmerge/thirdparty/bzjs/bz-0.3.0.js
[localhost] out: removing mcmerge/thirdparty/jquery/MIT-LICENSE.txt
[localhost] out: removing mcmerge/thirdparty/jquery/jquery-1.7.2.min.js
[localhost] out: removing mcmerge/thirdparty/toast/grid.css
[localhost] out: removing mcmerge/thirdparty/toast/reset.css
[localhost] out: removing mcmerge/thirdparty/toast/toast.css
[localhost] out: removing mcmerge/thirdparty/toast/type.css
[localhost] out: getting .htaccess
[localhost] out: getting js/Config.js
[localhost] out: 2 files updated, 0 files merged, 30 files removed, 0 files unresolved
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Blocks: 1148915
Product: Tree Management → Tree Management Graveyard
You need to log in before you can comment on or make changes to this bug.