Closed Bug 1212616 Opened 9 years ago Closed 6 years ago

Setup updates for b2gdroid

Categories

(Release Engineering :: General, defect)

defect
Not set
normal

Tracking

(b2g-v2.5 fixed)

RESOLVED FIXED
Tracking Status
b2g-v2.5 --- fixed

People

(Reporter: fabrice, Assigned: jlund)

References

Details

Attachments

(6 files, 2 obsolete files)

      No description provided.
Depends on: 1213020
to support nightlies/updates in Taskcluster, we will need the completion of 1149789. Expected ETA for completion on that service is early to mid q4.
Depends on: 1149789
incoming temp hack patch!

this does the following:

1) runs nightly_promotion.py on cron at 10am pt everyday
   * we don't need 3am pt since this is a promotion nightly and won't take up resources. so it be better to run this during normal hours
2) extends your script/gist: http://people.mozilla.org/~jlund/nightly_promotion_gist.interdiff.diff
    * removes aries from CONFIGS for now (it's not tested)
    * adds credential, log, and cache args to the script
    * runs two requests to balrog, one to update nightly-latest and one for nightly-{buildid}
    * fixes up variables to match expected b2gdroid xml


I have run this locally and was successful in adding the two blobs: https://aus4-dev.allizom.org/update/4/B2GDroid/44.0a1/20151022102827/Android_arm-eabi-gcc3/en-US/nightly/5.1.1/default/default/44.0a1/update.xml

As for running this puppet code in prod, I have only done a --noop to make sure there are no puppet errors but I have not actually applied this to master91:

Notice: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/File[/builds/nightlypromotion]/ensure: current_value absent, should be directory (noop)
Notice: /Stage[main]/Nightlypromotion/File[/builds/nightlypromotion/nightly_promotion.py]/ensure: current_value absent, should be file (noop)
Notice: /Stage[main]/Nightlypromotion/File[/etc/cron.d/run_nightly_promotion]/ensure: current_value absent, should be file (noop)
Notice: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Exec[virtualenv /builds/nightlypromotion]/returns: current_value notrun, should be 0 (noop)
Error: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Python::Virtualenv::Package[/builds/nightlypromotion||requests==2.8.1]/Exec[pip /builds/nightlypromotion||requests==2.8.1]: Could not evaluate: Could not find command '/builds/nightlypromotion/bin/python'
Error: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Python::Virtualenv::Package[/builds/nightlypromotion||wsgiref==0.1.2]/Exec[pip /builds/nightlypromotion||wsgiref==0.1.2]: Could not evaluate: Could not find command '/builds/nightlypromotion/bin/python'
Error: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Python::Virtualenv::Package[/builds/nightlypromotion||pip==1.5.5]/Exec[pip /builds/nightlypromotion||pip==1.5.5]: Could not evaluate: Could not find command '/builds/nightlypromotion/bin/python'
Error: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Python::Virtualenv::Package[/builds/nightlypromotion||mar==1.2]/Exec[pip /builds/nightlypromotion||mar==1.2]: Could not evaluate: Could not find command '/builds/nightlypromotion/bin/python'
Error: /Stage[main]/Nightlypromotion/Python::Virtualenv[/builds/nightlypromotion]/Python::Virtualenv::Package[/builds/nightlypromotion||argparse==1.2.1]/Exec[pip /builds/nightlypromotion||argparse==1.2.1]: Could not evaluate: Could not find command '/builds/nightlypromotion/bin/python'
Notice: Python::Virtualenv[/builds/nightlypromotion]: Would have triggered 'refresh' from 2 events
Notice: Class[Nightlypromotion]: Would have triggered 'refresh' from 3 events
Notice: Stage[main]: Would have triggered 'refresh' from 2 events
Notice: Finished catalog run in 145.61 seconds


finally, we will also need to tweak two things on the balrog server

1) a new rule to correspond to B2GDroid-mozilla-central-nightly-latest
2) add the new 'B2GDroid' product to permissions of 'ffxbld/b2gbld'
Attachment #8679086 - Flags: review?(catlee)
Comment on attachment 8679086 [details] [diff] [review]
151026_1212616_nightly_promotion-puppet.patch

Review of attachment 8679086 [details] [diff] [review]:
-----------------------------------------------------------------

just a few nits - but we should be able to get going with this.

::: modules/nightlypromotion/files/nightly_promotion.py
@@ +96,5 @@
> +                    retval['buildID'] = conf.get('App', 'BuildID')
> +            finally:
> +                shutil.rmtree(tmpdir)
> +
> +    return retval

I always wanted to factor out the ini parsing logic in these two methods from the archive-unpacking logic...

@@ +147,5 @@
> +        self.auth = (username, credentials['balrog_credentials'][username])
> +        return self.auth
> +
> +    def update_release(self, product, schema_version, api, info, balrog_username, auth_file):
> +        session = requests.session()

can you put a comment here saying this is required to preserve the session cookie so that CSRF works?

@@ +229,5 @@
> +    log.debug('cache: %s', cache)
> +    save_cache(cache, args.cache_file)
> +
> +if __name__ == '__main__':
> +    parser = ArgumentParser(description='Process some integers.')

processing integers?

@@ +232,5 @@
> +if __name__ == '__main__':
> +    parser = ArgumentParser(description='Process some integers.')
> +    parser.add_argument('log_file', help='path of log file')
> +    parser.add_argument('cache_file', help='path of cache file ')
> +    parser.add_argument('auth_file', help='path of auth file ')

this is required, no?
Attachment #8679086 - Flags: review?(catlee) → review+
new and improved!

interdiff from last: http://people.mozilla.org/~jlund/nightly_promotion-puppet-interdiff.diff

what's changed

* adds ca_cert to balrog requests (needed for prod instance of update server)
* beefs up ArgumentParser
* logs url request exceptions to log file
* extracts dupe code from apk/mar ini parsing

side note: I added B2GDroid to list of products that can be modified by ffxbld in balrog permissions on prod instance.
Attachment #8680731 - Flags: review?(catlee)
right now, builds on m-c have a update_channel of 'default', which is the default for all jobs that do not specify a MOZ_UPDATE_CHANNEL.

like release_promotion, my thought here is to treat every b2gdroid m-c CI job as a nightly that can be promoted.
Attachment #8680733 - Flags: review?(catlee)
Attachment #8679086 - Attachment is obsolete: true
Attachment #8680731 - Flags: review?(catlee) → review+
Attachment #8680733 - Flags: review?(catlee) → review+
Comment on attachment 8680731 [details] [diff] [review]
151029_1212616_nightly_promotion-puppet.patch

thanks!
Attachment #8680731 - Flags: checked-in+
Assignee: nobody → jlund
Keywords: leave-open
almost there...

Oct 30 10:00:02 buildbot-master91.bb.releng.usw2.mozilla.com abrt: detected unhandled Python exception in '/builds/nightlypromotion/nightly_promotion.py'
Oct 30 10:00:03 buildbot-master91.bb.releng.usw2.mozilla.com abrtd: Executable '/builds/nightlypromotion/nightly_promotion.py' doesn't belong to any package and ProcessUnpackaged is set to 'no'

I noticed at the very least, I need to point to the venv interpreter of which I forgot in the call. I'm hoping that this addresses the log/messages error above.



--noop test against my puppet env:
Notice: /Stage[main]/Nightlypromotion/File[/etc/cron.d/run_nightly_promotion]/content:
--- /etc/cron.d/run_nightly_promotion   2015-10-29 12:17:18.319309094 -0700
+++ /tmp/puppet-file20151030-24542-kqx0c9-0     2015-10-30 11:58:31.745518147 -0700
@@ -1,2 +1,2 @@
 # This file is managed by puppet
-0 10 * * *     cltbld          /builds/nightlypromotion/nightly_promotion.py /builds/buildbot/build1/master/BuildSlaves.py /builds/buildbot/build1/tools/misc/certs/ca-bundle.crt --log-file /builds/nightlypromotion/nightly-promotion.log --cache-file /builds/nightlypromotion/cache.json
+0 10 * * *     cltbld          /builds/nightlypromotion/bin/python2.7 /builds/nightlypromotion/nightly_promotion.py /builds/buildbot/build1/master/BuildSlaves.py /builds/buildbot/build1/tools/misc/certs/ca-bundle.crt --log-file /builds/nightlypromotion/nightly-promotion.log --cache-file /builds/nightlypromotion/cache.json

Notice: /Stage[main]/Nightlypromotion/File[/etc/cron.d/run_nightly_promotion]/content: current_value {md5}20c22d73496597337f3ab38400cfa4f0, should be {md5}c32e18ae5d7188428bd2b1d0bd2c4415 (noop)
Notice: Class[Nightlypromotion]: Would have triggered 'refresh' from 1 events
Attachment #8681436 - Flags: review?(catlee)
Attachment #8681436 - Flags: review?(catlee) → review+
Comment on attachment 8681436 [details] [diff] [review]
151030_1212616_nightly_promotion_cron_venv-puppet.patch

thanks, in prod: https://hg.mozilla.org/build/puppet/rev/38dd44c57fe2
Attachment #8681436 - Flags: checked-in+
we don't want to set IS_NIGHTLY yet because triggers us to try to uploads symbols: https://dxr.mozilla.org/mozilla-central/source/mobile/android/b2gdroid/config/mozconfigs/common#7

for now, let's just set update_channel so we don't have to set the balrog rule against 'default'.
Attachment #8681585 - Flags: review?(catlee)
Attachment #8681585 - Flags: review?(catlee) → review+
closer still..

307 Subject: Cron <cltbld@buildbot-master91>    /builds/nightlypromotion/bin/python2.7 /builds/nightlypromotion/nightly_promotion.py /builds/buildbot/build1/master/BuildSlaves.py     /builds/buildbot/build1/tools/misc/certs/ca-bundle.crt --log-file /builds/nightlypromotion/nightly-promotion.log --cache-file /builds/nightlypromotion/cache.json
308 Content-Type: text/plain; charset=UTF-8
309 Auto-Submitted: auto-generated
310 X-Cron-Env: <LANG=en_US.UTF-8>
311 X-Cron-Env: <SHELL=/bin/sh>
312 X-Cron-Env: <HOME=/home/cltbld>
313 X-Cron-Env: <PATH=/usr/bin:/bin>
314 X-Cron-Env: <LOGNAME=cltbld>
315 X-Cron-Env: <USER=cltbld>
316
317 Traceback (most recent call last):
318   File "/builds/nightlypromotion/nightly_promotion.py", line 7, in <module>
319     import configparser
320 ImportError: No module named configparser

I forgot configparser was not in py2.7.

I uploaded latest release version to puppetagain repo. This patch installs it into the venv.

fabrice: I will try to land this before the next run @ 10am PT. However, even if I miss the run, I'll force it manually so we have updates to play with tomorrow :)
Attachment #8682336 - Flags: review?(catlee)
Comment on attachment 8682336 [details] [diff] [review]
151102_1212616_nightly_promotion-adds_configparser_to_venv-puppet.patch

Review of attachment 8682336 [details] [diff] [review]:
-----------------------------------------------------------------

it is, it's just called ConfigParser. https://docs.python.org/2/library/configparser.html

Or is this a different module you're using?
Attachment #8682336 - Flags: review?(catlee) → review-
looks like configparser is a backport of the latest version in python3. ConfigParser is what's available in python2.6-2.7

I also had to update the routes for b2gdroid as I guess the routes changed: https://tools.taskcluster.net/task-inspector/#bKJyf7ecSZyIFtcjQ_IWbQ/
Attachment #8682336 - Attachment is obsolete: true
Attachment #8682595 - Flags: review?(catlee)
Attachment #8682595 - Flags: review?(catlee) → review+
Comment on attachment 8682595 [details] [diff] [review]
151102_1212616_nightly_promotion-uses_ConfigParser_updates_routes-puppet.patch

thanks. will manually trigger the run once this syncs across machines
Attachment #8682595 - Flags: checked-in+
and we are looking pretty good!

2015-11-03 17:00:03,209 - downloading...
2015-11-03 17:00:03,210 - Starting new HTTPS connection (1): queue.taskcluster.net
2015-11-03 17:00:04,033 - Starting new HTTPS connection (1): public-artifacts.taskcluster.net
2015-11-03 17:00:11,798 - updating balrog: {'buildID': '20151103235627', 'displayVersion': '45.0a1', 'platformVersion': '45.0a1', 'completes': [{'fileUrl': 'https://queue.taskcluster.net/v1/task/LoB3AWNOS6WSe1GxnHShgw/artifacts/public/build/target.apk', 'hashValue': 'ea34f94dd347287b1fca33096291e176605854118cfd81396646b03641d0cef51db18322b24a61ebcfd30e011501c7ef312e281ae8f4f8011828a12b4127ad53', 'from': '*', 'filesize': 92420683}], 'appVersion': '45.0a1'}
2015-11-03 17:00:11,800 - Starting new HTTPS connection (1): aus4-admin.mozilla.org
2015-11-03 17:00:13,488 - previous release not found; creating a new one
2015-11-03 17:00:14,758 - Starting new HTTPS connection (2): aus4-admin.mozilla.org
2015-11-03 17:00:16,154 - Starting new HTTPS connection (1): aus4-admin.mozilla.org
2015-11-03 17:00:17,455 - previous release found; updating
2015-11-03 17:00:19,960 - saving cache

so we have some releases in the update server now.

I created a rule for b2gdroid against the nightly channel and confirmed that updates are being served to: https://aus4.mozilla.org/update/4/B2GDroid/44.0a1/20151022102827/Android_arm-eabi-gcc3/en-US/nightly/5.1.1/default/default/44.0a1/update.xml

IOW - we should have updates on a nightly basis now. Fabrice, how are things looking on your end?
r=rail

I deleted the file manually after pushing this.
Attachment #8685504 - Flags: review+
Depends on: 1223865
Component: General Automation → General
I think this bug outlived its usefulness.
Closing this, feel free to reopen if I'm wrong.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: