本文整理汇总了Python中atomic_reactor.inner.DockerBuildWorkflow.build_logs方法的典型用法代码示例。如果您正苦于以下问题:Python DockerBuildWorkflow.build_logs方法的具体用法?Python DockerBuildWorkflow.build_logs怎么用?Python DockerBuildWorkflow.build_logs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atomic_reactor.inner.DockerBuildWorkflow
的用法示例。
在下文中一共展示了DockerBuildWorkflow.build_logs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare
# 需要导入模块: from atomic_reactor.inner import DockerBuildWorkflow [as 别名]
# 或者: from atomic_reactor.inner.DockerBuildWorkflow import build_logs [as 别名]
def prepare():
def set_annotations_on_build(build_id, labels, namespace='default'):
assert namespace == 'namespace'
new_environ = deepcopy(os.environ)
new_environ["BUILD"] = '''
{
"metadata": {
"name": "asd",
"namespace": "namespace"
}
}
'''
flexmock(OSBS, set_annotations_on_build=set_annotations_on_build)
flexmock(os)
os.should_receive("environ").and_return(new_environ)
workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
workflow.push_conf.add_pulp_registry("test", LOCALHOST_REGISTRY)
workflow.tag_conf.add_primary_image(TEST_IMAGE)
workflow.tag_conf.add_unique_image("namespace/image:asd123")
r = workflow.push_conf.add_docker_registry(DOCKER0_REGISTRY)
r.digests[TEST_IMAGE] = DIGEST1
r.digests["namespace/image:asd123"] = DIGEST2
setattr(workflow, 'builder', X)
setattr(workflow, '_base_image_inspect', {'Id': '01234567'})
workflow.build_logs = ["a", "b"]
workflow.source.lg = LazyGit(None, commit="commit")
flexmock(workflow.source.lg)
workflow.source.lg.should_receive("_commit_id").and_return("commit")
return workflow
示例2: prepare
# 需要导入模块: from atomic_reactor.inner import DockerBuildWorkflow [as 别名]
# 或者: from atomic_reactor.inner.DockerBuildWorkflow import build_logs [as 别名]
def prepare(pulp_registries=None, docker_registries=None, before_dockerfile=False):
if pulp_registries is None:
pulp_registries = (
("test", LOCALHOST_REGISTRY),
)
if docker_registries is None:
docker_registries = (DOCKER0_REGISTRY,)
def set_annotations_on_build(build_id, annotations):
pass
def update_labels_on_build(build_id, labels):
pass
new_environ = deepcopy(os.environ)
new_environ["BUILD"] = dedent('''\
{
"metadata": {
"name": "asd",
"namespace": "namespace"
}
}
''')
flexmock(OSBS, set_annotations_on_build=set_annotations_on_build)
flexmock(OSBS, update_labels_on_build=update_labels_on_build)
(flexmock(osbs.conf)
.should_call("Configuration")
.with_args(namespace="namespace", conf_file=None, verify_ssl=True,
openshift_url="http://example.com/", openshift_uri="http://example.com/",
use_auth=True))
flexmock(os)
os.should_receive("environ").and_return(new_environ)
workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
for name, crane_uri in pulp_registries:
workflow.push_conf.add_pulp_registry(name, crane_uri)
workflow.tag_conf.add_primary_image(TEST_IMAGE)
workflow.tag_conf.add_unique_image("namespace/image:asd123")
for docker_registry in docker_registries:
r = workflow.push_conf.add_docker_registry(docker_registry)
r.digests[TEST_IMAGE] = ManifestDigest(v1=DIGEST_NOT_USED, v2=DIGEST1)
r.digests["namespace/image:asd123"] = ManifestDigest(v1=DIGEST_NOT_USED,
v2=DIGEST2)
if before_dockerfile:
setattr(workflow, 'builder', XBeforeDockerfile())
else:
setattr(workflow, 'builder', X)
setattr(workflow, '_base_image_inspect', {'Id': '01234567'})
workflow.build_logs = [
"a", "b",
]
workflow.source.lg = LazyGit(None, commit="commit")
flexmock(workflow.source.lg)
workflow.source.lg.should_receive("_commit_id").and_return("commit")
return workflow
示例3: test_metadata_plugin
# 需要导入模块: from atomic_reactor.inner import DockerBuildWorkflow [as 别名]
# 或者: from atomic_reactor.inner.DockerBuildWorkflow import build_logs [as 别名]
def test_metadata_plugin(tmpdir):
def set_annotations_on_build(build_id, labels):
pass
new_environ = deepcopy(os.environ)
new_environ["BUILD"] = '{"metadata": {"name": "asd"}}'
flexmock(OSBS, set_annotations_on_build=set_annotations_on_build)
flexmock(os)
os.should_receive("environ").and_return(new_environ)
workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
workflow.push_conf.add_pulp_registry("test", LOCALHOST_REGISTRY)
workflow.tag_conf.add_primary_image(TEST_IMAGE)
workflow.tag_conf.add_unique_image("namespace/image:asd123")
setattr(workflow, 'builder', X)
workflow.build_logs = ["a", "b"]
workflow.source.lg = LazyGit(None, commit="commit")
flexmock(workflow.source.lg)
workflow.source.lg.should_receive("_commit_id").and_return("commit")
workflow.prebuild_results = {
CpDockerfilePlugin.key: "dockerfile-content",
DistgitFetchArtefactsPlugin.key: "artefact1\nartefact2",
}
workflow.postbuild_results = {
PostBuildRPMqaPlugin.key: "rpm1\nrpm2",
}
runner = PostBuildPluginsRunner(
None,
workflow,
[{
'name': StoreMetadataInOSv3Plugin.key,
"args": {
"url": "http://example.com/"
}
}]
)
output = runner.run()
assert StoreMetadataInOSv3Plugin.key in output
labels = output[StoreMetadataInOSv3Plugin.key]
assert "dockerfile" in labels
assert "artefacts" in labels
assert "logs" in labels
assert "rpm-packages" in labels
assert "repositories" in labels
assert "commit_id" in labels
示例4: prepare
# 需要导入模块: from atomic_reactor.inner import DockerBuildWorkflow [as 别名]
# 或者: from atomic_reactor.inner.DockerBuildWorkflow import build_logs [as 别名]
def prepare():
def set_annotations_on_build(build_id, labels):
pass
def update_labels_on_build(build_id, labels):
pass
new_environ = deepcopy(os.environ)
new_environ["BUILD"] = '''
{
"metadata": {
"name": "asd",
"namespace": "namespace"
}
}
'''
flexmock(OSBS, set_annotations_on_build=set_annotations_on_build)
flexmock(OSBS, update_labels_on_build=update_labels_on_build)
(flexmock(osbs.conf)
.should_call("Configuration")
.with_args(namespace="namespace", conf_file=None, verify_ssl=True,
openshift_url="http://example.com/", openshift_uri="http://example.com/",
use_auth=True))
flexmock(os)
os.should_receive("environ").and_return(new_environ)
workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
workflow.push_conf.add_pulp_registry("test", LOCALHOST_REGISTRY)
workflow.tag_conf.add_primary_image(TEST_IMAGE)
workflow.tag_conf.add_unique_image("namespace/image:asd123")
r = workflow.push_conf.add_docker_registry(DOCKER0_REGISTRY)
r.digests[TEST_IMAGE] = DIGEST1
r.digests["namespace/image:asd123"] = DIGEST2
setattr(workflow, 'builder', X)
setattr(workflow, '_base_image_inspect', {'Id': '01234567'})
workflow.build_logs = [
"a", "b",
]
workflow.source.lg = LazyGit(None, commit="commit")
flexmock(workflow.source.lg)
workflow.source.lg.should_receive("_commit_id").and_return("commit")
return workflow
示例5: prepare
# 需要导入模块: from atomic_reactor.inner import DockerBuildWorkflow [as 别名]
# 或者: from atomic_reactor.inner.DockerBuildWorkflow import build_logs [as 别名]
def prepare(pulp_registries=None, docker_registries=None, before_dockerfile=False, # noqa
reactor_config_map=False):
if pulp_registries is None:
pulp_registries = (
("test", LOCALHOST_REGISTRY),
)
if docker_registries is None:
docker_registries = (DOCKER0_REGISTRY,)
def update_annotations_on_build(build_id, annotations):
pass
def update_labels_on_build(build_id, labels):
pass
new_environ = deepcopy(os.environ)
new_environ["BUILD"] = dedent('''\
{
"metadata": {
"name": "asd",
"namespace": "namespace"
}
}
''')
flexmock(OSBS, update_annotations_on_build=update_annotations_on_build)
flexmock(OSBS, update_labels_on_build=update_labels_on_build)
config_kwargs = {
'namespace': 'namespace',
'verify_ssl': True,
'openshift_url': 'http://example.com/',
'use_auth': True,
'conf_file': None,
'build_json_dir': None
}
(flexmock(osbs.conf.Configuration)
.should_call("__init__")
.with_args(**config_kwargs))
flexmock(os)
os.should_receive("environ").and_return(new_environ) # pylint: disable=no-member
workflow = DockerBuildWorkflow({"provider": "git", "uri": "asd"}, "test-image")
if reactor_config_map:
openshift_map = {
'url': 'http://example.com/',
'insecure': False,
'auth': {'enable': True},
}
workflow.plugin_workspace[ReactorConfigPlugin.key] = {}
workflow.plugin_workspace[ReactorConfigPlugin.key][WORKSPACE_CONF_KEY] =\
ReactorConfig({'version': 1, 'openshift': openshift_map})
for name, crane_uri in pulp_registries:
workflow.push_conf.add_pulp_registry(name, crane_uri)
workflow.tag_conf.add_floating_image(TEST_IMAGE)
workflow.tag_conf.add_primary_image("namespace/image:version-release")
workflow.tag_conf.add_unique_image("namespace/image:asd123")
for docker_registry in docker_registries:
r = workflow.push_conf.add_docker_registry(docker_registry)
r.digests[TEST_IMAGE_NAME] = ManifestDigest(v1=DIGEST_NOT_USED, v2=DIGEST1)
r.digests["namespace/image:asd123"] = ManifestDigest(v1=DIGEST_NOT_USED,
v2=DIGEST2)
if before_dockerfile:
setattr(workflow, 'builder', XBeforeDockerfile())
setattr(workflow.builder, 'base_image_inspect', {})
else:
setattr(workflow, 'builder', X())
setattr(workflow.builder, 'base_image_inspect', {'Id': '01234567'})
workflow.build_logs = [
"a", "b",
]
workflow.source.lg = LazyGit(None, commit="commit")
flexmock(workflow.source.lg)
# pylint: disable=no-member
workflow.source.lg.should_receive("_commit_id").and_return("commit")
# pylint: enable=no-member
return workflow