Esempio n. 1
0
def getForceSchedulers(builders):
    # Walk over all builders and collect their names.
    scheduler_builders = [builder.name for builder in builders]

    # Create the force schedulers.
    return [
        schedulers.ForceScheduler(
            name="force-build-scheduler",
            label="Force Build",
            buttonName="Force Build",
            reason=util.ChoiceStringParameter(
                name="reason",
                label="reason:",
                required=True,
                choices=[
                    "Build a particular revision",
                    "Force clean build",
                    "Narrow down blamelist",
                ],
                default="Build a particular revision"),
            builderNames=scheduler_builders,
            codebases=[
                util.CodebaseParameter(
                    codebase="",
                    branch=util.FixedParameter(name="branch", default=_branch),
                    revision=util.StringParameter(name="revision",
                                                  label="revision:",
                                                  size=45,
                                                  default=''),
                    repository=util.FixedParameter(name="repository",
                                                   default=_repourl),
                    project=util.FixedParameter(
                        name="project",
                        default="llvm"  # All projects depend on llvm
                    ))
            ],
            properties=[
                util.BooleanParameter(
                    name="clean",
                    label="Clean source code and build directory",
                    default=False),
                util.BooleanParameter(name="clean_obj",
                                      label="Clean build directory",
                                      default=False)
            ])
    ]
Esempio n. 2
0
def codebaseParameter():
    return [
        util.CodebaseParameter(
            "",
            label="Main repository",
            branch=util.StringParameter(
                name="branch",
                default=constants.MAXSCALE_CODEBASE[""]["branch"]),
            revision=util.FixedParameter(
                name="revision",
                default=constants.MAXSCALE_CODEBASE[""]["revision"]),
            project=util.FixedParameter(name="project", default=""),
            repository=util.StringParameter(
                name="repository",
                default=constants.MAXSCALE_CODEBASE[""]["repository"]),
        )
    ]
Esempio n. 3
0
def force_scheduler():
    default_project = "%s/%s" % (util.env.GIT_OWNER, util.env.GIT_SLUG)

    yaml_options = util.NestedParameter(
        name=None,
        label='Eve',
        fields=[
            util.StringParameter(name='force_stage',
                                 label='Override stage (optional)')
        ])

    extra_props = util.NestedParameter(
        name=None,
        label='Extra properties',
        fields=[
            util.AnyPropertyParameter(name='prop%02d' % i)
            for i in range(util.env.FORCE_BUILD_PARAM_COUNT)
        ])

    # Hack to remove ugly ':' from extra properties
    for prop in extra_props.fields:
        prop.fields[0].label = 'Name'
        prop.fields[1].label = 'Value'

    return schedulers.EveForceScheduler(
        name=util.env.FORCE_SCHEDULER_NAME,
        builderNames=[util.env.BOOTSTRAP_BUILDER_NAME],
        reason=util.StringParameter(name='reason',
                                    label='Reason',
                                    default='force build',
                                    size=20),
        properties=[yaml_options] + [extra_props],
        codebases=[
            util.CodebaseParameter(
                '',
                label='Repository',
                branch=util.StringParameter(name='branch',
                                            label='Branch',
                                            required=True),
                revision=util.FixedParameter(name='revision', default=''),
                repository=util.FixedParameter(name='repository',
                                               default=util.env.GIT_REPO),
                project=util.FixedParameter(name='project',
                                            default=default_project),
            )
        ])
Esempio n. 4
0
def make_force_cb(bases):
    cb_list = []
    for b in bases:
        cb_list.append(
            util.CodebaseParameter(b,
                                   branch=util.ChoiceStringParameter(
                                       name="branch",
                                       choices=codebases[b]['branches'],
                                       default=bases[b]['default_branch']),
                                   revision=util.FixedParameter(
                                       name='revision', default=''),
                                   repository=util.FixedParameter(
                                       name='repository',
                                       default=codebases[b]['repository']),
                                   project=util.FixedParameter(name='project',
                                                               default=b)))
    return cb_list
Esempio n. 5
0
def add_schedulers(cfg):
    for branch in config['branch_deployment_configs']:
        realm = config['branch_deployment_configs'][branch]['namespace']
        buildername = 'vitasa-' + realm
        cfg['schedulers'].append(
            schedulers.ForceScheduler(
                name="force-vita" + realm,
                codebases=[
                    util.CodebaseParameter(
                        "",
                        label="Repository",
                        branch=util.FixedParameter(name="branch", default=branch),
                        revision=util.StringParameter(name="revision", default=""),
                        repository=util.FixedParameter(name="repository", default="https://github.com/klaital/vitasa-web"),
                        project=util.FixedParameter(name="project", default='vitasa-web'),
                    )
                ],
                builderNames=[buildername]
            )
        )
Esempio n. 6
0
def _getForceScheduler(props, prefix, builderNames):
    pretty_branch_name = props['branch_pretty']

    forceParams = [
        util.CodebaseParameter(
            "",
            label="Main repository",
            # will generate a combo box
            branch=util.FixedParameter(
                name="branch",
                default=props['git_branch_name'],
            ),
            # will generate nothing in the form, but revision, repository,
            # and project are needed by buildbot scheduling system so we
            # need to pass a value ("")
            revision=util.FixedParameter(name="revision", default="HEAD"),
            repository=util.FixedParameter(name="repository",
                                           default="{{ source_repo_url }}"),
            project=util.FixedParameter(name="project", default=""),
        ),
    ]

    # Note: This is a hack, but we need a unique name for the force schedulers, and it can't have special characters in it...
    return schedulers.ForceScheduler(
        name=prefix + pretty_branch_name[0:2].replace('.', 'x'),
        buttonName="Force Build",
        label="Force Build Settings",
        builderNames=builderNames,
        codebases=forceParams,

        # will generate a text input
        reason=util.StringParameter(name="reason",
                                    label="Reason:",
                                    required=False,
                                    size=80,
                                    default=""),

        # in case you don't require authentication this will display
        # input for user to type his name
        username=util.UserNameParameter(label="your name:", size=80))
Esempio n. 7
0
def add_schedulers(cfg):
    for branch in config['branch_to_namespace_mapping']:
        realm = config['branch_to_namespace_mapping'][branch]
        buildername = 'wwdicebot-' + realm
        cfg['schedulers'].append(
            schedulers.ForceScheduler(
                name="force-wwdicebot" + realm,
                codebases=[
                    util.CodebaseParameter(
                        "",
                        label="Repository",
                        branch=util.FixedParameter(name="branch",
                                                   default=branch),
                        revision=util.StringParameter(name="revision",
                                                      default=""),
                        repository=util.FixedParameter(
                            name="repository",
                            default="https://github.com/klaital/wwdice"),
                        project=util.FixedParameter(name="project",
                                                    default='wwdicebot'),
                    )
                ],
                builderNames=[buildername]))
Esempio n. 8
0
def get_schedulers():
    from buildbot.schedulers.basic import SingleBranchScheduler
    from buildbot.schedulers.basic import AnyBranchScheduler
    from buildbot.schedulers.forcesched import ForceScheduler
    from buildbot.schedulers.forcesched import StringParameter
    from buildbot.schedulers.forcesched import FixedParameter
    from buildbot.plugins import util
    import builders

    return [
        SingleBranchScheduler(
            name='master',
            reason='main repository source code modification',
            builderNames=['coverity'],
            treeStableTimer=20,
            change_filter=util.ChangeFilter(branch='master')),
        AnyBranchScheduler(name='default',
                           reason='main repository source code modification',
                           builderNames=builders.get_builder_names(),
                           treeStableTimer=20),
        ForceScheduler(
            name='force',
            reason=StringParameter(name="reason",
                                   default="manual build",
                                   size=100),
            builderNames=builders.get_builder_names(),
            codebases=[
                util.CodebaseParameter(
                    "",
                    label="Codebase",
                    branch=StringParameter(name="branch",
                                           default="master",
                                           size=100),
                    revision=StringParameter(name="revision",
                                             default="",
                                             size=100),
                    repository=StringParameter(
                        name="repository",
                        default="https://github.com/SFML/SFML.git",
                        regex=r"^https://github.com/[\w-]*/[\w-]*\.git$",
                        size=100),
                    project=StringParameter(name="project",
                                            default="SFML",
                                            size=100),
                )
            ],
            properties=[util.FixedParameter(name="trigger", default="force")])
    ]
Esempio n. 9
0
def get_schedulers() :
    from buildbot.schedulers.basic import AnyBranchScheduler
    from buildbot.schedulers.forcesched import ForceScheduler
    from buildbot.schedulers.forcesched import StringParameter
    from buildbot.schedulers.forcesched import FixedParameter
    from buildbot.plugins import util
    import builders

    return [
        AnyBranchScheduler(
            name = 'default',
            reason = 'main repository source code modification',
            builderNames = builders.get_builder_names(),
            treeStableTimer = 20,
            change_filter = util.ChangeFilter(
                repository_fn = lambda repository : bool('github.com/SFML/SFML' in repository)
            ),
            properties = {
                'trigger' : 'internal'
            }
        ),
        AnyBranchScheduler(
            name = 'foreign',
            builderNames = builders.get_builder_names(),
            change_filter = util.ChangeFilter(
                repository_fn = lambda repository : bool('github.com/SFML/SFML' not in repository)
            ),
            properties = {
                'trigger' : 'external'
            }
        ),
        ForceScheduler(
            name = 'force',
            reason = StringParameter(name = "reason", default = "manual build", size = 100),
            builderNames = builders.get_builder_names(),
            branch = StringParameter(name = "branch", default = "master", size = 100),
            revision = StringParameter(name = "revision", default = "", size = 100),
            repository = StringParameter(name = "repository", default = "https://github.com/SFML/SFML.git", regex = r"^https://github.com/[\w-]*/[\w-]*\.git$", size = 100),
            project = StringParameter(name = "project", default = "SFML", size = 100),
            properties = [
                util.FixedParameter(name = "trigger", default = "force")
            ]
        )
    ]
Esempio n. 10
0
def get(builders):
    scheds = []
    # pull request scheduler
    scheds.append(
        schedulers.AnyBranchScheduler(
            name="gr_pull_request_handler",
            change_filter=util.ChangeFilter(category='pull',
                                            project="gnuradio/gnuradio"),
            treeStableTimer=None,
            builderNames=[
                b.name for b in builders if "control" in b.tags
                and "gnuradio" in b.tags and "pull" in b.tags
            ]))
    scheds.append(
        schedulers.AnyBranchScheduler(
            name="volk_pull_request_handler",
            change_filter=util.ChangeFilter(category='pull',
                                            project="gnuradio/volk"),
            treeStableTimer=None,
            builderNames=[
                b.name for b in builders if "control" in b.tags
                and "volk" in b.tags and "pull" in b.tags
            ]))

    # push event scheduler
    def filter_for_push(change):
        event = change.properties.getProperty("event")
        project = change.properties.getProperty("project")
        if event == "push":
            return True
        return False

    scheds.append(
        schedulers.AnyBranchScheduler(
            name="commit_push_handler",
            change_filter=util.ChangeFilter(filter_fn=filter_for_push,
                                            project="gnuradio/gnuradio"),
            treeStableTimer=60,
            builderNames=[
                b.name for b in builders
                if "control" in b.tags and "push" in b.tags
            ]))

    scheds.append(
        schedulers.ForceScheduler(
            name="force_pullrequest",
            builderNames=["pull_request_runner"],
            properties=[
                util.StringParameter(name="github.number",
                                     label="GitHub pull request number",
                                     default="",
                                     size=80),
                util.StringParameter(name="github.base.ref",
                                     label="pull request base branch",
                                     default="master",
                                     size=80)
            ],
            codebases=[
                util.CodebaseParameter(
                    "",
                    project=util.FixedParameter(name="project",
                                                default="gnuradio/gnuradio"),
                    repository=util.FixedParameter(
                        name="repository",
                        default="https://github.com/gnuradio/gnuradio.git"),
                    branch=util.StringParameter(
                        name="branch",
                        label="pull request branch",
                        default="refs/pull/<PR#>/merge",
                        size=80),
                    revision=util.FixedParameter(name="revision", default=""))
            ]))
    scheds.append(
        schedulers.ForceScheduler(
            name="force_build",
            builderNames=["repo_push_runner"],
            codebases=[
                util.CodebaseParameter(
                    "",
                    project=util.FixedParameter(name="project",
                                                default="gnuradio/gnuradio"),
                    repository=util.FixedParameter(
                        name="repository",
                        default="https://github.com/gnuradio/gnuradio.git"),
                )
            ]))

    scheds.append(
        schedulers.ForceScheduler(
            name="force_weekly",
            builderNames=["weekly_runner"],
            codebases=[
                util.CodebaseParameter(
                    "",
                    project=util.FixedParameter(name="project",
                                                default="gnuradio/gnuradio"),
                    repository=util.FixedParameter(
                        name="repository",
                        default="https://github.com/gnuradio/gnuradio.git"),
                    branch=util.StringParameter(name="branch",
                                                label="test branch",
                                                default="master",
                                                size=80),
                    revision=util.FixedParameter(name="revision", default=""))
            ]))

    scheds.append(
        schedulers.Nightly(name="timed_weekly",
                           builderNames=["weekly_runner"],
                           codebases={
                               "": {
                                   "repository":
                                   "https://github.com/gnuradio/gnuradio.git",
                                   "branch": "master",
                                   "revision": "None"
                               }
                           },
                           dayOfWeek=[0, 4],
                           hour=4,
                           minute=0))
    scheds.extend([
        schedulers.Triggerable(name="trigger_" + b.name.lstrip("build_"),
                               builderNames=[b.name]) for b in builders
        if "build" in b.tags
    ])

    scheds.extend([
        schedulers.Triggerable(name="trigger_" + b.name.lstrip("test_"),
                               builderNames=[b.name]) for b in builders
        if "test" in b.tags
    ])
    return scheds
Esempio n. 11
0
    name='force-repo-sync-clipos',
    buttonName="Force a synchronization from scratch of the source tree",
    label="Synchronization from scratch",
    builderNames=[
        # Only one builder is eligible to this scheduler:
        repo_sync_builder.name,
    ],
    codebases=oneCodebase(
        project=None,
        repository=setup.clipos_manifest_git_url,
        branch="master",
        revision=None,
    ),
    properties=[
        util.FixedParameter(
            "cleanup_workspace",
            default=True,
        ),
    ],
)

# Scheduler for the CLIP OS on-demand custom builds:
clipos_custom_build_force_sched = schedulers.ForceScheduler(
    name='clipos-custom-build',
    buttonName="Start a custom build",
    label="Custom build",
    builderNames=[
        clipos_ondemand_builder.name,
    ],
    codebases=[
        util.CodebaseParameter(
            codebase='',
Esempio n. 12
0
def ros_testbuild(c, job_name, url, branch, distro, arch, rosdistro, machines, 
                  othermirror, keys, source=True, locks=[]):

    # Create a Job for Source
    
    if source:
        project_name = '_'.join([job_name, rosdistro, 'source_build'])
        c['change_source'].append(
            GitPoller(
                repourl=url,
                name=url,
                branch=branch,
                category=project_name,
                pollAtLaunch=True,
            )
        )
        c['schedulers'].append(
            schedulers.SingleBranchScheduler(
                name=project_name,
                builderNames=[project_name,],
                change_filter=util.ChangeFilter(category=project_name)
            )
        )
        
        c['schedulers'].append(
            schedulers.Nightly(
                name = project_name+'-nightly-master',
                codebases = {url:{'repository':url,'branch':'master'}},
                builderNames = [project_name,],
                hour=3,
                minute=0,
            )
        )
        
        c['schedulers'].append(
            schedulers.Nightly(
                name = project_name+'-nightly-develop',
                codebases = {url:{'repository':url,'branch':'develop'}},
                builderNames = [project_name,],
                hour=5,
                minute=0,
            )
        )
        
        c['schedulers'].append(
            schedulers.ForceScheduler(
                name=project_name+'-force',
                codebases = [util.CodebaseParameter("", 
                        branch=util.ChoiceStringParameter(
                            name="branch",
                            choices=["master", "devel"],
                            default="master"),
                        repository=util.FixedParameter(name="repository", default=url),
                        )],
                builderNames=[project_name,],
            )
        )
    else:
        r_owner, r_name = (url.split(':')[1])[:-4].split('/')
        project_name = '_'.join([job_name, rosdistro, 'pr_build'])
        c['change_source'].append(
            GitPRPoller(
                owner=r_owner,
                repo=r_name,
                category=project_name,
                branches=[branch],
                pollInterval=10*60,
                pollAtLaunch=True,
                token=util.Secret("OathToken"),
                repository_type='ssh'
            )
        )

        c['schedulers'].append(
            schedulers.SingleBranchScheduler(
                name=project_name,
                builderNames=[project_name,],
                change_filter=util.ChangeFilter(category=project_name)
            )
        )
        
    # Directory which will be bind-mounted
    binddir = '/tmp/'+project_name
    dockerworkdir = '/tmp/test/'


    f = BuildFactory()
    # Remove any old crud in build/src folder
    f.addStep(
        ShellCommand(
            name='rm src',
            command=['rm', '-rf', 'build/src'],
            hideStepIf=success,
            workdir=Interpolate('%(prop:builddir)s')
        )
    )
    # Check out repository (to /build/src)
    f.addStep(
        Git(
            repourl=util.Property('repository', default=url),
            branch=util.Property('branch', default=branch),
            alwaysUseLatest=True,
            mode='full',
            workdir=Interpolate('%(prop:builddir)s/build/src')
        )
    )

    # Download testbuild_docker.py script from master
    f.addStep(
        FileDownload(
            name=job_name+'-grab-script',
            mastersrc='scripts/testbuild_docker.py',
            workerdest=('testbuild_docker.py'),
            hideStepIf=success
        )
    )
    # Download Dockerfile_test script from master
    f.addStep(
        FileDownload(
            name=job_name+'-grab-script',
            mastersrc='docker_components/Dockerfile_test',
            workerdest=('Dockerfile_test'),
            hideStepIf=success
        )
    )
    # Download docker-compose.py script from master
    f.addStep(
        FileDownload(
            name=job_name+'-grab-script',
            mastersrc='docker_components/docker-compose-test.yaml',
            workerdest=('docker-compose-test.yaml'),
            hideStepIf=success
        )
    )

    f.addStep(
        FileDownload(
            name=job_name+'-grab-script',
            mastersrc='docker_components/rosdep_private.yaml',
            workerdest=('rosdep_private.yaml'),
            hideStepIf=success
        )
    )

    f.addStep(
        FileDownload(
            name=job_name+'-grab-script',
            mastersrc='scripts/docker-container.py',
            workerdest=('docker-container.py'),
            hideStepIf=success
        )
    )

    # create docker work environment
    f.addStep(
        ShellCommand(
            command=['python','docker-container.py', job_name],
            hideStepIf=success,
            workdir=Interpolate('%(prop:builddir)s/build/')
        )
    )

    # Make and run tests in a docker container
    f.addStep(
        ShellCommand(
            name=job_name+'-build',
            command=['docker', 'run', 
                    '-v',  'ros-buildbot-docker_deb_repository:/home/package',
                    '--name='+project_name,
                    'scalable-env:'+job_name,
                     'python', '/tmp/build/testbuild_docker.py', binddir,
                    rosdistro],
            descriptionDone=['make and test', job_name]
        )
    )

    f.addStep(
        ShellCommand(
            name=job_name+'-copytestresults',
            command=['docker', 'cp', project_name + ':' +binddir + '/testresults',
                     'testresults'],
            logfiles={'tests': 'testresults'},
            descriptionDone=['testresults', job_name]
        )
    )

    f.addStep(
        ShellCommand(
            name=job_name+'-rm_container',
            command=['docker', 'rm', project_name],
            descriptionDone=['remove docker container', job_name]
        )
    )

    f.addStep(
        ShellCommand(
            name=job_name+'-rm_image',
            command=['docker', 'image', 'rm', 'scalable-env:'+job_name],
            descriptionDone=['remove docker image', job_name]
        )
    )

    c['builders'].append(
        BuilderConfig(
            name=project_name,
            workernames=machines,
            factory=f,
            locks=locks
        )
    )
    # return the name of the job created
    return project_name