Ejemplo n.º 1
0
def _getBasicSchedulers(props):
    pretty_branch_name = props['branch_pretty']

    branch_cf = util.ChangeFilter(category=None,
                                  branch_re=props['git_branch_name'])

    schedDict = {}

    schedDict['prs'] = getPullRequestScheduler(props, pretty_branch_name)

    for build_type in ["Build", "Reports"]:
        for jdk in common.getJDKBuilds(props):
            sched = _getAnyBranchScheduler(
                name=common.getBuildWithJDK(pretty_branch_name, build_type,
                                            jdk),
                change_filter=branch_cf,
                properties=props,
                builderNames=[
                    common.getBuildWithJDK(pretty_branch_name, build_type,
                                           jdk),
                ])
            schedDict[build_type + str(jdk)] = sched

    sched = _getAnyBranchScheduler(
        name=pretty_branch_name + " Quick Build",
        change_filter=branch_cf,
        properties=props,
        builderNames=[
            pretty_branch_name + " Markdown",
            #            pretty_branch_name + " Database Tests"
        ])
    schedDict["markdowndb"] = sched

    if str(props['package_all']).lower() != 'true':
        sched = schedulers.Nightly(
            name=pretty_branch_name + ' Package Generation',
            change_filter=branch_cf,
            hour={{nightly_build_hour}},
            onlyIfChanged=True,
            properties=props,
            builderNames=[
                pretty_branch_name + " Debian Packaging",
                pretty_branch_name + " el7 RPM Packaging",
                pretty_branch_name + " el8 RPM Packaging"
            ])
    else:
        defaultJDK = common.getJDKBuilds(props)[0]
        sched = schedulers.Dependent(
            name=pretty_branch_name + " Packaging Generation",
            upstream=schedDict["Build" + str(defaultJDK)],
            properties=props,
            builderNames=[
                pretty_branch_name + " Debian Packaging",
                pretty_branch_name + " el7 RPM Packaging",
                pretty_branch_name + " el8 RPM Packaging"
            ])
    schedDict['package'] = sched

    return schedDict
Ejemplo n.º 2
0
def getPullRequestScheduler(props, pretty_branch_name):
    builderNames = [
        pretty_branch_name + " Pull Request " + build_type + " JDK " + str(jdk)
        for build_type in ['Build', 'Reports']
        for jdk in common.getJDKBuilds(props)
    ]
    builderNames.extend([
        pretty_branch_name + " Pull Request Markdown",
        #        pretty_branch_name + " Pull Request Database Tests"
    ])

    pull_cf = util.ChangeFilter(category="pull",
                                branch_re=props['git_branch_name'])

    return _getAnyBranchScheduler(name=pretty_branch_name + " Pull Requests",
                                  builderNames=builderNames,
                                  change_filter=pull_cf)
def getPullRequestBuilder(props, pretty_branch_name):

    builders = []

    for jdk in common.getJDKBuilds(props):
        jdk_props = dict(props)
        jdk_props['jdk'] = str(jdk)

        builders.append(
            util.BuilderConfig(name=pretty_branch_name +
                               " Pull Request Build JDK " + str(jdk),
                               workernames=workers,
                               factory=build.getPullRequestPipeline(),
                               collapseRequests=True,
                               properties=jdk_props,
                               locks=[mvn_lock.access('exclusive')]))

        builders.append(
            util.BuilderConfig(name=pretty_branch_name +
                               " Pull Request Reports JDK " + str(jdk),
                               workernames=workers,
                               factory=reports.getPullRequestPipeline(),
                               collapseRequests=True,
                               properties=jdk_props,
                               locks=[mvn_lock.access('exclusive')]))

    builders.append(
        util.BuilderConfig(name=pretty_branch_name + " Pull Request Markdown",
                           workernames=workers,
                           factory=markdown.getPullRequestPipeline(),
                           properties=props,
                           collapseRequests=True))

    #    builders.append(util.BuilderConfig(
    #        name=pretty_branch_name + " Pull Request Database Tests",
    #        workernames=workers,
    #        factory=database.getPullRequestPipeline(),
    #        properties=props,
    #        collapseRequests=True,
    #        locks=[db_lock.access('exclusive')]))

    return builders
Ejemplo n.º 4
0
def getSchedulers(props):

    pretty_branch_name = props['branch_pretty']

    sched_dict = _getBasicSchedulers(props)
    scheduler_list = list(sched_dict.values())

    if props['deploy_env']:
        scheduler_list.append(
            schedulers.Dependent(
                name=pretty_branch_name + " Ansible Deploy",
                upstream=sched_dict['package'],
                properties=props,
                builderNames=[pretty_branch_name + " Ansible Deploy"]))

    forceBuildNames = [
        common.getBuildWithJDK(pretty_branch_name, "Build", jdk)
        for jdk in common.getJDKBuilds(props)
    ]
    forceBuild = _getForceScheduler(props, "ForceBuild", forceBuildNames)
    scheduler_list.append(forceBuild)

    tag_sched = schedulers.AnyBranchScheduler(
        name=pretty_branch_name + " Release",
        #Note: The branch_regex here is matching something like "11.1", so we use the major version (11), plus a static .*
        change_filter=util.ChangeFilter(category='tag',
                                        branch_re=props['pkg_major_version'] +
                                        ".*"),
        properties=props,
        builderNames=[pretty_branch_name + " Release"])
    scheduler_list.append(tag_sched)

    forceBuilders = [
        common.getBuildWithJDK(pretty_branch_name, "Reports", jdk)
        for jdk in common.getJDKBuilds(props, pretty_branch_name)
    ]

    forceBuilders.extend([
        pretty_branch_name + " Markdown",
        #        pretty_branch_name + " Database Tests",
        pretty_branch_name + " Debian Packaging",
        pretty_branch_name + " el7 RPM Packaging",
        pretty_branch_name + " el8 RPM Packaging"
    ])

    if props['deploy_env']:
        forceBuilders.append(pretty_branch_name + " Ansible Deploy")

    forceOther = _getForceScheduler(props, "ForceBuildOther", forceBuilders)
    scheduler_list.append(forceOther)

    if props['package_all']:
        forcePackage = schedulers.Dependent(
            name=pretty_branch_name + " Force Packaging Generation",
            upstream=forceBuild,
            properties=props,
            builderNames=[
                pretty_branch_name + " Debian Packaging",
                pretty_branch_name + " el7 RPM Packaging",
                pretty_branch_name + " el8 RPM Packaging"
            ])
        scheduler_list.append(forcePackage)

        if props['deploy_env']:
            forceAnsible = schedulers.Dependent(
                name=pretty_branch_name + " Force Ansible Deploy",
                upstream=forcePackage,
                properties=props,
                builderNames=[pretty_branch_name + " Ansible Deploy"])
            scheduler_list.append(forceAnsible)

    return scheduler_list
def getBuildersForBranch(props):

    pretty_branch_name = props['branch_pretty']

    deb_props = dict(props)
    deb_props['image'] = random.choice({{docker_debian_worker_images}})

    cent_props = dict(props)
    cent_props['image'] = random.choice({{docker_centos_worker_images}})

    builders = getPullRequestBuilder(props, pretty_branch_name)

    #Only one maven build, per branch, at a time
    branch_mvn_lock = util.MasterLock(pretty_branch_name + "mvn_lock")

    for jdk in common.getJDKBuilds(props):
        jdk_props = dict(props)
        jdk_props['jdk'] = str(jdk)

        builders.append(
            util.BuilderConfig(
                name=pretty_branch_name + " Build JDK " + str(jdk),
                workernames=workers,
                factory=build.getBuildPipeline(),
                properties=jdk_props,
                collapseRequests=True,
                #A note on these locks: We want a single maven build per branch,
                # AND a single maven build per worker
                locks=[
                    mvn_lock.access('exclusive'),
                    branch_mvn_lock.access('exclusive')
                ]))

        report_props = dict(jdk_props)
        report_props['cores'] = '1'

        builders.append(
            util.BuilderConfig(
                name=pretty_branch_name + " Reports JDK " + str(jdk),
                workernames=workers,
                factory=reports.getBuildPipeline(),
                properties=jdk_props,
                collapseRequests=True,
                #A note on these locks: We want a single maven build per branch,
                # AND a single maven build per worker
                locks=[
                    mvn_lock.access('exclusive'),
                    branch_mvn_lock.access('exclusive')
                ]))

    release_props = dict(props)
    #We use the first listed JDK since that (should) be the lowest, most common version
    release_props['jdk'] = str(common.getJDKBuilds(props)[0])
    builders.append(
        util.BuilderConfig(
            name=pretty_branch_name + " Release",
            workernames=workers,
            factory=release.getBuildPipeline(),
            properties=release_props,
            collapseRequests=True,
            #Note: We want a single maven build per worker, but since this is a release we don't
            # care if there are other maven builds running elsewhere
            locks=[mvn_lock.access('exclusive')]))

    builders.append(
        util.BuilderConfig(name=pretty_branch_name + " Markdown",
                           workernames=workers,
                           factory=markdown.getBuildPipeline(),
                           properties=props,
                           collapseRequests=True))

    #    builders.append(util.BuilderConfig(
    #        name=pretty_branch_name + " Database Tests",
    #        workernames=workers,
    #        factory=database.getBuildPipeline(),
    #        properties=props,
    #        collapseRequests=True,
    #        locks=[db_lock.access('exclusive')]))

    builders.append(
        util.BuilderConfig(name=pretty_branch_name + " Debian Packaging",
                           workernames=workers,
                           factory=debs.getBuildPipeline(),
                           properties=deb_props,
                           collapseRequests=True,
                           locks=[deb_lock.access('exclusive')]))

    for distro in (7, 8):
        el_props = dict(props)
        el_props['el_version'] = distro
        if 7 == distro:
            el_props['image'] = f"cent{distro}"
            lock = el7_lock
        elif 8 == distro:
            el_props['image'] = f"rocky{distro}"
            lock = el8_lock

        if "Develop" == pretty_branch_name:
            #Set the RPM branch to master
            el_props['rpmspec_override'] = "master"
            #Override/set a bunch of the build props since the RPM's dont relaly have a develop...

        builders.append(
            util.BuilderConfig(name=pretty_branch_name +
                               f" el{distro} RPM Packaging",
                               workernames=workers,
                               factory=rpms.getBuildPipeline(),
                               properties=el_props,
                               collapseRequests=True,
                               locks=[lock.access('exclusive')]))

    if props['deploy_env']:
        deploy_props = dict(props)
        deploy_props['deploy_suite'] = '{{ repo_deploy_suite }}'
        deploy_props['package_repo_host'] = "{{ repo_host }}"
        deploy_props['key_url'] = "{{ key_url }}"
        deploy_props['key_id'] = "{{ key_id }}"

        builders.append(
            util.BuilderConfig(
                name=pretty_branch_name + " Ansible Deploy",
                workernames=workers,
                factory=ansible.getBuildPipeline(),
                properties=deploy_props,
                collapseRequests=True,
                #Ensure that no one is changing the package databases while we're deploying!
                locks=[
                    deb_lock.access('exclusive'),
                    el7_lock.access('exclusive'),
                    el8_lock.access('exclusive')
                ]))

    return builders