예제 #1
0
def _RunChild():
    del sys.argv[1] # The --spawn arg.
    # Create a new thread that just waits for the event to be signalled.
    t = threading.Thread(target=_WaitForShutdown,
                         args = (int(sys.argv[1]), )
                         )
    del sys.argv[1] # The stop handle
    # This child process will be sent a console handler notification as
    # users log off, or as the system shuts down.  We want to ignore these
    # signals as the service parent is responsible for our shutdown.

    def ConsoleHandler(what):
        # We can ignore *everything* - ctrl+c will never be sent as this
        # process is never attached to a console the user can press the
        # key in!
        return True
    win32api.SetConsoleCtrlHandler(ConsoleHandler, True)
    t.setDaemon(True) # we don't want to wait for this to stop!
    t.start()
    if hasattr(sys, "frozen"):
        # py2exe sets this env vars that may screw our child process - reset
        del os.environ["PYTHONPATH"]

    # Start the buildbot app
    from buildbot.scripts import runner
    runner.run()
    print "Service child process terminating normally."
예제 #2
0
def _RunChild():
    del sys.argv[1] # The --spawn arg.
    # Create a new thread that just waits for the event to be signalled.
    t = threading.Thread(target=_WaitForShutdown,
                         args = (int(sys.argv[1]), )
                         )
    del sys.argv[1] # The stop handle
    # This child process will be sent a console handler notification as
    # users log off, or as the system shuts down.  We want to ignore these
    # signals as the service parent is responsible for our shutdown.

    def ConsoleHandler(what):
        # We can ignore *everything* - ctrl+c will never be sent as this
        # process is never attached to a console the user can press the
        # key in!
        return True
    win32api.SetConsoleCtrlHandler(ConsoleHandler, True)
    t.setDaemon(True) # we don't want to wait for this to stop!
    t.start()
    if hasattr(sys, "frozen"):
        # py2exe sets this env vars that may screw our child process - reset
        del os.environ["PYTHONPATH"]

    # Start the buildbot app
    from buildbot.scripts import runner
    runner.run()
    print "Service child process terminating normally."
예제 #3
0
def remote(args):
    """
    Trigger tests on Builbot CI.
    """
    from buildbot.scripts import runner
    from io import BytesIO
    base_args = [
        'buildbot',
        'try',
        '--connect=pb',
        '--username=chevah_buildbot',
        '--passwd=chevah_password',
        '--master=build.chevah.com:10087',
        '--vc=git',
        ]
    out = BytesIO()
    if not args:
        sys.argv = base_args + ['--get-builder-names']
        sys.stdout = out
    else:
        sys.argv = base_args + args

    try:
        runner.run()
    except SystemExit as buildbot_exit:
        pass
    finally:
        sys.stdout = sys.__stdout__

    for line in out.getvalue().splitlines():
        if 'keycert' in line:
            print(line)

    sys.exit(buildbot_exit)
예제 #4
0
 def test_run_good(self):
     self.patch(sys, 'argv', ['buildbot', 'my'])
     try:
         runner.run()
     except SystemExit as e:
         self.assertEqual(e.args[0], 3)
     else:
         self.fail("didn't exit")
예제 #5
0
 def test_run_bad(self):
     self.patch(sys, 'argv', [ 'buildbot', 'my', '-l' ])
     stdout = cStringIO.StringIO()
     self.patch(sys, 'stdout', stdout)
     try:
         runner.run()
     except SystemExit, e:
         self.assertEqual(e.args[0], 1)
예제 #6
0
 def test_run_bad(self):
     self.patch(sys, 'argv', ['buildbot', 'my', '-l'])
     stdout = cStringIO.StringIO()
     self.patch(sys, 'stdout', stdout)
     try:
         runner.run()
     except SystemExit, e:
         self.assertEqual(e.args[0], 1)
예제 #7
0
def buildbot_try(args):
    '''Launch a try job on buildmaster.'''

    from buildbot.scripts import runner
    from unidecode import unidecode

    builder = ''

    for index, arg in enumerate(args):
        if arg == '-b':
            builder = args[index + 1]
            break
        if arg.startswith('--builder='):
            builder = arg[10:]
            break

    if not builder:
        print('No builder was specified. Use "-b" to send tests to a builder.')
        sys.exit(1)

    who = unidecode(pave.git.account)
    if not who:
        print('Git user info not configured.')
        print('Use:')
        print('git config --global user.name Your Name')
        print('git config --global user.email [email protected]')
        sys.exit(1)

    buildbot_who = b'--who="' + who.encode('utf-8') + b'"'
    buildbot_master = (
        b'--master=' +
        SETUP['buildbot']['server'].encode('utf-8') + ':' +
        str(SETUP['buildbot']['port'])
        )

    new_args = [
        b'buildbot', b'try',
        b'--connect=pb',
        buildbot_master,
        b'--web-status=%s' % (SETUP['buildbot']['web_url'],),
        b'--username=%s' % (SETUP['buildbot']['username']),
        b'--passwd=%s' % (SETUP['buildbot']['password']),
        b'--vc=%s' % (SETUP['buildbot']['vcs']),
        buildbot_who,
        b'--branch=%s' % (pave.git.branch_name),
        b'--properties=author=%s' % (who.encode('utf-8'),),
        ]
    new_args.extend(args)
    sys.argv = new_args

    # Push the latest changes to remote repo, as otherwise the diff will
    # not be valid.
    pave.git.push()

    print('Running %s' % new_args)
    runner.run()
예제 #8
0
 def test_run_bad(self):
     self.patch(sys, 'argv', ['buildbot', 'my', '-l'])
     stdout = NativeStringIO()
     self.patch(sys, 'stdout', stdout)
     try:
         runner.run()
     except SystemExit as e:
         self.assertEqual(e.args[0], 1)
     else:
         self.fail("didn't exit")
     self.assertIn('THIS IS ME', stdout.getvalue())
예제 #9
0
def buildbot_list(args):
    '''List builder names available on the remote buildbot master.

    To get the list of all remote builder, call this target with 'all'
    argument.
    '''
    from buildbot.scripts import runner

    new_args = [
        'buildbot', 'try',
        '--connect=pb',
        '--master=%s:%d' % (
            SETUP['buildbot']['server'],
            SETUP['buildbot']['port']
            ),
        '--username=%s' % (SETUP['buildbot']['username']),
        '--passwd=%s' % (SETUP['buildbot']['password']),
        '--get-builder-names',
        ]
    sys.argv = new_args

    print 'Running %s' % new_args

    new_out = None
    if 'all' not in args:
        from StringIO import StringIO
        new_out = StringIO()
        sys.stdout = new_out

    try:
        runner.run()
    finally:
        if new_out:
            sys.stdout = sys.__stdout__
            if SETUP['buildbot']['builders_filter']:
                selector = (
                    SETUP['buildbot']['builders_filter'])
            elif SETUP['repository']['name']:
                selector = SETUP['repository']['name']
            else:
                selector = ''
            for line in new_out.getvalue().split('\n'):
                if selector in line:
                    print line
#!/usr/bin/env python
import sys
sys.path.append('/app/pysrc')
print 'Attach to debugger...'

import os
import pydevd
if os.environ.get('DEBUG_HOST', None) == '':
  del os.environ['DEBUG_HOST']
if os.environ.get('DEBUG_PORT', None) == '':
  del os.environ['DEBUG_PORT']
pydevd.settrace(os.environ.get('DEBUG_HOST', '172.18.0.1'), stdoutToServer=True, stderrToServer=True, port=int(os.environ.get('DEBUG_PORT', '5678')), suspend=bool(os.environ.get('DEBUG_SUSPEND', False)), trace_only_current_thread=False)

from buildbot.scripts import runner
runner.run()
예제 #11
0
def main():
    """Launch buildbot runner."""
    run()
예제 #12
0
#!/usr/bin/env python3
import sys
sys.path.append('/app/pysrc')
print('Attach to debugger...')

import os
import pydevd
if os.environ.get('DEBUG_HOST', None) == '':
  del os.environ['DEBUG_HOST']
if os.environ.get('DEBUG_PORT', None) == '':
  del os.environ['DEBUG_PORT']

pydevd.settrace(
	os.environ.get('DEBUG_HOST', '127.0.0.1'),
	port=int(os.environ.get('DEBUG_PORT', '5678')),
	stdoutToServer=True, stderrToServer=True,
	suspend=True, trace_only_current_thread=False
)

from buildbot.scripts import runner
runner.run()