Closed Bug 879813 Opened 12 years ago Closed 12 years ago

support version 2 & 4 url schemas in balrog

Categories

(Release Engineering :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bhearsum, Assigned: bhearsum)

References

Details

(Whiteboard: [balrog])

Attachments

(1 file, 1 obsolete file)

Nick and I talked about this a lot yesterday and decided that we could support these without changing the schema of the database or fixing bug 855833 in general. Specifically, version 2 is a subset of version 3, so we can use the existing rules and just ignore "distribution" and "distribution version" parts of them. Version 4 is a superset, but the added field has never been used - it's always matched %VERSION%. We can use existing rules for this too, and simply ignore the last part of the URL.
Whiteboard: [balrog]
https://github.com/bhearsum/balrog/compare/mozilla:master...schema-2-4 seems to do the trick. It took a suspiciously short amount of time...not putting up for review yet for fear that I've missed something terribly important. Probably needs some polish/comments too.
Attached patch support schema versions 2 & 4 (obsolete) — Splinter Review
This is pretty much the bare minimum we need to do to support them. In addition to the unit tests I also did local testing with a db dump. I was able to get to the point of getting an exception about hashFunction when querying http://localhost:8000/update/4/Fennec/21.0a1/20130126143652/Android_arm-eabi-gcc3/en-US/nightly/4.1.1/default/default/21.0a1/update.xml. (That's normal when hashFunction isn't set in the blob.) Couple of other small fixes in here: * Fix tests not to depend on ordered lists that come from a 'select foo from bar' query.. I just upgraded my OS, and it seems that these are not guaranteed to be the same in all situations. * Fix AUS-server.py to work with existing or nonexisting dbs. I'm happy to change impl if you're not happy with this, so don't hold back!
Assignee: nobody → bhearsum
Status: NEW → ASSIGNED
Attachment #759387 - Flags: review?(nthomas)
Comment on attachment 759387 [details] [diff] [review] support schema versions 2 & 4 r- for the testVersion2GetIgnoresRuleWithDistribution question, otherwise a few nits but fine. >diff --git a/auslib/test/web/test_client.py b/auslib/test/web/test_client.py >+ AUS.releases.t.insert().execute(name='c', product='c', version='c', data_version=1, data=""" >+{ >+ "name": "c", >+ "schema_version": 1, >+ "appv": "c", >+ "extv": "c", >+ "hashFunction": "sha512", >+ "platforms": { >+ "p": { >+ "buildID": 1, >+ "locales": { >+ "l": { >+ "complete": { >+ "filesize": 1, >+ "from": "*", >+ "hashValue": "1", >+ "fileUrl": "a" Would be worth setting filesize, hashValue, fileUrl to different values from the b release, to avoid accidental test passes. >+ def testVersion2Get(self): Lets rename testGet() to testVersion3Get() for consistency. >+ def testVersion2GetIgnoresRuleWithDistribution(self): What sense do you mean 'Ignores' here ? The test is ensuring release c is returned, rather than no update. Did you mean to add an else block in auslib/db.py to make sure distribution and distVersion are undefined for update/2/ ? That probably makes sense from business logic pov. >+ def testVersion4Get(self): >+ ret = self.client.get('/update/3/b/b/1/p/l/a/a/a/a/b/update.xml') The url should be update/4 instead of update/3. >diff --git a/auslib/web/base.py b/auslib/web/base.py >+app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/update.xml', view_func=ClientRequestView.as_view('clientrequest')) > app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/<distribution>/<distVersion>/update.xml', view_func=ClientRequestView.as_view('clientrequest')) >+app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/<distribution>/<distVersion>/<platformVersion>/update.xml', view_func=ClientRequestView.as_view('clientrequest')) I see the utility in automatically parsing queryVersion here, but in some ways it would be nicer to be explicit. Could we add comments to identify the value of queryVersion for each rule ?
Attachment #759387 - Flags: review?(nthomas) → review-
(In reply to Nick Thomas [:nthomas] from comment #3) > >+ "fileUrl": "a" > > Would be worth setting filesize, hashValue, fileUrl to different values from > the b release, to avoid accidental test passes. > >+ def testVersion2Get(self): > > Lets rename testGet() to testVersion3Get() for consistency. Will do. > >+ def testVersion2GetIgnoresRuleWithDistribution(self): > > What sense do you mean 'Ignores' here ? The test is ensuring release c is > returned, rather than no update. Yeah, this is poorly named...it should probably be called "Version2GetIgnoresDistributionInRule" > Did you mean to add an else block in > auslib/db.py > to make sure distribution and distVersion are undefined for update/2/ ? That > probably makes sense from business logic pov. Hm. I thought we'd decided that version 2 queries would ignore distribution values when evaluating rules. I guess we get a little bit more flexibility if we do it this way though...so that seems like a good idea. > > >+ def testVersion4Get(self): > >+ ret = self.client.get('/update/3/b/b/1/p/l/a/a/a/a/b/update.xml') > > The url should be update/4 instead of update/3. D'oh. > >diff --git a/auslib/web/base.py b/auslib/web/base.py > >+app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/update.xml', view_func=ClientRequestView.as_view('clientrequest')) > > app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/<distribution>/<distVersion>/update.xml', view_func=ClientRequestView.as_view('clientrequest')) > >+app.add_url_rule('/update/<int:queryVersion>/<product>/<version>/<buildID>/<buildTarget>/<locale>/<channel>/<osVersion>/<distribution>/<distVersion>/<platformVersion>/update.xml', > view_func=ClientRequestView.as_view('clientrequest')) > > I see the utility in automatically parsing queryVersion here, but in some > ways it would be nicer to be explicit. Could we add comments to identify the > value of queryVersion for each rule ? Previously, I thought that queryVersion wouldn't get passed to ClientRequestView if specified explicitly but I just did some digging, and it looks like you can set defaults per rule. I agree that it's nicer to be explicit, so I'll make that change.
Assuming we're on the same page about how to handle version 2 queries, I think this should address everything...
Attachment #759387 - Attachment is obsolete: true
Attachment #759817 - Flags: review?(nthomas)
Comment on attachment 759817 [details] [diff] [review] address review comments The interdiff looks good to me.
Attachment #759817 - Flags: review?(nthomas) → review+
Commit pushed to master at https://github.com/mozilla/balrog https://github.com/mozilla/balrog/commit/6373821ed14e99e065336c14da0c3188e70def6c bug 879813: support version 2 & 4 url schemas in balrog. r=nthomas
Attachment #759817 - Flags: checked-in+
That's kinda fun. We don't want to serve the new attributes to anything that can't handle it. It might be this just works when we import some of the old cruft in the AUS2 snippets, I'd have to dig into bug 459972 and it's parents on the client side. Definitely has a bearing on bug 748698.
Flags: needinfo?(nthomas)
Oops, didn't notice you had the nightly channel there. That'd require some logic in Balrog instead, although we've long given up on any users on builds that ancient. At the time, the delay in implementing bug 459972 meant that we had well and truly given everyone a shot at getting a build that groks the new attributes.
Product: mozilla.org → Release Engineering
Component: General Automation → General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: