コード例 #1
0
def workflow(tmpdir, user_params):
    workflow = DockerBuildWorkflow(source=MOCK_SOURCE)

    # Stash the tmpdir in workflow so it can be used later
    workflow._tmpdir = tmpdir

    class MockSource(StubSource):
        def __init__(self, workdir):
            super(MockSource, self).__init__()
            self.workdir = workdir

    workflow.source = MockSource(str(tmpdir))

    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)
    workflow.buildstep_plugins_conf = [{'name': PLUGIN_BUILD_ORCHESTRATE_KEY}]

    mock_repo_config(workflow)
    mock_reactor_config(workflow)
    mock_build_json()
    mock_koji()

    return workflow
コード例 #2
0
def mock_workflow(tmpdir,
                  for_orchestrator=False,
                  config_map=None,
                  default_si=DEFAULT_SIGNING_INTENT):
    workflow = DockerBuildWorkflow(TEST_IMAGE,
                                   source={
                                       "provider": "git",
                                       "uri": "asd"
                                   })
    workflow.source = MockSource(str(tmpdir))
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)

    if for_orchestrator:
        workflow.buildstep_plugins_conf = [{
            'name':
            constants.PLUGIN_BUILD_ORCHESTRATE_KEY
        }]

    mock_reactor_config(workflow,
                        tmpdir,
                        data=config_map,
                        default_si=default_si)
    return workflow
コード例 #3
0
def workflow(tmpdir):
    workflow = DockerBuildWorkflow(TEST_IMAGE,
                                   source={
                                       "provider": "git",
                                       "uri": "asd"
                                   })

    # Stash the tmpdir in workflow so it can be used later
    workflow._tmpdir = tmpdir

    class MockSource(StubSource):
        def __init__(self, workdir):
            super(MockSource, self).__init__()
            self.workdir = workdir

    workflow.source = MockSource(str(tmpdir))

    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)
    workflow.buildstep_plugins_conf = [{'name': PLUGIN_BUILD_ORCHESTRATE_KEY}]

    mock_repo_config(workflow)
    mock_reactor_config(workflow)
    mock_build_json()
    mock_cachito_api(workflow)
    mock_koji()

    return workflow
コード例 #4
0
def mock_workflow(tmpdir):
    workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, TEST_IMAGE)
    workflow.source = StubSource()
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)
    return workflow
コード例 #5
0
def mock_workflow(tmpdir):
    workflow = DockerBuildWorkflow(TEST_IMAGE,
                                   source={
                                       "provider": "git",
                                       "uri": "asd"
                                   })
    workflow.source = StubSource()
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)

    return workflow
コード例 #6
0
def mock_workflow(tmpdir, for_orchestrator=False):
    workflow = DockerBuildWorkflow(
        TEST_IMAGE,
        source={"provider": "git", "uri": "asd"}
    )
    workflow.source = StubSource()
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path(str(tmpdir))
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)

    if for_orchestrator:
        workflow.buildstep_plugins_conf = [{'name': PLUGIN_BUILD_ORCHESTRATE_KEY}]

    return workflow
コード例 #7
0
def mock_workflow():
    """
    Provide just enough structure that workflow can be used to run the plugin.
    Defaults below are solely to enable that purpose; tests where those values
    matter should provide their own.
    """

    workflow = DockerBuildWorkflow(SOURCE, "mock:default_built")
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path('/mock-path')
    builder.parent_images["mock:base"] = "mock:tag"
    builder.base_image = ImageName.parse("mock:tag")
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)

    return workflow
コード例 #8
0
def mock_workflow():
    """
    Provide just enough structure that workflow can be used to run the plugin.
    Defaults below are solely to enable that purpose; tests where those values
    matter should provide their own.
    """

    workflow = DockerBuildWorkflow(SOURCE, "mock:default_built")
    workflow.source = StubSource()
    builder = StubInsideBuilder().for_workflow(workflow)
    builder.set_df_path('/mock-path')
    base_image_name = ImageName.parse("mock:tag")
    builder.parent_images[ImageName.parse("mock:base")] = base_image_name
    builder.base_image = base_image_name
    builder.tasker = flexmock()
    workflow.builder = flexmock(builder)

    return workflow