Closed Bug 592060 Opened 14 years ago Closed 14 years ago

Create custom hgpoller for shadow-central that can poll https:// pushlog

Categories

(Release Engineering :: General, defect, P3)

x86
All
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: lsblakk, Assigned: catlee)

References

Details

(Whiteboard: [sg:nse])

Attachments

(2 files, 2 obsolete files)

This bug is to track the following changes to shadow-central:

Take out the hgHost for shadow-central (which has been throwing errors): http://hg.mozilla.org/build/buildbot-configs/file/5aeb32b3f87e/mozilla/config.py#l729

Create an hg commit hook that will do a sendchange to production-master01:9009 when a new change is submitted to the private repo.

When this is done we should be able to (still) do force builds on shadow-central repo as well as see builds triggered by shadow-central checkins
Is the one catlee is working on (or at least thinking about), or is that an alternate approach tracked in a different bug?
Summary: Take out shadow-central hgpoller and create an hg commit hook that does sendchange → Create custom hgpoller for shadow-central that can poll https:// pushlog
Assignee: lsblakk → catlee
Priority: -- → P3
I can't see "depends on" bug 598681 -- is that an IT request to deploy this? If so, how is it coming?
(In reply to comment #2)
> I can't see "depends on" bug 598681 -- is that an IT request to deploy this? If
> so, how is it coming?

Catlee can only get so far in staging trying to test an https custom poller, he needs an account with credentials so we can poll https://hgpvt.m.o
repositories to see if there are new changes that require building and test that we're actually getting the builds to trigger properly.
(In reply to comment #1)
> Is the one catlee is working on (or at least thinking about), or is that an
> alternate approach tracked in a different bug?

And yes, it's an IT request to get that LDAP account set up.
Attachment #482964 - Flags: feedback?(nrthomas)
Attachment #482964 - Flags: feedback?
Attachment #482964 - Flags: feedback? → feedback?(bhearsum)
Comment on attachment 482964 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

>diff --git a/bin/hgpoller.py b/bin/hgpoller.py
>+    if branch_state['last_run'] + interval > time.time():
>+        log.debug("Skipping %s, too soon since last run", branch)
>+        return

I think this is a comparison between a smallish integer (300) and an epoch timestamp. Otherwise looks good.
Attachment #482964 - Flags: feedback?(nrthomas) → feedback+
Comment on attachment 482964 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

>+def sendchange(master, branch, change):
>+    log.info("Sendchange %s to %s on branch %s", change['changeset'], master, branch)
>+    cmd = ['buildbot', 'sendchange',
>+            '--master', master,
>+            '--branch', branch,
>+            '--comments', change['comments'],
>+            '--revision', change['changeset'],
>+            '--user', change['author'],
>+            '--when', str(change['updated']),
>+            ]
>+    cmd.extend(change['files'])
>+    subprocess.check_call(cmd)

Might be better to run this through retry_command for better chance of success.


Just want to make sure I understand how this will be run, too. It looks like we'll be providing an initial config file with basic information, branch information, etc. The poller is then going to use this file to store state? And is it running through cron?
Attachment #482964 - Flags: feedback?(bhearsum) → feedback+
(In reply to comment #6)
> Comment on attachment 482964 [details] [diff] [review]
> external buildbot poller that supports checking certs for https urls
> 
> >diff --git a/bin/hgpoller.py b/bin/hgpoller.py
> >+    if branch_state['last_run'] + interval > time.time():
> >+        log.debug("Skipping %s, too soon since last run", branch)
> >+        return
> 
> I think this is a comparison between a smallish integer (300) and an epoch
> timestamp. Otherwise looks good.

Not sure what you mean here...That the operator precedence is wrong?
(In reply to comment #7)
> Comment on attachment 482964 [details] [diff] [review]
> external buildbot poller that supports checking certs for https urls
> 
> >+def sendchange(master, branch, change):
> >+    log.info("Sendchange %s to %s on branch %s", change['changeset'], master, branch)
> >+    cmd = ['buildbot', 'sendchange',
> >+            '--master', master,
> >+            '--branch', branch,
> >+            '--comments', change['comments'],
> >+            '--revision', change['changeset'],
> >+            '--user', change['author'],
> >+            '--when', str(change['updated']),
> >+            ]
> >+    cmd.extend(change['files'])
> >+    subprocess.check_call(cmd)
> 
> Might be better to run this through retry_command for better chance of success

Good idea

> Just want to make sure I understand how this will be run, too. It looks like
> we'll be providing an initial config file with basic information, branch
> information, etc. The poller is then going to use this file to store state? And
> is it running through cron?

The state is stored in an auxiliary file, specified by the 'state_file' option in the config (defaults to 'state.json').  This file gets updated by the script, and the original config file is untouched.  The state file stores the times we last polled for data, as well as the last known changeset for the repo.
And yes, running through cron for now.  We could set something up in buildbot to run this command too.  SubprocessPoller?
(In reply to comment #10)
> And yes, running through cron for now.  We could set something up in buildbot
> to run this command too.  SubprocessPoller?

I'm not really picky, was just wondering.
(In reply to comment #6)
> >+    if branch_state['last_run'] + interval > time.time():
> I think this is a comparison between a smallish integer (300) and an epoch
> timestamp. Otherwise looks good.

Gah, I just parsed it wrong in my head. Maybe it's easier to read if written as 
  if time.time() > branch_state['last_run'] + interval
though.
Addresses your comments.

'retry.py' needs to be in $PATH somewhere.  I was thinking of symlinking it from ~/bin to the tools checkout the masters have?
Attachment #482964 - Attachment is obsolete: true
Attachment #485303 - Flags: review?(nrthomas)
Attachment #485303 - Flags: review?(bhearsum)
Comment on attachment 485303 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

>+    cmd = ['retry.py', '-r', '5', '-s', '5', '-t', '1800',
>+            '--stdout-regexp', 'change sent successfully']
...
>+    subprocess.check_call(cmd)

This script looks OK for polling shadow-central, but do you think this blocking call will be OK if we end up polling multiple repositories ? I'm concerned that a 30 minute timeout on each sendchange attempt will delay changes from other branches. Perhaps it's better to fail quickly and not update the tip in the state, then try again next time the poller runs.
Attachment #485303 - Flags: review?(bhearsum) → review+
(In reply to comment #14)
> Comment on attachment 485303 [details] [diff] [review]
> external buildbot poller that supports checking certs for https urls
> 
> >+    cmd = ['retry.py', '-r', '5', '-s', '5', '-t', '1800',
> >+            '--stdout-regexp', 'change sent successfully']
> ...
> >+    subprocess.check_call(cmd)
> 
> This script looks OK for polling shadow-central, but do you think this blocking
> call will be OK if we end up polling multiple repositories ? I'm concerned that
> a 30 minute timeout on each sendchange attempt will delay changes from other
> branches. Perhaps it's better to fail quickly and not update the tip in the
> state, then try again next time the poller runs.

Sure, I can change it to what...30 seconds instead?
Differences from previous:
* change sendchange timeout to 30s
* fix unicode encoding problems on comments and authors
* change log levels so it's less noisy by default
* add branch configuration parameter, default_branch_only, which defaults to true.  If true, only pushes on the default branch will be used.  If false, all pushes will be used.  We could use this for the try branch.
* actually ignore off-default pushes when default_branch_only is set
Attachment #485303 - Attachment is obsolete: true
Attachment #485756 - Flags: review?(nrthomas)
Attachment #485756 - Flags: review?(bhearsum)
Attachment #485303 - Flags: review?(nrthomas)
Comment on attachment 485756 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

Thanks for the summary of the differences, looks good.
Attachment #485756 - Flags: review?(bhearsum) → review+
Comment on attachment 485756 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

Looks good.
Attachment #485756 - Flags: review?(nrthomas) → review+
Comment on attachment 485756 [details] [diff] [review]
external buildbot poller that supports checking certs for https urls

changeset:   1026:140e3c0e22a6
Attachment #485756 - Flags: checked-in+
Set up on pm01 in ~/poller.  The pushlog is empty currently, so haven't been able to verify.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Attachment #486454 - Flags: review?(nrthomas) → review+
Attachment #486454 - Flags: checked-in+
Product: mozilla.org → Release Engineering
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: