Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#356 closed change (fixed)

Implement Chrome Web Store API in order to update the devbuild

Reported by: sebastian Assignee: sebastian
Priority: P1 Milestone:
Module: Automation Keywords:
Cc: fhd, trev, smultron45@… Blocked By:
Blocking: #364 Platform:
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/5092904657747968/
http://codereview.adblockplus.org/5673709830406144/
http://codereview.adblockplus.org/6043052758007808/
http://codereview.adblockplus.org/6282207912001536/

Description (last modified by sebastian)

Background

We have to publish our devbuild in the Chrome Web Store (see #364), but want keep the devbuild automatically in sync with the content of the repository.

What to change

Use the Chrome Webstore API to automatically update the devbuild in the Web Store whenever a new devbuild is available.

Change History (23)

comment:1 Changed 5 years ago by sebastian

  • Summary changed from Get devbuilds in to the Chrome Web Store to Publish the devbuild on the Chrome Web Store

comment:2 Changed 5 years ago by mapx

  • Cc smultron45@… added

comment:3 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed 5 years ago by sebastian

  • Blocking 364 added

comment:5 Changed 5 years ago by sebastian

  • Description modified (diff)
  • Summary changed from Publish the devbuild on the Chrome Web Store to Implement Chrome Web Store API in order to update the devbuild

comment:6 Changed 5 years ago by sebastian

  • Owner set to sebastian
  • Status changed from reviewing to assigned

comment:7 Changed 5 years ago by sebastian

  • Resolution set to fixed
  • Status changed from assigned to closed
Last edited 5 years ago by sebastian (previous) (diff)

comment:8 Changed 5 years ago by trev

This broke development build generation:

AttributeError: 'NightlyBuild' object has no attribute 'type'

Fixed it in https://hg.adblockplus.org/sitescripts/rev/75f3cfd0eb82

comment:9 Changed 5 years ago by trev

  • Ready set
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening: we need to specify a separate gallery ID for the devbuild upload (usual gallery ID is the stable version). Also, we need to make sure that the build isn't just uploaded but also published - currently it stays there as a draft.

comment:10 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

comment:12 Changed 5 years ago by trev

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening once again - while the draft upload succeeds now, publishing doesn't. The processing of the upload request overwrites the response variable, consequently the publish request fails when it tries to use response['token_type'].

comment:13 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

comment:14 Changed 5 years ago by sebastian

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:15 Changed 5 years ago by trev

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening once more - this time I got "400 Bad Request" from the publish request. Feel free to test your changes before uploading a review ;)

comment:16 Changed 5 years ago by sebastian

That is not that easy, since I don't have access to our CWS account. I would have to publish a clone of Adblock Plus or at least a dummy extension with my personal CWS account, which would not only take a while to get published, but might also be against the CWS policy.

So could you please wrap the urlopen() call like following and post the error here? Thanks.

try:
   response = json.load(urllib2.urlopen(...))
except urllib2.HTTPError as e:
   print e.read()

comment:17 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

Apparently the publish URL was wrong. Should be fixed with the new patch. If you still get an error, please provide the error response body, since I can only hardly reproduce it myself.

comment:18 Changed 5 years ago by trev

The error was: "reason":"badContent","message":"Unsupported content with type: application/octet-stream". Turned out the endpoint URL is wrong, it's https://www.googleapis.com/chromewebstore/v1.1/items/%s/publish - without upload.

After fixing this the upload succeeded but produced an exception with the status message OK - it seems that the documentation doesn't list all the possible statuses. So please extend the exception code there to report the actual status as well, next time we'll know what the Web Store returns on success.

Finally, please make sure to always report response body here to make debugging easier. Most clean solution should be implementing an own HTTPErrorProcessor class.

comment:19 Changed 5 years ago by philll

  • Cc philll removed

comment:20 Changed 5 years ago by sebastian

  • Status changed from reviewing to reopened

I leave the ticket open, since we still have to figure out and add the status, that is returned when the item were successfuly published.

https://hg.adblockplus.org/sitescripts/rev/d57a01bb362f
https://hg.adblockplus.org/sitescripts/rev/3a02793b406a
https://hg.adblockplus.org/sitescripts/rev/f02c4c3c2ad5

Last edited 5 years ago by sebastian (previous) (diff)

comment:21 Changed 5 years ago by trev

There was a typo in one of the changes, the class is referred to as HTTPErrorHandler rather than HTTPErrorBodyHandler.

After fixing it, the exception is {'status': [u'OK'], 'statusDetail': [u'OK.']} - so the status is apparently indeed OK.

comment:23 Changed 5 years ago by sebastian

  • Cc sebastian removed
Note: See TracTickets for help on using tickets.