def build_volk_PR():

    create_src = steps.MakeDirectory(name="create src directory", dir="volk")

    clone_step = steps.GitHub(name="fetch PR source",
                              repourl=util.Property("repository"),
                              mode="full",
                              method="fresh",
                              submodules=True,
                              retryFetch=True,
                              clobberOnFailure=True,
                              workdir="volk")

    rm_src_dir = steps.RemoveDirectory(
        dir=util.Interpolate(
            os.path.join(_PULL_SRC_BASE, "%(prop:github.number)s",
                         "%(prop:github.base.ref)s")),
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    copy_src = steps.CopyDirectory(
        name="copy src to srcdir",
        src="volk",
        dest=util.Interpolate(
            os.path.join(_PULL_SRC_BASE, "%(prop:github.number)s",
                         "%(prop:github.base.ref)s"), ),
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    # load builders.json with definitions on how to build things
    parent_path = os.path.dirname(__file__)
    with open(os.path.join(parent_path, "volk_builders.json"),
              "r") as builders_file:
        build_config = json.loads(builders_file.read())

    trigger_builds = custom_steps.BuildTrigger(
        name="trigger the right builders",
        build_config=build_config,
        schedulerNames=["trigger"],
        runner="pull",
        set_properties={
            "pr_base":
            util.Property("github.base.ref"),
            "src_dir":
            util.Interpolate(
                os.path.join(_PULL_SRC_BASE, "%(prop:github.number)s"))
        },
        test_merge=False,
        updateSourceStamp=False,
        waitForFinish=True)

    factory = util.BuildFactory()
    factory.addStep(create_src)
    factory.addStep(clone_step)
    factory.addStep(rm_src_dir)
    factory.addStep(copy_src)
    factory.addStep(trigger_builds)
    return factory
Example #2
0
def build_PR():

    create_src = steps.MakeDirectory(name="create src directory", dir="src")

    clone_step = steps.GitHub(
        name="fetch PR source",
        repourl=util.Property("repository"),
        mode="full",
        method="fresh",
        submodules=True,
        retryFetch=True,
        clobberOnFailure=True,
        workdir="src")

    rm_src_archive = steps.ShellCommand(
        name="remove old source archive",
        command=[
            "rm", "-rf", util.Interpolate(
                os.path.join(_PULL_SRC_BASE,
                             "%(prop:github.number)s.tar.xz"))
        ],
        workdir="src",
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS)

    create_src_archive = steps.ShellCommand(
        name="create source archive",
        command=[
            "tar", "cJf", util.Interpolate(
                os.path.join(_PULL_SRC_BASE,
                             "%(prop:github.number)s.tar.xz")), "."
        ],
        workdir="src",
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    # load builders.json with definitions on how to build things
    parent_path = os.path.dirname(__file__)
    with open(os.path.join(parent_path, "builders.json"),
              "r") as builders_file:
        build_config = json.loads(builders_file.read())

    trigger_builds = custom_steps.BuildTrigger(
        name="trigger the right builders",
        build_config=build_config,
        schedulerNames=["trigger"],
        runner="pull",
        set_properties={
            "pr_base": util.Property("github.base.ref"),
            "src_archive": util.Interpolate(
                os.path.join(_PULL_SRC_BASE, "%(prop:github.number)s.tar.xz"))
        },
        updateSourceStamp=False,
        waitForFinish=True)

    factory = util.BuildFactory()
    factory.addStep(create_src)
    factory.addStep(clone_step)
    factory.addStep(rm_src_archive)
    factory.addStep(create_src_archive)
    factory.addStep(trigger_builds)
    return factory
Example #3
0
def build_weekly():

    create_src = steps.MakeDirectory(
        name="create src directory",

        dir="src")

    clone_step = steps.GitHub(
        name="fetch PR source",
        repourl=util.Property("repository"),
        mode="full",
        method="fresh",
        submodules=True,
        clobberOnFailure=True,
        getDescription=True,
        workdir="src")

    rm_src_archive = steps.ShellCommand(
        name="remove old source archive",
        command=[
            "rm", "-rf", util.Interpolate(
                os.path.join(_WEEKLY_SRC_BASE, "%(prop:branch)s",
                             "%(prop:commit-description)s.tar.xz"))
        ],
        workdir="src",
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS)

    create_src_archive = steps.ShellCommand(
        name="create source archive",
        command=[
            "tar", "cJf", util.Interpolate(
                os.path.join(_WEEKLY_SRC_BASE, "%(prop:branch)s",
                             "%(prop:commit-description)s.tar.xz")), "."
        ],
        workdir="src",
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )
    # load builders.json with definitions on how to build things
    parent_path = os.path.dirname(__file__)
    with open(os.path.join(parent_path, "builders.json"), "r") as builders_file:
        build_config = json.loads(builders_file.read())

    # now we have all necessary merge properties together,
    # we can actually kickoff builds for them

    trigger_builds = custom_steps.BuildTrigger(
        name="trigger all builders",
        build_config=build_config,
        schedulerNames=["trigger"],
        runner="time",
        set_properties={
            "src_archive": util.Interpolate(
                os.path.join(_WEEKLY_SRC_BASE, "%(prop:branch)s","%(prop:commit-description)s.tar.xz")),
            "got_revision": util.Property("got_revision"),
        },
        updateSourceStamp=True,
        waitForFinish=True
    )

    factory = util.BuildFactory()
    factory.addStep(create_src)
    factory.addStep(clone_step)
    factory.addStep(rm_src_archive)
    factory.addStep(create_src_archive)
    factory.addStep(trigger_builds)
    return factory
def build_weekly():

    create_src = steps.MakeDirectory(name="create src directory", dir="src")
    clone_step = steps.GitHub(name="fetch PR source",
                              repourl=util.Property("repository"),
                              mode="full",
                              method="fresh",
                              submodules=True,
                              clobberOnFailure=True,
                              getDescription=True,
                              workdir="src")

    rm_src_dir = steps.RemoveDirectory(dir=util.Interpolate(
        os.path.join(_WEEKLY_SRC_BASE, "%(prop:branch)s",
                     "%(prop:commit-description)s")))

    copy_src = steps.CopyDirectory(name="copy src to srcdir",
                                   src="src",
                                   dest=util.Interpolate(
                                       os.path.join(
                                           _WEEKLY_SRC_BASE, "%(prop:branch)s",
                                           "%(prop:commit-description)s"), ))

    set_merge_property = steps.SetProperty(
        property=util.Interpolate("merge_%(prop:branch)s"),
        value=True,
        hideStepIf=True,
    )

    # load builders.json with definitions on how to build things
    parent_path = os.path.dirname(__file__)
    with open(os.path.join(parent_path, "builders.json"),
              "r") as builders_file:
        build_config = json.loads(builders_file.read())

    # now we have all necessary merge properties together,
    # we can actually kickoff builds for them

    trigger_builds = custom_steps.BuildTrigger(
        name="trigger all builders",
        build_config=build_config,
        schedulerNames=["trigger"],
        runner="time",
        set_properties={
            "src_dir":
            util.Interpolate(
                os.path.join(_WEEKLY_SRC_BASE, "%(prop:branch)s",
                             "%(prop:commit-description)s")),
            "got_revision":
            util.Property("got_revision"),
        },
        updateSourceStamp=True,
        waitForFinish=True)

    factory = util.BuildFactory()
    factory.addStep(create_src)
    factory.addStep(clone_step)
    factory.addStep(rm_src_dir)
    factory.addStep(copy_src)
    factory.addStep(set_merge_property)
    factory.addStep(trigger_builds)
    return factory
Example #5
0
def build_PR():
    # @util.renderer
    # def check_mergeable(props):
    #     mergeable = props.getProperty("github.mergeable", False)
    #     return mergeable

    # check_mergeables = steps.Assert(
    #     check_mergeable,
    #     name="check if PR was mergeable",
    #     haltOnFailure=True
    # )

    create_src = steps.MakeDirectory(name="create src directory", dir="src")

    clone_step = steps.GitHub(name="fetch PR source",
                              repourl=util.Property("repository"),
                              mode="full",
                              method="fresh",
                              submodules=True,
                              retryFetch=True,
                              clobberOnFailure=True,
                              workdir="src")

    set_merge_property = steps.SetProperty(
        name="set merge property",
        property=util.Interpolate("merge_%(prop:github.base.ref)s"),
        value=True,
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    create_merge_branch = steps.ShellCommand(
        name="create test_merge branch for further steps",
        command=[
            "git", "branch", "-f",
            util.Interpolate("test_merge_%(prop:github.base.ref)s")
        ],
        workdir="src")

    rm_src_dir = steps.RemoveDirectory(
        dir=util.Interpolate(
            os.path.join(_BASEPATH, "pull", "%(prop:github.number)s",
                         "%(prop:github.base.ref)s")),
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    copy_src = steps.CopyDirectory(
        name="copy src to srcdir",
        src="src",
        dest=util.Interpolate(
            os.path.join(_BASEPATH, "pull", "%(prop:github.number)s",
                         "%(prop:github.base.ref)s"), ),
        hideStepIf=lambda results, s: results == SKIPPED or results == SUCCESS,
    )

    master_steps = sequences.mergeability_sequence("master", "maint",
                                                   _PULL_SRC_BASE)
    next_steps = sequences.mergeability_sequence("next", "master",
                                                 _PULL_SRC_BASE)
    python3_steps = sequences.mergeability_sequence("python3", "next",
                                                    _PULL_SRC_BASE)

    # load builders.json with definitions on how to build things
    parent_path = os.path.dirname(__file__)
    with open(os.path.join(parent_path, "builders.json"),
              "r") as builders_file:
        build_config = json.loads(builders_file.read())

    trigger_builds = custom_steps.BuildTrigger(
        name="trigger the right builders",
        build_config=build_config,
        schedulerNames=["trigger"],
        runner="pull",
        set_properties={
            "pr_base":
            util.Property("github.base.ref"),
            "src_dir":
            util.Interpolate(
                os.path.join(_PULL_SRC_BASE, "%(prop:github.number)s"))
        },
        updateSourceStamp=False,
        waitForFinish=True)

    factory = util.BuildFactory()
    factory.addStep(create_src)
    factory.addStep(clone_step)
    factory.addStep(set_merge_property)
    factory.addStep(create_merge_branch)
    factory.addStep(rm_src_dir)
    factory.addStep(copy_src)
    factory.addSteps(master_steps)
    factory.addSteps(next_steps)
    factory.addSteps(python3_steps)
    factory.addStep(trigger_builds)
    return factory