repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectatomic/atomic-reactor | docs/manpage/generate_manpage.py | ManPageFormatter.create_subcommand_synopsis | def create_subcommand_synopsis(self, parser):
""" show usage with description for commands """
self.add_usage(parser.usage, parser._get_positional_actions(),
None, prefix='')
usage = self._format_usage(parser.usage, parser._get_positional_actions(),
... | python | def create_subcommand_synopsis(self, parser):
""" show usage with description for commands """
self.add_usage(parser.usage, parser._get_positional_actions(),
None, prefix='')
usage = self._format_usage(parser.usage, parser._get_positional_actions(),
... | [
"def",
"create_subcommand_synopsis",
"(",
"self",
",",
"parser",
")",
":",
"self",
".",
"add_usage",
"(",
"parser",
".",
"usage",
",",
"parser",
".",
"_get_positional_actions",
"(",
")",
",",
"None",
",",
"prefix",
"=",
"''",
")",
"usage",
"=",
"self",
"... | show usage with description for commands | [
"show",
"usage",
"with",
"description",
"for",
"commands"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/docs/manpage/generate_manpage.py#L89-L95 | train | 28,500 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | get_worker_build_info | def get_worker_build_info(workflow, platform):
"""
Obtain worker build information for a given platform
"""
workspace = workflow.plugin_workspace[OrchestrateBuildPlugin.key]
return workspace[WORKSPACE_KEY_BUILD_INFO][platform] | python | def get_worker_build_info(workflow, platform):
"""
Obtain worker build information for a given platform
"""
workspace = workflow.plugin_workspace[OrchestrateBuildPlugin.key]
return workspace[WORKSPACE_KEY_BUILD_INFO][platform] | [
"def",
"get_worker_build_info",
"(",
"workflow",
",",
"platform",
")",
":",
"workspace",
"=",
"workflow",
".",
"plugin_workspace",
"[",
"OrchestrateBuildPlugin",
".",
"key",
"]",
"return",
"workspace",
"[",
"WORKSPACE_KEY_BUILD_INFO",
"]",
"[",
"platform",
"]"
] | Obtain worker build information for a given platform | [
"Obtain",
"worker",
"build",
"information",
"for",
"a",
"given",
"platform"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L60-L65 | train | 28,501 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | override_build_kwarg | def override_build_kwarg(workflow, k, v, platform=None):
"""
Override a build-kwarg for all worker builds
"""
key = OrchestrateBuildPlugin.key
# Use None to indicate an override for all platforms
workspace = workflow.plugin_workspace.setdefault(key, {})
override_kwargs = workspace.setdefaul... | python | def override_build_kwarg(workflow, k, v, platform=None):
"""
Override a build-kwarg for all worker builds
"""
key = OrchestrateBuildPlugin.key
# Use None to indicate an override for all platforms
workspace = workflow.plugin_workspace.setdefault(key, {})
override_kwargs = workspace.setdefaul... | [
"def",
"override_build_kwarg",
"(",
"workflow",
",",
"k",
",",
"v",
",",
"platform",
"=",
"None",
")",
":",
"key",
"=",
"OrchestrateBuildPlugin",
".",
"key",
"# Use None to indicate an override for all platforms",
"workspace",
"=",
"workflow",
".",
"plugin_workspace",... | Override a build-kwarg for all worker builds | [
"Override",
"a",
"build",
"-",
"kwarg",
"for",
"all",
"worker",
"builds"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L76-L86 | train | 28,502 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | wait_for_any_cluster | def wait_for_any_cluster(contexts):
"""
Wait until any of the clusters are out of retry-wait
:param contexts: List[ClusterRetryContext]
:raises: AllClustersFailedException if no more retry attempts allowed
"""
try:
earliest_retry_at = min(ctx.retry_at for ctx in contexts.values()
... | python | def wait_for_any_cluster(contexts):
"""
Wait until any of the clusters are out of retry-wait
:param contexts: List[ClusterRetryContext]
:raises: AllClustersFailedException if no more retry attempts allowed
"""
try:
earliest_retry_at = min(ctx.retry_at for ctx in contexts.values()
... | [
"def",
"wait_for_any_cluster",
"(",
"contexts",
")",
":",
"try",
":",
"earliest_retry_at",
"=",
"min",
"(",
"ctx",
".",
"retry_at",
"for",
"ctx",
"in",
"contexts",
".",
"values",
"(",
")",
"if",
"not",
"ctx",
".",
"failed",
")",
"except",
"ValueError",
"... | Wait until any of the clusters are out of retry-wait
:param contexts: List[ClusterRetryContext]
:raises: AllClustersFailedException if no more retry attempts allowed | [
"Wait",
"until",
"any",
"of",
"the",
"clusters",
"are",
"out",
"of",
"retry",
"-",
"wait"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L129-L145 | train | 28,503 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | OrchestrateBuildPlugin.validate_arrangement_version | def validate_arrangement_version(self):
"""Validate if the arrangement_version is supported
This is for autorebuilds to fail early otherwise they may failed
on workers because of osbs-client validation checks.
Method should be called after self.adjust_build_kwargs
Shows a warn... | python | def validate_arrangement_version(self):
"""Validate if the arrangement_version is supported
This is for autorebuilds to fail early otherwise they may failed
on workers because of osbs-client validation checks.
Method should be called after self.adjust_build_kwargs
Shows a warn... | [
"def",
"validate_arrangement_version",
"(",
"self",
")",
":",
"arrangement_version",
"=",
"self",
".",
"build_kwargs",
"[",
"'arrangement_version'",
"]",
"if",
"arrangement_version",
"is",
"None",
":",
"return",
"if",
"arrangement_version",
"<=",
"5",
":",
"# TODO: ... | Validate if the arrangement_version is supported
This is for autorebuilds to fail early otherwise they may failed
on workers because of osbs-client validation checks.
Method should be called after self.adjust_build_kwargs
Shows a warning when version is deprecated
:raises Val... | [
"Validate",
"if",
"the",
"arrangement_version",
"is",
"supported"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L421-L440 | train | 28,504 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | OrchestrateBuildPlugin.get_clusters | def get_clusters(self, platform, retry_contexts, all_clusters):
''' return clusters sorted by load. '''
possible_cluster_info = {}
candidates = set(copy.copy(all_clusters))
while candidates and not possible_cluster_info:
wait_for_any_cluster(retry_contexts)
for ... | python | def get_clusters(self, platform, retry_contexts, all_clusters):
''' return clusters sorted by load. '''
possible_cluster_info = {}
candidates = set(copy.copy(all_clusters))
while candidates and not possible_cluster_info:
wait_for_any_cluster(retry_contexts)
for ... | [
"def",
"get_clusters",
"(",
"self",
",",
"platform",
",",
"retry_contexts",
",",
"all_clusters",
")",
":",
"possible_cluster_info",
"=",
"{",
"}",
"candidates",
"=",
"set",
"(",
"copy",
".",
"copy",
"(",
"all_clusters",
")",
")",
"while",
"candidates",
"and"... | return clusters sorted by load. | [
"return",
"clusters",
"sorted",
"by",
"load",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L472-L495 | train | 28,505 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | OrchestrateBuildPlugin.get_koji_upload_dir | def get_koji_upload_dir():
"""
Create a path name for uploading files to
:return: str, path name expected to be unique
"""
dir_prefix = 'koji-upload'
random_chars = ''.join([random.choice(ascii_letters)
for _ in range(8)])
unique_f... | python | def get_koji_upload_dir():
"""
Create a path name for uploading files to
:return: str, path name expected to be unique
"""
dir_prefix = 'koji-upload'
random_chars = ''.join([random.choice(ascii_letters)
for _ in range(8)])
unique_f... | [
"def",
"get_koji_upload_dir",
"(",
")",
":",
"dir_prefix",
"=",
"'koji-upload'",
"random_chars",
"=",
"''",
".",
"join",
"(",
"[",
"random",
".",
"choice",
"(",
"ascii_letters",
")",
"for",
"_",
"in",
"range",
"(",
"8",
")",
"]",
")",
"unique_fragment",
... | Create a path name for uploading files to
:return: str, path name expected to be unique | [
"Create",
"a",
"path",
"name",
"for",
"uploading",
"files",
"to"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L503-L513 | train | 28,506 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | OrchestrateBuildPlugin.select_and_start_cluster | def select_and_start_cluster(self, platform):
''' Choose a cluster and start a build on it '''
clusters = self.reactor_config.get_enabled_clusters_for_platform(platform)
if not clusters:
raise UnknownPlatformException('No clusters found for platform {}!'
... | python | def select_and_start_cluster(self, platform):
''' Choose a cluster and start a build on it '''
clusters = self.reactor_config.get_enabled_clusters_for_platform(platform)
if not clusters:
raise UnknownPlatformException('No clusters found for platform {}!'
... | [
"def",
"select_and_start_cluster",
"(",
"self",
",",
"platform",
")",
":",
"clusters",
"=",
"self",
".",
"reactor_config",
".",
"get_enabled_clusters_for_platform",
"(",
"platform",
")",
"if",
"not",
"clusters",
":",
"raise",
"UnknownPlatformException",
"(",
"'No cl... | Choose a cluster and start a build on it | [
"Choose",
"a",
"cluster",
"and",
"start",
"a",
"build",
"on",
"it"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L666-L702 | train | 28,507 |
projectatomic/atomic-reactor | atomic_reactor/plugins/build_orchestrate_build.py | OrchestrateBuildPlugin.set_build_image | def set_build_image(self):
"""
Overrides build_image for worker, to be same as in orchestrator build
"""
current_platform = platform.processor()
orchestrator_platform = current_platform or 'x86_64'
current_buildimage = self.get_current_buildimage()
for plat, buil... | python | def set_build_image(self):
"""
Overrides build_image for worker, to be same as in orchestrator build
"""
current_platform = platform.processor()
orchestrator_platform = current_platform or 'x86_64'
current_buildimage = self.get_current_buildimage()
for plat, buil... | [
"def",
"set_build_image",
"(",
"self",
")",
":",
"current_platform",
"=",
"platform",
".",
"processor",
"(",
")",
"orchestrator_platform",
"=",
"current_platform",
"or",
"'x86_64'",
"current_buildimage",
"=",
"self",
".",
"get_current_buildimage",
"(",
")",
"for",
... | Overrides build_image for worker, to be same as in orchestrator build | [
"Overrides",
"build_image",
"for",
"worker",
"to",
"be",
"same",
"as",
"in",
"orchestrator",
"build"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/build_orchestrate_build.py#L838-L877 | train | 28,508 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.get_manifest | def get_manifest(self, session, repository, ref):
"""
Downloads a manifest from a registry. ref can be a digest, or a tag.
"""
self.log.debug("%s: Retrieving manifest for %s:%s", session.registry, repository, ref)
headers = {
'Accept': ', '.join(self.manifest_media_t... | python | def get_manifest(self, session, repository, ref):
"""
Downloads a manifest from a registry. ref can be a digest, or a tag.
"""
self.log.debug("%s: Retrieving manifest for %s:%s", session.registry, repository, ref)
headers = {
'Accept': ', '.join(self.manifest_media_t... | [
"def",
"get_manifest",
"(",
"self",
",",
"session",
",",
"repository",
",",
"ref",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"%s: Retrieving manifest for %s:%s\"",
",",
"session",
".",
"registry",
",",
"repository",
",",
"ref",
")",
"headers",
"=",
... | Downloads a manifest from a registry. ref can be a digest, or a tag. | [
"Downloads",
"a",
"manifest",
"from",
"a",
"registry",
".",
"ref",
"can",
"be",
"a",
"digest",
"or",
"a",
"tag",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L83-L99 | train | 28,509 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.link_manifest_references_into_repository | def link_manifest_references_into_repository(self, session, manifest, media_type,
source_repo, target_repo):
"""
Links all the blobs referenced by the manifest from source_repo into target_repo.
"""
if source_repo == target_repo:
... | python | def link_manifest_references_into_repository(self, session, manifest, media_type,
source_repo, target_repo):
"""
Links all the blobs referenced by the manifest from source_repo into target_repo.
"""
if source_repo == target_repo:
... | [
"def",
"link_manifest_references_into_repository",
"(",
"self",
",",
"session",
",",
"manifest",
",",
"media_type",
",",
"source_repo",
",",
"target_repo",
")",
":",
"if",
"source_repo",
"==",
"target_repo",
":",
"return",
"parsed",
"=",
"json",
".",
"loads",
"(... | Links all the blobs referenced by the manifest from source_repo into target_repo. | [
"Links",
"all",
"the",
"blobs",
"referenced",
"by",
"the",
"manifest",
"from",
"source_repo",
"into",
"target_repo",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L128-L150 | train | 28,510 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.store_manifest_in_repository | def store_manifest_in_repository(self, session, manifest, media_type,
source_repo, target_repo, digest=None, tag=None):
"""
Stores the manifest into target_repo, possibly tagging it. This may involve
copying referenced blobs from source_repo.
"""
... | python | def store_manifest_in_repository(self, session, manifest, media_type,
source_repo, target_repo, digest=None, tag=None):
"""
Stores the manifest into target_repo, possibly tagging it. This may involve
copying referenced blobs from source_repo.
"""
... | [
"def",
"store_manifest_in_repository",
"(",
"self",
",",
"session",
",",
"manifest",
",",
"media_type",
",",
"source_repo",
",",
"target_repo",
",",
"digest",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"if",
"tag",
":",
"self",
".",
"log",
".",
"deb... | Stores the manifest into target_repo, possibly tagging it. This may involve
copying referenced blobs from source_repo. | [
"Stores",
"the",
"manifest",
"into",
"target_repo",
"possibly",
"tagging",
"it",
".",
"This",
"may",
"involve",
"copying",
"referenced",
"blobs",
"from",
"source_repo",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L152-L176 | train | 28,511 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.build_list | def build_list(self, manifests):
"""
Builds a manifest list or OCI image out of the given manifests
"""
media_type = manifests[0]['media_type']
if (not all(m['media_type'] == media_type for m in manifests)):
raise PluginFailedException('worker manifests have inconsis... | python | def build_list(self, manifests):
"""
Builds a manifest list or OCI image out of the given manifests
"""
media_type = manifests[0]['media_type']
if (not all(m['media_type'] == media_type for m in manifests)):
raise PluginFailedException('worker manifests have inconsis... | [
"def",
"build_list",
"(",
"self",
",",
"manifests",
")",
":",
"media_type",
"=",
"manifests",
"[",
"0",
"]",
"[",
"'media_type'",
"]",
"if",
"(",
"not",
"all",
"(",
"m",
"[",
"'media_type'",
"]",
"==",
"media_type",
"for",
"m",
"in",
"manifests",
")",
... | Builds a manifest list or OCI image out of the given manifests | [
"Builds",
"a",
"manifest",
"list",
"or",
"OCI",
"image",
"out",
"of",
"the",
"given",
"manifests"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L178-L210 | train | 28,512 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.group_manifests_and_tag | def group_manifests_and_tag(self, session, worker_digests):
"""
Creates a manifest list or OCI image index that groups the different manifests
in worker_digests, then tags the result with with all the configured tags found
in workflow.tag_conf.
"""
self.log.info("%s: Crea... | python | def group_manifests_and_tag(self, session, worker_digests):
"""
Creates a manifest list or OCI image index that groups the different manifests
in worker_digests, then tags the result with with all the configured tags found
in workflow.tag_conf.
"""
self.log.info("%s: Crea... | [
"def",
"group_manifests_and_tag",
"(",
"self",
",",
"session",
",",
"worker_digests",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"%s: Creating manifest list\"",
",",
"session",
".",
"registry",
")",
"# Extract information about the manifests that we will group - we... | Creates a manifest list or OCI image index that groups the different manifests
in worker_digests, then tags the result with with all the configured tags found
in workflow.tag_conf. | [
"Creates",
"a",
"manifest",
"list",
"or",
"OCI",
"image",
"index",
"that",
"groups",
"the",
"different",
"manifests",
"in",
"worker_digests",
"then",
"tags",
"the",
"result",
"with",
"with",
"all",
"the",
"configured",
"tags",
"found",
"in",
"workflow",
".",
... | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L246-L312 | train | 28,513 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_group_manifests.py | GroupManifestsPlugin.tag_manifest_into_registry | def tag_manifest_into_registry(self, session, worker_digest):
"""
Tags the manifest identified by worker_digest into session.registry with all the
configured tags found in workflow.tag_conf.
"""
self.log.info("%s: Tagging manifest", session.registry)
digest = worker_dige... | python | def tag_manifest_into_registry(self, session, worker_digest):
"""
Tags the manifest identified by worker_digest into session.registry with all the
configured tags found in workflow.tag_conf.
"""
self.log.info("%s: Tagging manifest", session.registry)
digest = worker_dige... | [
"def",
"tag_manifest_into_registry",
"(",
"self",
",",
"session",
",",
"worker_digest",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"%s: Tagging manifest\"",
",",
"session",
".",
"registry",
")",
"digest",
"=",
"worker_digest",
"[",
"'digest'",
"]",
"sou... | Tags the manifest identified by worker_digest into session.registry with all the
configured tags found in workflow.tag_conf. | [
"Tags",
"the",
"manifest",
"identified",
"by",
"worker_digest",
"into",
"session",
".",
"registry",
"with",
"all",
"the",
"configured",
"tags",
"found",
"in",
"workflow",
".",
"tag_conf",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_group_manifests.py#L314-L341 | train | 28,514 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_koji_parent.py | KojiParentPlugin.detect_parent_image_nvr | def detect_parent_image_nvr(self, image_name, inspect_data=None):
"""
Look for the NVR labels, if any, in the image.
:return NVR string if labels found, otherwise None
"""
if inspect_data is None:
inspect_data = self.workflow.builder.parent_image_inspect(image_name)... | python | def detect_parent_image_nvr(self, image_name, inspect_data=None):
"""
Look for the NVR labels, if any, in the image.
:return NVR string if labels found, otherwise None
"""
if inspect_data is None:
inspect_data = self.workflow.builder.parent_image_inspect(image_name)... | [
"def",
"detect_parent_image_nvr",
"(",
"self",
",",
"image_name",
",",
"inspect_data",
"=",
"None",
")",
":",
"if",
"inspect_data",
"is",
"None",
":",
"inspect_data",
"=",
"self",
".",
"workflow",
".",
"builder",
".",
"parent_image_inspect",
"(",
"image_name",
... | Look for the NVR labels, if any, in the image.
:return NVR string if labels found, otherwise None | [
"Look",
"for",
"the",
"NVR",
"labels",
"if",
"any",
"in",
"the",
"image",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_koji_parent.py#L98-L125 | train | 28,515 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_koji_parent.py | KojiParentPlugin.wait_for_parent_image_build | def wait_for_parent_image_build(self, nvr):
"""
Given image NVR, wait for the build that produced it to show up in koji.
If it doesn't within the timeout, raise an error.
:return build info dict with 'nvr' and 'id' keys
"""
self.log.info('Waiting for Koji build for pare... | python | def wait_for_parent_image_build(self, nvr):
"""
Given image NVR, wait for the build that produced it to show up in koji.
If it doesn't within the timeout, raise an error.
:return build info dict with 'nvr' and 'id' keys
"""
self.log.info('Waiting for Koji build for pare... | [
"def",
"wait_for_parent_image_build",
"(",
"self",
",",
"nvr",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Waiting for Koji build for parent image %s'",
",",
"nvr",
")",
"poll_start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"time",
".",
"time",
"(... | Given image NVR, wait for the build that produced it to show up in koji.
If it doesn't within the timeout, raise an error.
:return build info dict with 'nvr' and 'id' keys | [
"Given",
"image",
"NVR",
"wait",
"for",
"the",
"build",
"that",
"produced",
"it",
"to",
"show",
"up",
"in",
"koji",
".",
"If",
"it",
"doesn",
"t",
"within",
"the",
"timeout",
"raise",
"an",
"error",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_koji_parent.py#L127-L146 | train | 28,516 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_koji_parent.py | KojiParentPlugin.make_result | def make_result(self):
"""Construct the result dict to be preserved in the build metadata."""
result = {}
if self._base_image_build:
result[BASE_IMAGE_KOJI_BUILD] = self._base_image_build
if self._parent_builds:
result[PARENT_IMAGES_KOJI_BUILDS] = self._parent_bui... | python | def make_result(self):
"""Construct the result dict to be preserved in the build metadata."""
result = {}
if self._base_image_build:
result[BASE_IMAGE_KOJI_BUILD] = self._base_image_build
if self._parent_builds:
result[PARENT_IMAGES_KOJI_BUILDS] = self._parent_bui... | [
"def",
"make_result",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"if",
"self",
".",
"_base_image_build",
":",
"result",
"[",
"BASE_IMAGE_KOJI_BUILD",
"]",
"=",
"self",
".",
"_base_image_build",
"if",
"self",
".",
"_parent_builds",
":",
"result",
"[",
... | Construct the result dict to be preserved in the build metadata. | [
"Construct",
"the",
"result",
"dict",
"to",
"be",
"preserved",
"in",
"the",
"build",
"metadata",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_koji_parent.py#L148-L155 | train | 28,517 |
projectatomic/atomic-reactor | atomic_reactor/util.py | wait_for_command | def wait_for_command(logs_generator):
"""
Create a CommandResult from given iterator
:return: CommandResult
"""
logger.info("wait_for_command")
cr = CommandResult()
for item in logs_generator:
cr.parse_item(item)
logger.info("no more logs")
return cr | python | def wait_for_command(logs_generator):
"""
Create a CommandResult from given iterator
:return: CommandResult
"""
logger.info("wait_for_command")
cr = CommandResult()
for item in logs_generator:
cr.parse_item(item)
logger.info("no more logs")
return cr | [
"def",
"wait_for_command",
"(",
"logs_generator",
")",
":",
"logger",
".",
"info",
"(",
"\"wait_for_command\"",
")",
"cr",
"=",
"CommandResult",
"(",
")",
"for",
"item",
"in",
"logs_generator",
":",
"cr",
".",
"parse_item",
"(",
"item",
")",
"logger",
".",
... | Create a CommandResult from given iterator
:return: CommandResult | [
"Create",
"a",
"CommandResult",
"from",
"given",
"iterator"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L290-L302 | train | 28,518 |
projectatomic/atomic-reactor | atomic_reactor/util.py | print_version_of_tools | def print_version_of_tools():
"""
print versions of used tools to logger
"""
logger.info("Using these tools:")
for tool in get_version_of_tools():
logger.info("%s-%s at %s", tool["name"], tool["version"], tool["path"]) | python | def print_version_of_tools():
"""
print versions of used tools to logger
"""
logger.info("Using these tools:")
for tool in get_version_of_tools():
logger.info("%s-%s at %s", tool["name"], tool["version"], tool["path"]) | [
"def",
"print_version_of_tools",
"(",
")",
":",
"logger",
".",
"info",
"(",
"\"Using these tools:\"",
")",
"for",
"tool",
"in",
"get_version_of_tools",
"(",
")",
":",
"logger",
".",
"info",
"(",
"\"%s-%s at %s\"",
",",
"tool",
"[",
"\"name\"",
"]",
",",
"too... | print versions of used tools to logger | [
"print",
"versions",
"of",
"used",
"tools",
"to",
"logger"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L566-L572 | train | 28,519 |
projectatomic/atomic-reactor | atomic_reactor/util.py | guess_manifest_media_type | def guess_manifest_media_type(content):
"""
Guess the media type for the given manifest content
:param content: JSON content of manifest (bytes)
:return: media type (str), or None if unable to guess
"""
encoding = guess_json_utf(content)
try:
manifest = json.loads(content.decode(enc... | python | def guess_manifest_media_type(content):
"""
Guess the media type for the given manifest content
:param content: JSON content of manifest (bytes)
:return: media type (str), or None if unable to guess
"""
encoding = guess_json_utf(content)
try:
manifest = json.loads(content.decode(enc... | [
"def",
"guess_manifest_media_type",
"(",
"content",
")",
":",
"encoding",
"=",
"guess_json_utf",
"(",
"content",
")",
"try",
":",
"manifest",
"=",
"json",
".",
"loads",
"(",
"content",
".",
"decode",
"(",
"encoding",
")",
")",
"except",
"(",
"ValueError",
... | Guess the media type for the given manifest content
:param content: JSON content of manifest (bytes)
:return: media type (str), or None if unable to guess | [
"Guess",
"the",
"media",
"type",
"for",
"the",
"given",
"manifest",
"content"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L858-L883 | train | 28,520 |
projectatomic/atomic-reactor | atomic_reactor/util.py | manifest_is_media_type | def manifest_is_media_type(response, media_type):
"""
Attempt to confirm the returned manifest is of a given media type
:param response: a requests.Response
:param media_type: media_type (str), or None to confirm
the media type cannot be guessed
"""
try:
received_media_type = re... | python | def manifest_is_media_type(response, media_type):
"""
Attempt to confirm the returned manifest is of a given media type
:param response: a requests.Response
:param media_type: media_type (str), or None to confirm
the media type cannot be guessed
"""
try:
received_media_type = re... | [
"def",
"manifest_is_media_type",
"(",
"response",
",",
"media_type",
")",
":",
"try",
":",
"received_media_type",
"=",
"response",
".",
"headers",
"[",
"'Content-Type'",
"]",
"except",
"KeyError",
":",
"# Guess media type from content",
"logger",
".",
"debug",
"(",
... | Attempt to confirm the returned manifest is of a given media type
:param response: a requests.Response
:param media_type: media_type (str), or None to confirm
the media type cannot be guessed | [
"Attempt",
"to",
"confirm",
"the",
"returned",
"manifest",
"is",
"of",
"a",
"given",
"media",
"type"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L886-L909 | train | 28,521 |
projectatomic/atomic-reactor | atomic_reactor/util.py | get_manifest_list | def get_manifest_list(image, registry, insecure=False, dockercfg_path=None):
"""Return manifest list for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bo... | python | def get_manifest_list(image, registry, insecure=False, dockercfg_path=None):
"""Return manifest list for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bo... | [
"def",
"get_manifest_list",
"(",
"image",
",",
"registry",
",",
"insecure",
"=",
"False",
",",
"dockercfg_path",
"=",
"None",
")",
":",
"version",
"=",
"'v2_list'",
"registry_session",
"=",
"RegistrySession",
"(",
"registry",
",",
"insecure",
"=",
"insecure",
... | Return manifest list for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool, when True registry's cert is not verified
:param dockercfg_path: str, dirnam... | [
"Return",
"manifest",
"list",
"for",
"image",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1004-L1018 | train | 28,522 |
projectatomic/atomic-reactor | atomic_reactor/util.py | get_all_manifests | def get_all_manifests(image, registry, insecure=False, dockercfg_path=None,
versions=('v1', 'v2', 'v2_list')):
"""Return manifest digests for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
... | python | def get_all_manifests(image, registry, insecure=False, dockercfg_path=None,
versions=('v1', 'v2', 'v2_list')):
"""Return manifest digests for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
... | [
"def",
"get_all_manifests",
"(",
"image",
",",
"registry",
",",
"insecure",
"=",
"False",
",",
"dockercfg_path",
"=",
"None",
",",
"versions",
"=",
"(",
"'v1'",
",",
"'v2'",
",",
"'v2_list'",
")",
")",
":",
"digests",
"=",
"{",
"}",
"registry_session",
"... | Return manifest digests for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool, when True registry's cert is not verified
:param dockercfg_path: str, dir... | [
"Return",
"manifest",
"digests",
"for",
"image",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1021-L1041 | train | 28,523 |
projectatomic/atomic-reactor | atomic_reactor/util.py | get_inspect_for_image | def get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None):
"""Return inspect for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool... | python | def get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None):
"""Return inspect for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool... | [
"def",
"get_inspect_for_image",
"(",
"image",
",",
"registry",
",",
"insecure",
"=",
"False",
",",
"dockercfg_path",
"=",
"None",
")",
":",
"all_man_digests",
"=",
"get_all_manifests",
"(",
"image",
",",
"registry",
",",
"insecure",
"=",
"insecure",
",",
"dock... | Return inspect for image.
:param image: ImageName, the remote image to inspect
:param registry: str, URI for registry, if URI schema is not provided,
https:// will be used
:param insecure: bool, when True registry's cert is not verified
:param dockercfg_path: str, dirname of .... | [
"Return",
"inspect",
"for",
"image",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1044-L1113 | train | 28,524 |
projectatomic/atomic-reactor | atomic_reactor/util.py | df_parser | def df_parser(df_path, workflow=None, cache_content=False, env_replace=True, parent_env=None):
"""
Wrapper for dockerfile_parse's DockerfileParser that takes into account
parent_env inheritance.
:param df_path: string, path to Dockerfile (normally in DockerBuildWorkflow instance)
:param workflow: D... | python | def df_parser(df_path, workflow=None, cache_content=False, env_replace=True, parent_env=None):
"""
Wrapper for dockerfile_parse's DockerfileParser that takes into account
parent_env inheritance.
:param df_path: string, path to Dockerfile (normally in DockerBuildWorkflow instance)
:param workflow: D... | [
"def",
"df_parser",
"(",
"df_path",
",",
"workflow",
"=",
"None",
",",
"cache_content",
"=",
"False",
",",
"env_replace",
"=",
"True",
",",
"parent_env",
"=",
"None",
")",
":",
"p_env",
"=",
"{",
"}",
"if",
"parent_env",
":",
"# If parent_env passed in, just... | Wrapper for dockerfile_parse's DockerfileParser that takes into account
parent_env inheritance.
:param df_path: string, path to Dockerfile (normally in DockerBuildWorkflow instance)
:param workflow: DockerBuildWorkflow object instance, used to find parent image information
:param cache_content: bool, t... | [
"Wrapper",
"for",
"dockerfile_parse",
"s",
"DockerfileParser",
"that",
"takes",
"into",
"account",
"parent_env",
"inheritance",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1171-L1235 | train | 28,525 |
projectatomic/atomic-reactor | atomic_reactor/util.py | are_plugins_in_order | def are_plugins_in_order(plugins_conf, *plugins_names):
"""Check if plugins are configured in given order."""
all_plugins_names = [plugin['name'] for plugin in plugins_conf or []]
start_index = 0
for plugin_name in plugins_names:
try:
start_index = all_plugins_names.index(plugin_name... | python | def are_plugins_in_order(plugins_conf, *plugins_names):
"""Check if plugins are configured in given order."""
all_plugins_names = [plugin['name'] for plugin in plugins_conf or []]
start_index = 0
for plugin_name in plugins_names:
try:
start_index = all_plugins_names.index(plugin_name... | [
"def",
"are_plugins_in_order",
"(",
"plugins_conf",
",",
"*",
"plugins_names",
")",
":",
"all_plugins_names",
"=",
"[",
"plugin",
"[",
"'name'",
"]",
"for",
"plugin",
"in",
"plugins_conf",
"or",
"[",
"]",
"]",
"start_index",
"=",
"0",
"for",
"plugin_name",
"... | Check if plugins are configured in given order. | [
"Check",
"if",
"plugins",
"are",
"configured",
"in",
"given",
"order",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1238-L1247 | train | 28,526 |
projectatomic/atomic-reactor | atomic_reactor/util.py | get_parent_image_koji_data | def get_parent_image_koji_data(workflow):
"""Transform koji_parent plugin results into metadata dict."""
koji_parent = workflow.prebuild_results.get(PLUGIN_KOJI_PARENT_KEY) or {}
image_metadata = {}
parents = {}
for img, build in (koji_parent.get(PARENT_IMAGES_KOJI_BUILDS) or {}).items():
i... | python | def get_parent_image_koji_data(workflow):
"""Transform koji_parent plugin results into metadata dict."""
koji_parent = workflow.prebuild_results.get(PLUGIN_KOJI_PARENT_KEY) or {}
image_metadata = {}
parents = {}
for img, build in (koji_parent.get(PARENT_IMAGES_KOJI_BUILDS) or {}).items():
i... | [
"def",
"get_parent_image_koji_data",
"(",
"workflow",
")",
":",
"koji_parent",
"=",
"workflow",
".",
"prebuild_results",
".",
"get",
"(",
"PLUGIN_KOJI_PARENT_KEY",
")",
"or",
"{",
"}",
"image_metadata",
"=",
"{",
"}",
"parents",
"=",
"{",
"}",
"for",
"img",
... | Transform koji_parent plugin results into metadata dict. | [
"Transform",
"koji_parent",
"plugin",
"results",
"into",
"metadata",
"dict",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1361-L1390 | train | 28,527 |
projectatomic/atomic-reactor | atomic_reactor/util.py | Dockercfg.unpack_auth_b64 | def unpack_auth_b64(self, docker_registry):
"""Decode and unpack base64 'auth' credentials from config file.
:param docker_registry: str, registry reference in config file
:return: namedtuple, UnpackedAuth (or None if no 'auth' is available)
"""
UnpackedAuth = namedtuple('Unpac... | python | def unpack_auth_b64(self, docker_registry):
"""Decode and unpack base64 'auth' credentials from config file.
:param docker_registry: str, registry reference in config file
:return: namedtuple, UnpackedAuth (or None if no 'auth' is available)
"""
UnpackedAuth = namedtuple('Unpac... | [
"def",
"unpack_auth_b64",
"(",
"self",
",",
"docker_registry",
")",
":",
"UnpackedAuth",
"=",
"namedtuple",
"(",
"'UnpackedAuth'",
",",
"[",
"'raw_str'",
",",
"'username'",
",",
"'password'",
"]",
")",
"credentials",
"=",
"self",
".",
"get_credentials",
"(",
"... | Decode and unpack base64 'auth' credentials from config file.
:param docker_registry: str, registry reference in config file
:return: namedtuple, UnpackedAuth (or None if no 'auth' is available) | [
"Decode",
"and",
"unpack",
"base64",
"auth",
"credentials",
"from",
"config",
"file",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L689-L705 | train | 28,528 |
projectatomic/atomic-reactor | atomic_reactor/util.py | ManifestDigest.default | def default(self):
"""Return the default manifest schema version.
Depending on the docker version, <= 1.9, used to push
the image to the registry, v2 schema may not be available.
In such case, the v1 schema should be used when interacting
with the registry. An OCI digest will on... | python | def default(self):
"""Return the default manifest schema version.
Depending on the docker version, <= 1.9, used to push
the image to the registry, v2 schema may not be available.
In such case, the v1 schema should be used when interacting
with the registry. An OCI digest will on... | [
"def",
"default",
"(",
"self",
")",
":",
"return",
"self",
".",
"v2_list",
"or",
"self",
".",
"oci_index",
"or",
"self",
".",
"oci",
"or",
"self",
".",
"v2",
"or",
"self",
".",
"v1"
] | Return the default manifest schema version.
Depending on the docker version, <= 1.9, used to push
the image to the registry, v2 schema may not be available.
In such case, the v1 schema should be used when interacting
with the registry. An OCI digest will only be present when
the... | [
"Return",
"the",
"default",
"manifest",
"schema",
"version",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L779-L788 | train | 28,529 |
projectatomic/atomic-reactor | atomic_reactor/util.py | OSBSLogs.get_log_files | def get_log_files(self, osbs, build_id):
"""
Build list of log files
:return: list, of log files
"""
logs = None
output = []
# Collect logs from server
try:
logs = osbs.get_orchestrator_build_logs(build_id)
except OsbsException as ex... | python | def get_log_files(self, osbs, build_id):
"""
Build list of log files
:return: list, of log files
"""
logs = None
output = []
# Collect logs from server
try:
logs = osbs.get_orchestrator_build_logs(build_id)
except OsbsException as ex... | [
"def",
"get_log_files",
"(",
"self",
",",
"osbs",
",",
"build_id",
")",
":",
"logs",
"=",
"None",
"output",
"=",
"[",
"]",
"# Collect logs from server",
"try",
":",
"logs",
"=",
"osbs",
".",
"get_orchestrator_build_logs",
"(",
"build_id",
")",
"except",
"Osb... | Build list of log files
:return: list, of log files | [
"Build",
"list",
"of",
"log",
"files"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1412-L1449 | train | 28,530 |
projectatomic/atomic-reactor | atomic_reactor/util.py | DigestCollector.update_image_digest | def update_image_digest(self, image, platform, digest):
"""Update parent image digest for specific platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:param str digest: digest of the specified image (sha256:...)
"""
... | python | def update_image_digest(self, image, platform, digest):
"""Update parent image digest for specific platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:param str digest: digest of the specified image (sha256:...)
"""
... | [
"def",
"update_image_digest",
"(",
"self",
",",
"image",
",",
"platform",
",",
"digest",
")",
":",
"image_name_tag",
"=",
"self",
".",
"_key",
"(",
"image",
")",
"image_name",
"=",
"image",
".",
"to_str",
"(",
"tag",
"=",
"False",
")",
"name_digest",
"="... | Update parent image digest for specific platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:param str digest: digest of the specified image (sha256:...) | [
"Update",
"parent",
"image",
"digest",
"for",
"specific",
"platform"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1537-L1550 | train | 28,531 |
projectatomic/atomic-reactor | atomic_reactor/util.py | DigestCollector.get_image_digests | def get_image_digests(self, image):
"""Get platform digests of specified image
:param ImageName image: image
:raises KeyError: when image is not found
:rtype: dict
:return: mapping platform:digest of the specified image
"""
image_name_tag = self._key(image)
... | python | def get_image_digests(self, image):
"""Get platform digests of specified image
:param ImageName image: image
:raises KeyError: when image is not found
:rtype: dict
:return: mapping platform:digest of the specified image
"""
image_name_tag = self._key(image)
... | [
"def",
"get_image_digests",
"(",
"self",
",",
"image",
")",
":",
"image_name_tag",
"=",
"self",
".",
"_key",
"(",
"image",
")",
"image_digests",
"=",
"self",
".",
"_images_digests",
".",
"get",
"(",
"image_name_tag",
")",
"if",
"image_digests",
"is",
"None",... | Get platform digests of specified image
:param ImageName image: image
:raises KeyError: when image is not found
:rtype: dict
:return: mapping platform:digest of the specified image | [
"Get",
"platform",
"digests",
"of",
"specified",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1552-L1564 | train | 28,532 |
projectatomic/atomic-reactor | atomic_reactor/util.py | DigestCollector.get_image_platform_digest | def get_image_platform_digest(self, image, platform):
"""Get digest of specified image and platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:raises KeyError: when digest is not found
:rtype: str
:return: digest ... | python | def get_image_platform_digest(self, image, platform):
"""Get digest of specified image and platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:raises KeyError: when digest is not found
:rtype: str
:return: digest ... | [
"def",
"get_image_platform_digest",
"(",
"self",
",",
"image",
",",
"platform",
")",
":",
"image_digests",
"=",
"self",
".",
"get_image_digests",
"(",
"image",
")",
"digest",
"=",
"image_digests",
".",
"get",
"(",
"platform",
")",
"if",
"digest",
"is",
"None... | Get digest of specified image and platform
:param ImageName image: image
:param str platform: name of the platform/arch (x86_64, ppc64le, ...)
:raises KeyError: when digest is not found
:rtype: str
:return: digest of the specified image (fedora@sha256:...) | [
"Get",
"digest",
"of",
"specified",
"image",
"and",
"platform"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/util.py#L1566-L1582 | train | 28,533 |
projectatomic/atomic-reactor | atomic_reactor/rpm_util.py | rpm_qf_args | def rpm_qf_args(tags=None, separator=';'):
"""
Return the arguments to pass to rpm to list RPMs in the format expected
by parse_rpm_output.
"""
if tags is None:
tags = image_component_rpm_tags
fmt = separator.join(["%%{%s}" % tag for tag in tags])
return r"-qa --qf '{0}\n'".format(... | python | def rpm_qf_args(tags=None, separator=';'):
"""
Return the arguments to pass to rpm to list RPMs in the format expected
by parse_rpm_output.
"""
if tags is None:
tags = image_component_rpm_tags
fmt = separator.join(["%%{%s}" % tag for tag in tags])
return r"-qa --qf '{0}\n'".format(... | [
"def",
"rpm_qf_args",
"(",
"tags",
"=",
"None",
",",
"separator",
"=",
"';'",
")",
":",
"if",
"tags",
"is",
"None",
":",
"tags",
"=",
"image_component_rpm_tags",
"fmt",
"=",
"separator",
".",
"join",
"(",
"[",
"\"%%{%s}\"",
"%",
"tag",
"for",
"tag",
"i... | Return the arguments to pass to rpm to list RPMs in the format expected
by parse_rpm_output. | [
"Return",
"the",
"arguments",
"to",
"pass",
"to",
"rpm",
"to",
"list",
"RPMs",
"in",
"the",
"format",
"expected",
"by",
"parse_rpm_output",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/rpm_util.py#L23-L33 | train | 28,534 |
projectatomic/atomic-reactor | atomic_reactor/rpm_util.py | parse_rpm_output | def parse_rpm_output(output, tags=None, separator=';'):
"""
Parse output of the rpm query.
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package
"""
if tags is None:
tag... | python | def parse_rpm_output(output, tags=None, separator=';'):
"""
Parse output of the rpm query.
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package
"""
if tags is None:
tag... | [
"def",
"parse_rpm_output",
"(",
"output",
",",
"tags",
"=",
"None",
",",
"separator",
"=",
"';'",
")",
":",
"if",
"tags",
"is",
"None",
":",
"tags",
"=",
"image_component_rpm_tags",
"def",
"field",
"(",
"tag",
")",
":",
"\"\"\"\n Get a field value by na... | Parse output of the rpm query.
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package | [
"Parse",
"output",
"of",
"the",
"rpm",
"query",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/rpm_util.py#L36-L95 | train | 28,535 |
projectatomic/atomic-reactor | atomic_reactor/koji_util.py | koji_login | def koji_login(session,
proxyuser=None,
ssl_certs_dir=None,
krb_principal=None,
krb_keytab=None):
"""
Choose the correct login method based on the available credentials,
and call that method on the provided session object.
:param session: koji... | python | def koji_login(session,
proxyuser=None,
ssl_certs_dir=None,
krb_principal=None,
krb_keytab=None):
"""
Choose the correct login method based on the available credentials,
and call that method on the provided session object.
:param session: koji... | [
"def",
"koji_login",
"(",
"session",
",",
"proxyuser",
"=",
"None",
",",
"ssl_certs_dir",
"=",
"None",
",",
"krb_principal",
"=",
"None",
",",
"krb_keytab",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"proxyuser",
":",
"kwargs",
"[",
"'proxyuse... | Choose the correct login method based on the available credentials,
and call that method on the provided session object.
:param session: koji.ClientSession instance
:param proxyuser: str, proxy user
:param ssl_certs_dir: str, path to "cert" (required), and "serverca" (optional)
:param krb_principal... | [
"Choose",
"the",
"correct",
"login",
"method",
"based",
"on",
"the",
"available",
"credentials",
"and",
"call",
"that",
"method",
"on",
"the",
"provided",
"session",
"object",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/koji_util.py#L75-L126 | train | 28,536 |
projectatomic/atomic-reactor | atomic_reactor/koji_util.py | create_koji_session | def create_koji_session(hub_url, auth_info=None):
"""
Creates and returns a Koji session. If auth_info
is provided, the session will be authenticated.
:param hub_url: str, Koji hub URL
:param auth_info: dict, authentication parameters used for koji_login
:return: koji.ClientSession instance
... | python | def create_koji_session(hub_url, auth_info=None):
"""
Creates and returns a Koji session. If auth_info
is provided, the session will be authenticated.
:param hub_url: str, Koji hub URL
:param auth_info: dict, authentication parameters used for koji_login
:return: koji.ClientSession instance
... | [
"def",
"create_koji_session",
"(",
"hub_url",
",",
"auth_info",
"=",
"None",
")",
":",
"session",
"=",
"KojiSessionWrapper",
"(",
"koji",
".",
"ClientSession",
"(",
"hub_url",
",",
"opts",
"=",
"{",
"'krb_rdns'",
":",
"False",
"}",
")",
")",
"if",
"auth_in... | Creates and returns a Koji session. If auth_info
is provided, the session will be authenticated.
:param hub_url: str, Koji hub URL
:param auth_info: dict, authentication parameters used for koji_login
:return: koji.ClientSession instance | [
"Creates",
"and",
"returns",
"a",
"Koji",
"session",
".",
"If",
"auth_info",
"is",
"provided",
"the",
"session",
"will",
"be",
"authenticated",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/koji_util.py#L129-L143 | train | 28,537 |
projectatomic/atomic-reactor | atomic_reactor/koji_util.py | stream_task_output | def stream_task_output(session, task_id, file_name,
blocksize=DEFAULT_DOWNLOAD_BLOCK_SIZE):
"""
Generator to download file from task without loading the whole
file into memory.
"""
logger.debug('Streaming {} from task {}'.format(file_name, task_id))
offset = 0
contents... | python | def stream_task_output(session, task_id, file_name,
blocksize=DEFAULT_DOWNLOAD_BLOCK_SIZE):
"""
Generator to download file from task without loading the whole
file into memory.
"""
logger.debug('Streaming {} from task {}'.format(file_name, task_id))
offset = 0
contents... | [
"def",
"stream_task_output",
"(",
"session",
",",
"task_id",
",",
"file_name",
",",
"blocksize",
"=",
"DEFAULT_DOWNLOAD_BLOCK_SIZE",
")",
":",
"logger",
".",
"debug",
"(",
"'Streaming {} from task {}'",
".",
"format",
"(",
"file_name",
",",
"task_id",
")",
")",
... | Generator to download file from task without loading the whole
file into memory. | [
"Generator",
"to",
"download",
"file",
"from",
"task",
"without",
"loading",
"the",
"whole",
"file",
"into",
"memory",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/koji_util.py#L167-L183 | train | 28,538 |
projectatomic/atomic-reactor | atomic_reactor/yum_util.py | YumRepo.filename | def filename(self):
'''Returns the filename to be used for saving the repo file.
The filename is derived from the repo url by injecting a suffix
after the name and before the file extension. This suffix is a
partial md5 checksum of the full repourl. This avoids multiple
repos fr... | python | def filename(self):
'''Returns the filename to be used for saving the repo file.
The filename is derived from the repo url by injecting a suffix
after the name and before the file extension. This suffix is a
partial md5 checksum of the full repourl. This avoids multiple
repos fr... | [
"def",
"filename",
"(",
"self",
")",
":",
"urlpath",
"=",
"unquote",
"(",
"urlsplit",
"(",
"self",
".",
"repourl",
",",
"allow_fragments",
"=",
"False",
")",
".",
"path",
")",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"urlpath",
")",
... | Returns the filename to be used for saving the repo file.
The filename is derived from the repo url by injecting a suffix
after the name and before the file extension. This suffix is a
partial md5 checksum of the full repourl. This avoids multiple
repos from being written to the same fi... | [
"Returns",
"the",
"filename",
"to",
"be",
"used",
"for",
"saving",
"the",
"repo",
"file",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/yum_util.py#L48-L65 | train | 28,539 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_compare_components.py | filter_components_by_name | def filter_components_by_name(name, components_list, type_=T_RPM):
"""Generator filters components from components_list by name"""
for components in components_list:
for component in components:
if component['type'] == type_ and component['name'] == name:
yield component | python | def filter_components_by_name(name, components_list, type_=T_RPM):
"""Generator filters components from components_list by name"""
for components in components_list:
for component in components:
if component['type'] == type_ and component['name'] == name:
yield component | [
"def",
"filter_components_by_name",
"(",
"name",
",",
"components_list",
",",
"type_",
"=",
"T_RPM",
")",
":",
"for",
"components",
"in",
"components_list",
":",
"for",
"component",
"in",
"components",
":",
"if",
"component",
"[",
"'type'",
"]",
"==",
"type_",... | Generator filters components from components_list by name | [
"Generator",
"filters",
"components",
"from",
"components_list",
"by",
"name"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_compare_components.py#L22-L27 | train | 28,540 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_compare_components.py | CompareComponentsPlugin.get_component_list_from_workers | def get_component_list_from_workers(self, worker_metadatas):
"""
Find the component lists from each worker build.
The components that are interesting are under the 'output' key. The
buildhost's components are ignored.
Inside the 'output' key are various 'instances'. The only ... | python | def get_component_list_from_workers(self, worker_metadatas):
"""
Find the component lists from each worker build.
The components that are interesting are under the 'output' key. The
buildhost's components are ignored.
Inside the 'output' key are various 'instances'. The only ... | [
"def",
"get_component_list_from_workers",
"(",
"self",
",",
"worker_metadatas",
")",
":",
"comp_list",
"=",
"[",
"]",
"for",
"platform",
"in",
"sorted",
"(",
"worker_metadatas",
".",
"keys",
"(",
")",
")",
":",
"for",
"instance",
"in",
"worker_metadatas",
"[",... | Find the component lists from each worker build.
The components that are interesting are under the 'output' key. The
buildhost's components are ignored.
Inside the 'output' key are various 'instances'. The only 'instance'
with a 'component list' is the 'docker-image' instance. The '... | [
"Find",
"the",
"component",
"lists",
"from",
"each",
"worker",
"build",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_compare_components.py#L51-L77 | train | 28,541 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_rpms | def get_rpms(self):
"""
Build a list of installed RPMs in the format required for the
metadata.
"""
tags = [
'NAME',
'VERSION',
'RELEASE',
'ARCH',
'EPOCH',
'SIGMD5',
'SIGPGP:pgpsig',
... | python | def get_rpms(self):
"""
Build a list of installed RPMs in the format required for the
metadata.
"""
tags = [
'NAME',
'VERSION',
'RELEASE',
'ARCH',
'EPOCH',
'SIGMD5',
'SIGPGP:pgpsig',
... | [
"def",
"get_rpms",
"(",
"self",
")",
":",
"tags",
"=",
"[",
"'NAME'",
",",
"'VERSION'",
",",
"'RELEASE'",
",",
"'ARCH'",
",",
"'EPOCH'",
",",
"'SIGMD5'",
",",
"'SIGPGP:pgpsig'",
",",
"'SIGGPG:pgpsig'",
",",
"]",
"cmd",
"=",
"\"/bin/rpm \"",
"+",
"rpm_qf_ar... | Build a list of installed RPMs in the format required for the
metadata. | [
"Build",
"a",
"list",
"of",
"installed",
"RPMs",
"in",
"the",
"format",
"required",
"for",
"the",
"metadata",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L142-L180 | train | 28,542 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_output_metadata | def get_output_metadata(self, path, filename):
"""
Describe a file by its metadata.
:return: dict
"""
checksums = get_checksums(path, ['md5'])
metadata = {'filename': filename,
'filesize': os.path.getsize(path),
'checksum': checks... | python | def get_output_metadata(self, path, filename):
"""
Describe a file by its metadata.
:return: dict
"""
checksums = get_checksums(path, ['md5'])
metadata = {'filename': filename,
'filesize': os.path.getsize(path),
'checksum': checks... | [
"def",
"get_output_metadata",
"(",
"self",
",",
"path",
",",
"filename",
")",
":",
"checksums",
"=",
"get_checksums",
"(",
"path",
",",
"[",
"'md5'",
"]",
")",
"metadata",
"=",
"{",
"'filename'",
":",
"filename",
",",
"'filesize'",
":",
"os",
".",
"path"... | Describe a file by its metadata.
:return: dict | [
"Describe",
"a",
"file",
"by",
"its",
"metadata",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L182-L198 | train | 28,543 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_builder_image_id | def get_builder_image_id(self):
"""
Find out the docker ID of the buildroot image we are in.
"""
try:
buildroot_tag = os.environ["OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE"]
except KeyError:
return ''
try:
pod = self.osbs.get_pod_for_build(se... | python | def get_builder_image_id(self):
"""
Find out the docker ID of the buildroot image we are in.
"""
try:
buildroot_tag = os.environ["OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE"]
except KeyError:
return ''
try:
pod = self.osbs.get_pod_for_build(se... | [
"def",
"get_builder_image_id",
"(",
"self",
")",
":",
"try",
":",
"buildroot_tag",
"=",
"os",
".",
"environ",
"[",
"\"OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE\"",
"]",
"except",
"KeyError",
":",
"return",
"''",
"try",
":",
"pod",
"=",
"self",
".",
"osbs",
".",
"get... | Find out the docker ID of the buildroot image we are in. | [
"Find",
"out",
"the",
"docker",
"ID",
"of",
"the",
"buildroot",
"image",
"we",
"are",
"in",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L200-L222 | train | 28,544 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_image_components | def get_image_components(self):
"""
Re-package the output of the rpmqa plugin into the format required
for the metadata.
"""
output = self.workflow.image_components
if output is None:
self.log.error("%s plugin did not run!",
PostBui... | python | def get_image_components(self):
"""
Re-package the output of the rpmqa plugin into the format required
for the metadata.
"""
output = self.workflow.image_components
if output is None:
self.log.error("%s plugin did not run!",
PostBui... | [
"def",
"get_image_components",
"(",
"self",
")",
":",
"output",
"=",
"self",
".",
"workflow",
".",
"image_components",
"if",
"output",
"is",
"None",
":",
"self",
".",
"log",
".",
"error",
"(",
"\"%s plugin did not run!\"",
",",
"PostBuildRPMqaPlugin",
".",
"ke... | Re-package the output of the rpmqa plugin into the format required
for the metadata. | [
"Re",
"-",
"package",
"the",
"output",
"of",
"the",
"rpmqa",
"plugin",
"into",
"the",
"format",
"required",
"for",
"the",
"metadata",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L309-L321 | train | 28,545 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_digests | def get_digests(self):
"""
Returns a map of images to their digests
"""
try:
pulp = get_manifests_in_pulp_repository(self.workflow)
except KeyError:
pulp = None
digests = {} # repository -> digests
for registry in self.workflow.push_conf... | python | def get_digests(self):
"""
Returns a map of images to their digests
"""
try:
pulp = get_manifests_in_pulp_repository(self.workflow)
except KeyError:
pulp = None
digests = {} # repository -> digests
for registry in self.workflow.push_conf... | [
"def",
"get_digests",
"(",
"self",
")",
":",
"try",
":",
"pulp",
"=",
"get_manifests_in_pulp_repository",
"(",
"self",
".",
"workflow",
")",
"except",
"KeyError",
":",
"pulp",
"=",
"None",
"digests",
"=",
"{",
"}",
"# repository -> digests",
"for",
"registry",... | Returns a map of images to their digests | [
"Returns",
"a",
"map",
"of",
"images",
"to",
"their",
"digests"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L351-L380 | train | 28,546 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.get_repositories | def get_repositories(self, digests):
"""
Build the repositories metadata
:param digests: dict, image -> digests
"""
if self.workflow.push_conf.pulp_registries:
# If pulp was used, only report pulp images
registries = self.workflow.push_conf.pulp_registrie... | python | def get_repositories(self, digests):
"""
Build the repositories metadata
:param digests: dict, image -> digests
"""
if self.workflow.push_conf.pulp_registries:
# If pulp was used, only report pulp images
registries = self.workflow.push_conf.pulp_registrie... | [
"def",
"get_repositories",
"(",
"self",
",",
"digests",
")",
":",
"if",
"self",
".",
"workflow",
".",
"push_conf",
".",
"pulp_registries",
":",
"# If pulp was used, only report pulp images",
"registries",
"=",
"self",
".",
"workflow",
".",
"push_conf",
".",
"pulp_... | Build the repositories metadata
:param digests: dict, image -> digests | [
"Build",
"the",
"repositories",
"metadata"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L382-L408 | train | 28,547 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_koji_promote.py | KojiPromotePlugin.upload_file | def upload_file(self, session, output, serverdir):
"""
Upload a file to koji
:return: str, pathname on server
"""
name = output.metadata['filename']
self.log.debug("uploading %r to %r as %r",
output.file.name, serverdir, name)
kwargs = {}
... | python | def upload_file(self, session, output, serverdir):
"""
Upload a file to koji
:return: str, pathname on server
"""
name = output.metadata['filename']
self.log.debug("uploading %r to %r as %r",
output.file.name, serverdir, name)
kwargs = {}
... | [
"def",
"upload_file",
"(",
"self",
",",
"session",
",",
"output",
",",
"serverdir",
")",
":",
"name",
"=",
"output",
".",
"metadata",
"[",
"'filename'",
"]",
"self",
".",
"log",
".",
"debug",
"(",
"\"uploading %r to %r as %r\"",
",",
"output",
".",
"file",... | Upload a file to koji
:return: str, pathname on server | [
"Upload",
"a",
"file",
"to",
"koji"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L642-L662 | train | 28,548 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_verify_media_types.py | VerifyMediaTypesPlugin.get_manifest_list_only_expectation | def get_manifest_list_only_expectation(self):
"""
Get expectation for manifest list only
:return: bool, expect manifest list only?
"""
if not self.workflow.postbuild_results.get(PLUGIN_GROUP_MANIFESTS_KEY):
self.log.debug('Cannot check if only manifest list digest sh... | python | def get_manifest_list_only_expectation(self):
"""
Get expectation for manifest list only
:return: bool, expect manifest list only?
"""
if not self.workflow.postbuild_results.get(PLUGIN_GROUP_MANIFESTS_KEY):
self.log.debug('Cannot check if only manifest list digest sh... | [
"def",
"get_manifest_list_only_expectation",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"workflow",
".",
"postbuild_results",
".",
"get",
"(",
"PLUGIN_GROUP_MANIFESTS_KEY",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Cannot check if only manifest list d... | Get expectation for manifest list only
:return: bool, expect manifest list only? | [
"Get",
"expectation",
"for",
"manifest",
"list",
"only"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_verify_media_types.py#L121-L151 | train | 28,549 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin.run | def run(self):
"""
Pull parent images and retag them uniquely for this build.
"""
build_json = get_build_json()
current_platform = platform.processor() or 'x86_64'
self.manifest_list_cache = {}
organization = get_registries_organization(self.workflow)
for... | python | def run(self):
"""
Pull parent images and retag them uniquely for this build.
"""
build_json = get_build_json()
current_platform = platform.processor() or 'x86_64'
self.manifest_list_cache = {}
organization = get_registries_organization(self.workflow)
for... | [
"def",
"run",
"(",
"self",
")",
":",
"build_json",
"=",
"get_build_json",
"(",
")",
"current_platform",
"=",
"platform",
".",
"processor",
"(",
")",
"or",
"'x86_64'",
"self",
".",
"manifest_list_cache",
"=",
"{",
"}",
"organization",
"=",
"get_registries_organ... | Pull parent images and retag them uniquely for this build. | [
"Pull",
"parent",
"images",
"and",
"retag",
"them",
"uniquely",
"for",
"this",
"build",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L70-L132 | train | 28,550 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._get_image_for_different_arch | def _get_image_for_different_arch(self, image, platform):
"""Get image from random arch
This is a workaround for aarch64 platform, because orchestrator cannot
get this arch from manifests lists so we have to provide digest of a
random platform to get image metadata for orchestrator.
... | python | def _get_image_for_different_arch(self, image, platform):
"""Get image from random arch
This is a workaround for aarch64 platform, because orchestrator cannot
get this arch from manifests lists so we have to provide digest of a
random platform to get image metadata for orchestrator.
... | [
"def",
"_get_image_for_different_arch",
"(",
"self",
",",
"image",
",",
"platform",
")",
":",
"parents_digests",
"=",
"self",
".",
"workflow",
".",
"builder",
".",
"parent_images_digests",
"try",
":",
"digests",
"=",
"parents_digests",
".",
"get_image_digests",
"(... | Get image from random arch
This is a workaround for aarch64 platform, because orchestrator cannot
get this arch from manifests lists so we have to provide digest of a
random platform to get image metadata for orchestrator.
For standard platforms like x86_64, ppc64le, ... this method re... | [
"Get",
"image",
"from",
"random",
"arch"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L190-L215 | train | 28,551 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._resolve_base_image | def _resolve_base_image(self, build_json):
"""If this is an auto-rebuild, adjust the base image to use the triggering build"""
spec = build_json.get("spec")
try:
image_id = spec['triggeredBy'][0]['imageChangeBuild']['imageID']
except (TypeError, KeyError, IndexError):
... | python | def _resolve_base_image(self, build_json):
"""If this is an auto-rebuild, adjust the base image to use the triggering build"""
spec = build_json.get("spec")
try:
image_id = spec['triggeredBy'][0]['imageChangeBuild']['imageID']
except (TypeError, KeyError, IndexError):
... | [
"def",
"_resolve_base_image",
"(",
"self",
",",
"build_json",
")",
":",
"spec",
"=",
"build_json",
".",
"get",
"(",
"\"spec\"",
")",
"try",
":",
"image_id",
"=",
"spec",
"[",
"'triggeredBy'",
"]",
"[",
"0",
"]",
"[",
"'imageChangeBuild'",
"]",
"[",
"'ima... | If this is an auto-rebuild, adjust the base image to use the triggering build | [
"If",
"this",
"is",
"an",
"auto",
"-",
"rebuild",
"adjust",
"the",
"base",
"image",
"to",
"use",
"the",
"triggering",
"build"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L217-L231 | train | 28,552 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._ensure_image_registry | def _ensure_image_registry(self, image):
"""If plugin configured with a parent registry, ensure the image uses it"""
image_with_registry = image.copy()
if self.parent_registry:
# if registry specified in Dockerfile image, ensure it's the one allowed by config
if image.reg... | python | def _ensure_image_registry(self, image):
"""If plugin configured with a parent registry, ensure the image uses it"""
image_with_registry = image.copy()
if self.parent_registry:
# if registry specified in Dockerfile image, ensure it's the one allowed by config
if image.reg... | [
"def",
"_ensure_image_registry",
"(",
"self",
",",
"image",
")",
":",
"image_with_registry",
"=",
"image",
".",
"copy",
"(",
")",
"if",
"self",
".",
"parent_registry",
":",
"# if registry specified in Dockerfile image, ensure it's the one allowed by config",
"if",
"image"... | If plugin configured with a parent registry, ensure the image uses it | [
"If",
"plugin",
"configured",
"with",
"a",
"parent",
"registry",
"ensure",
"the",
"image",
"uses",
"it"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L233-L248 | train | 28,553 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._pull_and_tag_image | def _pull_and_tag_image(self, image, build_json, nonce):
"""Docker pull the image and tag it uniquely for use by this build"""
image = image.copy()
first_library_exc = None
for _ in range(20):
# retry until pull and tag is successful or definitively fails.
# shoul... | python | def _pull_and_tag_image(self, image, build_json, nonce):
"""Docker pull the image and tag it uniquely for use by this build"""
image = image.copy()
first_library_exc = None
for _ in range(20):
# retry until pull and tag is successful or definitively fails.
# shoul... | [
"def",
"_pull_and_tag_image",
"(",
"self",
",",
"image",
",",
"build_json",
",",
"nonce",
")",
":",
"image",
"=",
"image",
".",
"copy",
"(",
")",
"first_library_exc",
"=",
"None",
"for",
"_",
"in",
"range",
"(",
"20",
")",
":",
"# retry until pull and tag ... | Docker pull the image and tag it uniquely for use by this build | [
"Docker",
"pull",
"the",
"image",
"and",
"tag",
"it",
"uniquely",
"for",
"use",
"by",
"this",
"build"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L250-L303 | train | 28,554 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._get_manifest_list | def _get_manifest_list(self, image):
"""try to figure out manifest list"""
if image in self.manifest_list_cache:
return self.manifest_list_cache[image]
manifest_list = get_manifest_list(image, image.registry,
insecure=self.parent_registry_in... | python | def _get_manifest_list(self, image):
"""try to figure out manifest list"""
if image in self.manifest_list_cache:
return self.manifest_list_cache[image]
manifest_list = get_manifest_list(image, image.registry,
insecure=self.parent_registry_in... | [
"def",
"_get_manifest_list",
"(",
"self",
",",
"image",
")",
":",
"if",
"image",
"in",
"self",
".",
"manifest_list_cache",
":",
"return",
"self",
".",
"manifest_list_cache",
"[",
"image",
"]",
"manifest_list",
"=",
"get_manifest_list",
"(",
"image",
",",
"imag... | try to figure out manifest list | [
"try",
"to",
"figure",
"out",
"manifest",
"list"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L305-L336 | train | 28,555 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_pull_base_image.py | PullBaseImagePlugin._validate_platforms_in_image | def _validate_platforms_in_image(self, image):
"""Ensure that the image provides all platforms expected for the build."""
expected_platforms = get_platforms(self.workflow)
if not expected_platforms:
self.log.info('Skipping validation of available platforms '
... | python | def _validate_platforms_in_image(self, image):
"""Ensure that the image provides all platforms expected for the build."""
expected_platforms = get_platforms(self.workflow)
if not expected_platforms:
self.log.info('Skipping validation of available platforms '
... | [
"def",
"_validate_platforms_in_image",
"(",
"self",
",",
"image",
")",
":",
"expected_platforms",
"=",
"get_platforms",
"(",
"self",
".",
"workflow",
")",
"if",
"not",
"expected_platforms",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Skipping validation of availa... | Ensure that the image provides all platforms expected for the build. | [
"Ensure",
"that",
"the",
"image",
"provides",
"all",
"platforms",
"expected",
"for",
"the",
"build",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_pull_base_image.py#L338-L379 | train | 28,556 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_pulp_sync.py | PulpSyncPlugin.get_dockercfg_credentials | def get_dockercfg_credentials(self, docker_registry):
"""
Read the .dockercfg file and return an empty dict, or else a dict
with keys 'basic_auth_username' and 'basic_auth_password'.
"""
if not self.registry_secret_path:
return {}
dockercfg = Dockercfg(self.r... | python | def get_dockercfg_credentials(self, docker_registry):
"""
Read the .dockercfg file and return an empty dict, or else a dict
with keys 'basic_auth_username' and 'basic_auth_password'.
"""
if not self.registry_secret_path:
return {}
dockercfg = Dockercfg(self.r... | [
"def",
"get_dockercfg_credentials",
"(",
"self",
",",
"docker_registry",
")",
":",
"if",
"not",
"self",
".",
"registry_secret_path",
":",
"return",
"{",
"}",
"dockercfg",
"=",
"Dockercfg",
"(",
"self",
".",
"registry_secret_path",
")",
"registry_creds",
"=",
"do... | Read the .dockercfg file and return an empty dict, or else a dict
with keys 'basic_auth_username' and 'basic_auth_password'. | [
"Read",
"the",
".",
"dockercfg",
"file",
"and",
"return",
"an",
"empty",
"dict",
"or",
"else",
"a",
"dict",
"with",
"keys",
"basic_auth_username",
"and",
"basic_auth_password",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_pulp_sync.py#L170-L186 | train | 28,557 |
projectatomic/atomic-reactor | atomic_reactor/odcs_util.py | ODCSClient.start_compose | def start_compose(self, source_type, source, packages=None, sigkeys=None, arches=None,
flags=None, multilib_arches=None, multilib_method=None,
modular_koji_tags=None):
"""Start a new ODCS compose
:param source_type: str, the type of compose to request (tag, m... | python | def start_compose(self, source_type, source, packages=None, sigkeys=None, arches=None,
flags=None, multilib_arches=None, multilib_method=None,
modular_koji_tags=None):
"""Start a new ODCS compose
:param source_type: str, the type of compose to request (tag, m... | [
"def",
"start_compose",
"(",
"self",
",",
"source_type",
",",
"source",
",",
"packages",
"=",
"None",
",",
"sigkeys",
"=",
"None",
",",
"arches",
"=",
"None",
",",
"flags",
"=",
"None",
",",
"multilib_arches",
"=",
"None",
",",
"multilib_method",
"=",
"N... | Start a new ODCS compose
:param source_type: str, the type of compose to request (tag, module, pulp)
:param source: str, if source_type "tag" is used, the name of the Koji tag
to use when retrieving packages to include in compose;
if source_type "module", w... | [
"Start",
"a",
"new",
"ODCS",
"compose"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/odcs_util.py#L49-L109 | train | 28,558 |
projectatomic/atomic-reactor | atomic_reactor/odcs_util.py | ODCSClient.renew_compose | def renew_compose(self, compose_id):
"""Renew, or extend, existing compose
If the compose has already been removed, ODCS creates a new compose.
Otherwise, it extends the time_to_expire of existing compose. In most
cases, caller should assume the compose ID will change.
:param c... | python | def renew_compose(self, compose_id):
"""Renew, or extend, existing compose
If the compose has already been removed, ODCS creates a new compose.
Otherwise, it extends the time_to_expire of existing compose. In most
cases, caller should assume the compose ID will change.
:param c... | [
"def",
"renew_compose",
"(",
"self",
",",
"compose_id",
")",
":",
"logger",
".",
"info",
"(",
"\"Renewing compose %d\"",
",",
"compose_id",
")",
"response",
"=",
"self",
".",
"session",
".",
"patch",
"(",
"'{}composes/{}'",
".",
"format",
"(",
"self",
".",
... | Renew, or extend, existing compose
If the compose has already been removed, ODCS creates a new compose.
Otherwise, it extends the time_to_expire of existing compose. In most
cases, caller should assume the compose ID will change.
:param compose_id: int, compose ID to renew
:re... | [
"Renew",
"or",
"extend",
"existing",
"compose"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/odcs_util.py#L111-L128 | train | 28,559 |
projectatomic/atomic-reactor | atomic_reactor/odcs_util.py | ODCSClient.wait_for_compose | def wait_for_compose(self, compose_id,
burst_retry=1,
burst_length=30,
slow_retry=10,
timeout=1800):
"""Wait for compose request to finalize
:param compose_id: int, compose ID to wait for
:param ... | python | def wait_for_compose(self, compose_id,
burst_retry=1,
burst_length=30,
slow_retry=10,
timeout=1800):
"""Wait for compose request to finalize
:param compose_id: int, compose ID to wait for
:param ... | [
"def",
"wait_for_compose",
"(",
"self",
",",
"compose_id",
",",
"burst_retry",
"=",
"1",
",",
"burst_length",
"=",
"30",
",",
"slow_retry",
"=",
"10",
",",
"timeout",
"=",
"1800",
")",
":",
"logger",
".",
"debug",
"(",
"\"Getting compose information for inform... | Wait for compose request to finalize
:param compose_id: int, compose ID to wait for
:param burst_retry: int, seconds to wait between retries prior to exceeding
the burst length
:param burst_length: int, seconds to switch to slower retry period
:param slow_ret... | [
"Wait",
"for",
"compose",
"request",
"to",
"finalize"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/odcs_util.py#L130-L182 | train | 28,560 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_hide_files.py | HideFilesPlugin._find_stages | def _find_stages(self):
"""Find limits of each Dockerfile stage"""
stages = []
end = last_user_found = None
for part in reversed(self.dfp.structure):
if end is None:
end = part
if part['instruction'] == 'USER' and not last_user_found:
... | python | def _find_stages(self):
"""Find limits of each Dockerfile stage"""
stages = []
end = last_user_found = None
for part in reversed(self.dfp.structure):
if end is None:
end = part
if part['instruction'] == 'USER' and not last_user_found:
... | [
"def",
"_find_stages",
"(",
"self",
")",
":",
"stages",
"=",
"[",
"]",
"end",
"=",
"last_user_found",
"=",
"None",
"for",
"part",
"in",
"reversed",
"(",
"self",
".",
"dfp",
".",
"structure",
")",
":",
"if",
"end",
"is",
"None",
":",
"end",
"=",
"pa... | Find limits of each Dockerfile stage | [
"Find",
"limits",
"of",
"each",
"Dockerfile",
"stage"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_hide_files.py#L55-L73 | train | 28,561 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_store_metadata_in_osv3.py | StoreMetadataInOSv3Plugin.get_digests | def get_digests(self):
"""
Returns a map of repositories to digests
"""
digests = {} # repository -> digest
for registry in self.workflow.push_conf.docker_registries:
for image in self.workflow.tag_conf.images:
image_str = image.to_str()
... | python | def get_digests(self):
"""
Returns a map of repositories to digests
"""
digests = {} # repository -> digest
for registry in self.workflow.push_conf.docker_registries:
for image in self.workflow.tag_conf.images:
image_str = image.to_str()
... | [
"def",
"get_digests",
"(",
"self",
")",
":",
"digests",
"=",
"{",
"}",
"# repository -> digest",
"for",
"registry",
"in",
"self",
".",
"workflow",
".",
"push_conf",
".",
"docker_registries",
":",
"for",
"image",
"in",
"self",
".",
"workflow",
".",
"tag_conf"... | Returns a map of repositories to digests | [
"Returns",
"a",
"map",
"of",
"repositories",
"to",
"digests"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_store_metadata_in_osv3.py#L76-L89 | train | 28,562 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_store_metadata_in_osv3.py | StoreMetadataInOSv3Plugin._get_registries | def _get_registries(self):
"""
Return a list of registries that this build updated
For orchestrator it should attempt to filter out non-pulp registries, on worker - return
all registries
"""
if self.workflow.buildstep_result.get(PLUGIN_BUILD_ORCHESTRATE_KEY):
... | python | def _get_registries(self):
"""
Return a list of registries that this build updated
For orchestrator it should attempt to filter out non-pulp registries, on worker - return
all registries
"""
if self.workflow.buildstep_result.get(PLUGIN_BUILD_ORCHESTRATE_KEY):
... | [
"def",
"_get_registries",
"(",
"self",
")",
":",
"if",
"self",
".",
"workflow",
".",
"buildstep_result",
".",
"get",
"(",
"PLUGIN_BUILD_ORCHESTRATE_KEY",
")",
":",
"registries",
"=",
"self",
".",
"workflow",
".",
"push_conf",
".",
"pulp_registries",
"if",
"not... | Return a list of registries that this build updated
For orchestrator it should attempt to filter out non-pulp registries, on worker - return
all registries | [
"Return",
"a",
"list",
"of",
"registries",
"that",
"this",
"build",
"updated"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_store_metadata_in_osv3.py#L91-L104 | train | 28,563 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_koji_upload.py | KojiUploadPlugin.get_repositories_and_digests | def get_repositories_and_digests(self):
"""
Returns a map of images to their repositories and a map of media types to each digest
it creates a map of images to digests, which is need to create the image->repository
map and uses the same loop structure as media_types->digest, but the ima... | python | def get_repositories_and_digests(self):
"""
Returns a map of images to their repositories and a map of media types to each digest
it creates a map of images to digests, which is need to create the image->repository
map and uses the same loop structure as media_types->digest, but the ima... | [
"def",
"get_repositories_and_digests",
"(",
"self",
")",
":",
"digests",
"=",
"{",
"}",
"# image -> digests",
"typed_digests",
"=",
"{",
"}",
"# media_type -> digests",
"for",
"registry",
"in",
"self",
".",
"workflow",
".",
"push_conf",
".",
"docker_registries",
"... | Returns a map of images to their repositories and a map of media types to each digest
it creates a map of images to digests, which is need to create the image->repository
map and uses the same loop structure as media_types->digest, but the image->digest
map isn't needed after we have the image-... | [
"Returns",
"a",
"map",
"of",
"images",
"to",
"their",
"repositories",
"and",
"a",
"map",
"of",
"media",
"types",
"to",
"each",
"digest"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_koji_upload.py#L329-L378 | train | 28,564 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_koji_upload.py | KojiUploadPlugin.update_buildroot_koji | def update_buildroot_koji(self, buildroot, output):
"""
put the final koji information in the buildroot under extra.osbs
"""
docker = output[1]['extra']['docker']
name = ''
for tag in docker['tags']:
for repo in docker['repositories']:
if tag ... | python | def update_buildroot_koji(self, buildroot, output):
"""
put the final koji information in the buildroot under extra.osbs
"""
docker = output[1]['extra']['docker']
name = ''
for tag in docker['tags']:
for repo in docker['repositories']:
if tag ... | [
"def",
"update_buildroot_koji",
"(",
"self",
",",
"buildroot",
",",
"output",
")",
":",
"docker",
"=",
"output",
"[",
"1",
"]",
"[",
"'extra'",
"]",
"[",
"'docker'",
"]",
"name",
"=",
"''",
"for",
"tag",
"in",
"docker",
"[",
"'tags'",
"]",
":",
"for"... | put the final koji information in the buildroot under extra.osbs | [
"put",
"the",
"final",
"koji",
"information",
"in",
"the",
"buildroot",
"under",
"extra",
".",
"osbs"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_koji_upload.py#L469-L486 | train | 28,565 |
projectatomic/atomic-reactor | atomic_reactor/plugins/post_koji_upload.py | KojiUploadPlugin.get_metadata | def get_metadata(self):
"""
Build the metadata needed for importing the build
:return: tuple, the metadata and the list of Output instances
"""
try:
metadata = get_build_json()["metadata"]
self.build_id = metadata["name"]
except KeyError:
... | python | def get_metadata(self):
"""
Build the metadata needed for importing the build
:return: tuple, the metadata and the list of Output instances
"""
try:
metadata = get_build_json()["metadata"]
self.build_id = metadata["name"]
except KeyError:
... | [
"def",
"get_metadata",
"(",
"self",
")",
":",
"try",
":",
"metadata",
"=",
"get_build_json",
"(",
")",
"[",
"\"metadata\"",
"]",
"self",
".",
"build_id",
"=",
"metadata",
"[",
"\"name\"",
"]",
"except",
"KeyError",
":",
"self",
".",
"log",
".",
"error",
... | Build the metadata needed for importing the build
:return: tuple, the metadata and the list of Output instances | [
"Build",
"the",
"metadata",
"needed",
"for",
"importing",
"the",
"build"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_koji_upload.py#L488-L527 | train | 28,566 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_delete_from_registry.py | DeleteFromRegistryPlugin.get_worker_digests | def get_worker_digests(self):
"""
If we are being called from an orchestrator build, collect the worker
node data and recreate the data locally.
"""
try:
builds = self.workflow.build_result.annotations['worker-builds']
except(TypeError, KeyError):
... | python | def get_worker_digests(self):
"""
If we are being called from an orchestrator build, collect the worker
node data and recreate the data locally.
"""
try:
builds = self.workflow.build_result.annotations['worker-builds']
except(TypeError, KeyError):
... | [
"def",
"get_worker_digests",
"(",
"self",
")",
":",
"try",
":",
"builds",
"=",
"self",
".",
"workflow",
".",
"build_result",
".",
"annotations",
"[",
"'worker-builds'",
"]",
"except",
"(",
"TypeError",
",",
"KeyError",
")",
":",
"# This annotation is only set fo... | If we are being called from an orchestrator build, collect the worker
node data and recreate the data locally. | [
"If",
"we",
"are",
"being",
"called",
"from",
"an",
"orchestrator",
"build",
"collect",
"the",
"worker",
"node",
"data",
"and",
"recreate",
"the",
"data",
"locally",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_delete_from_registry.py#L111-L134 | train | 28,567 |
projectatomic/atomic-reactor | atomic_reactor/build.py | BuildResult.make_remote_image_result | def make_remote_image_result(annotations=None, labels=None):
"""Instantiate BuildResult for image not built locally."""
return BuildResult(image_id=BuildResult.REMOTE_IMAGE,
annotations=annotations, labels=labels) | python | def make_remote_image_result(annotations=None, labels=None):
"""Instantiate BuildResult for image not built locally."""
return BuildResult(image_id=BuildResult.REMOTE_IMAGE,
annotations=annotations, labels=labels) | [
"def",
"make_remote_image_result",
"(",
"annotations",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"return",
"BuildResult",
"(",
"image_id",
"=",
"BuildResult",
".",
"REMOTE_IMAGE",
",",
"annotations",
"=",
"annotations",
",",
"labels",
"=",
"labels",
"... | Instantiate BuildResult for image not built locally. | [
"Instantiate",
"BuildResult",
"for",
"image",
"not",
"built",
"locally",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L93-L96 | train | 28,568 |
projectatomic/atomic-reactor | atomic_reactor/build.py | InsideBuilder.base_image_inspect | def base_image_inspect(self):
"""
inspect base image
:return: dict
"""
if self._base_image_inspect is None:
if self.base_from_scratch:
self._base_image_inspect = {}
elif self.parents_pulled or self.custom_base_image:
try:
... | python | def base_image_inspect(self):
"""
inspect base image
:return: dict
"""
if self._base_image_inspect is None:
if self.base_from_scratch:
self._base_image_inspect = {}
elif self.parents_pulled or self.custom_base_image:
try:
... | [
"def",
"base_image_inspect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_base_image_inspect",
"is",
"None",
":",
"if",
"self",
".",
"base_from_scratch",
":",
"self",
".",
"_base_image_inspect",
"=",
"{",
"}",
"elif",
"self",
".",
"parents_pulled",
"or",
"sel... | inspect base image
:return: dict | [
"inspect",
"base",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L269-L298 | train | 28,569 |
projectatomic/atomic-reactor | atomic_reactor/build.py | InsideBuilder.parent_image_inspect | def parent_image_inspect(self, image):
"""
inspect parent image
:return: dict
"""
image_name = ImageName.parse(image)
if image_name not in self._parent_images_inspect:
if self.parents_pulled:
self._parent_images_inspect[image_name] = self.task... | python | def parent_image_inspect(self, image):
"""
inspect parent image
:return: dict
"""
image_name = ImageName.parse(image)
if image_name not in self._parent_images_inspect:
if self.parents_pulled:
self._parent_images_inspect[image_name] = self.task... | [
"def",
"parent_image_inspect",
"(",
"self",
",",
"image",
")",
":",
"image_name",
"=",
"ImageName",
".",
"parse",
"(",
"image",
")",
"if",
"image_name",
"not",
"in",
"self",
".",
"_parent_images_inspect",
":",
"if",
"self",
".",
"parents_pulled",
":",
"self"... | inspect parent image
:return: dict | [
"inspect",
"parent",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L300-L317 | train | 28,570 |
projectatomic/atomic-reactor | atomic_reactor/build.py | InsideBuilder.inspect_built_image | def inspect_built_image(self):
"""
inspect built image
:return: dict
"""
logger.info("inspecting built image '%s'", self.image_id)
self.ensure_is_built()
# dict with lots of data, see man docker-inspect
inspect_data = self.tasker.inspect_image(self.image_... | python | def inspect_built_image(self):
"""
inspect built image
:return: dict
"""
logger.info("inspecting built image '%s'", self.image_id)
self.ensure_is_built()
# dict with lots of data, see man docker-inspect
inspect_data = self.tasker.inspect_image(self.image_... | [
"def",
"inspect_built_image",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"inspecting built image '%s'\"",
",",
"self",
".",
"image_id",
")",
"self",
".",
"ensure_is_built",
"(",
")",
"# dict with lots of data, see man docker-inspect",
"inspect_data",
"=",
"s... | inspect built image
:return: dict | [
"inspect",
"built",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L319-L329 | train | 28,571 |
projectatomic/atomic-reactor | atomic_reactor/build.py | InsideBuilder.get_base_image_info | def get_base_image_info(self):
"""
query docker about base image
:return dict
"""
if self.base_from_scratch:
return
logger.info("getting information about base image '%s'", self.base_image)
image_info = self.tasker.get_image_info_by_image_name(self.ba... | python | def get_base_image_info(self):
"""
query docker about base image
:return dict
"""
if self.base_from_scratch:
return
logger.info("getting information about base image '%s'", self.base_image)
image_info = self.tasker.get_image_info_by_image_name(self.ba... | [
"def",
"get_base_image_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"base_from_scratch",
":",
"return",
"logger",
".",
"info",
"(",
"\"getting information about base image '%s'\"",
",",
"self",
".",
"base_image",
")",
"image_info",
"=",
"self",
".",
"tasker",
... | query docker about base image
:return dict | [
"query",
"docker",
"about",
"base",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L331-L351 | train | 28,572 |
projectatomic/atomic-reactor | atomic_reactor/build.py | InsideBuilder.get_built_image_info | def get_built_image_info(self):
"""
query docker about built image
:return dict
"""
logger.info("getting information about built image '%s'", self.image)
image_info = self.tasker.get_image_info_by_image_name(self.image)
items_count = len(image_info)
if it... | python | def get_built_image_info(self):
"""
query docker about built image
:return dict
"""
logger.info("getting information about built image '%s'", self.image)
image_info = self.tasker.get_image_info_by_image_name(self.image)
items_count = len(image_info)
if it... | [
"def",
"get_built_image_info",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"getting information about built image '%s'\"",
",",
"self",
".",
"image",
")",
"image_info",
"=",
"self",
".",
"tasker",
".",
"get_image_info_by_image_name",
"(",
"self",
".",
"im... | query docker about built image
:return dict | [
"query",
"docker",
"about",
"built",
"image"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/build.py#L353-L370 | train | 28,573 |
projectatomic/atomic-reactor | atomic_reactor/inner.py | build_inside | def build_inside(input_method, input_args=None, substitutions=None):
"""
use requested input plugin to load configuration and then initiate build
"""
def process_keyvals(keyvals):
""" ["key=val", "x=y"] -> {"key": "val", "x": "y"} """
keyvals = keyvals or []
processed_keyvals = {... | python | def build_inside(input_method, input_args=None, substitutions=None):
"""
use requested input plugin to load configuration and then initiate build
"""
def process_keyvals(keyvals):
""" ["key=val", "x=y"] -> {"key": "val", "x": "y"} """
keyvals = keyvals or []
processed_keyvals = {... | [
"def",
"build_inside",
"(",
"input_method",
",",
"input_args",
"=",
"None",
",",
"substitutions",
"=",
"None",
")",
":",
"def",
"process_keyvals",
"(",
"keyvals",
")",
":",
"\"\"\" [\"key=val\", \"x=y\"] -> {\"key\": \"val\", \"x\": \"y\"} \"\"\"",
"keyvals",
"=",
"keyv... | use requested input plugin to load configuration and then initiate build | [
"use",
"requested",
"input",
"plugin",
"to",
"load",
"configuration",
"and",
"then",
"initiate",
"build"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/inner.py#L531-L578 | train | 28,574 |
projectatomic/atomic-reactor | atomic_reactor/inner.py | FSWatcher.run | def run(self):
""" Overrides parent method to implement thread's functionality. """
while True: # make sure to run at least once before exiting
with self._lock:
self._update(self._data)
if self._done:
break
time.sleep(1) | python | def run(self):
""" Overrides parent method to implement thread's functionality. """
while True: # make sure to run at least once before exiting
with self._lock:
self._update(self._data)
if self._done:
break
time.sleep(1) | [
"def",
"run",
"(",
"self",
")",
":",
"while",
"True",
":",
"# make sure to run at least once before exiting",
"with",
"self",
".",
"_lock",
":",
"self",
".",
"_update",
"(",
"self",
".",
"_data",
")",
"if",
"self",
".",
"_done",
":",
"break",
"time",
".",
... | Overrides parent method to implement thread's functionality. | [
"Overrides",
"parent",
"method",
"to",
"implement",
"thread",
"s",
"functionality",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/inner.py#L272-L279 | train | 28,575 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_reactor_config.py | get_config | def get_config(workflow):
"""
Obtain configuration object
Does not fail
:return: ReactorConfig instance
"""
try:
workspace = workflow.plugin_workspace[ReactorConfigPlugin.key]
return workspace[WORKSPACE_CONF_KEY]
except KeyError:
# The plugin did not run or was not s... | python | def get_config(workflow):
"""
Obtain configuration object
Does not fail
:return: ReactorConfig instance
"""
try:
workspace = workflow.plugin_workspace[ReactorConfigPlugin.key]
return workspace[WORKSPACE_CONF_KEY]
except KeyError:
# The plugin did not run or was not s... | [
"def",
"get_config",
"(",
"workflow",
")",
":",
"try",
":",
"workspace",
"=",
"workflow",
".",
"plugin_workspace",
"[",
"ReactorConfigPlugin",
".",
"key",
"]",
"return",
"workspace",
"[",
"WORKSPACE_CONF_KEY",
"]",
"except",
"KeyError",
":",
"# The plugin did not ... | Obtain configuration object
Does not fail
:return: ReactorConfig instance | [
"Obtain",
"configuration",
"object",
"Does",
"not",
"fail"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_reactor_config.py#L26-L42 | train | 28,576 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_reactor_config.py | ReactorConfigPlugin.run | def run(self):
"""
Run the plugin
Parse and validate config.
Store in workflow workspace for later retrieval.
"""
if self.reactor_config_map:
self.log.info("reading config from REACTOR_CONFIG env variable")
conf = read_yaml(self.reactor_config_map... | python | def run(self):
"""
Run the plugin
Parse and validate config.
Store in workflow workspace for later retrieval.
"""
if self.reactor_config_map:
self.log.info("reading config from REACTOR_CONFIG env variable")
conf = read_yaml(self.reactor_config_map... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"self",
".",
"reactor_config_map",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"reading config from REACTOR_CONFIG env variable\"",
")",
"conf",
"=",
"read_yaml",
"(",
"self",
".",
"reactor_config_map",
",",
"'schemas/... | Run the plugin
Parse and validate config.
Store in workflow workspace for later retrieval. | [
"Run",
"the",
"plugin"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_reactor_config.py#L507-L528 | train | 28,577 |
projectatomic/atomic-reactor | atomic_reactor/core.py | BuildContainerFactory._check_build_input | def _check_build_input(self, image, args_path):
"""
Internal method, validate provided args.
:param image: str
:param args_path: str, path dir which is mounter inside container
:return: None
:raises RuntimeError
"""
try:
with open(os.path.join... | python | def _check_build_input(self, image, args_path):
"""
Internal method, validate provided args.
:param image: str
:param args_path: str, path dir which is mounter inside container
:return: None
:raises RuntimeError
"""
try:
with open(os.path.join... | [
"def",
"_check_build_input",
"(",
"self",
",",
"image",
",",
"args_path",
")",
":",
"try",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"args_path",
",",
"BUILD_JSON",
")",
")",
"as",
"json_args",
":",
"logger",
".",
"debug",
"(",
"... | Internal method, validate provided args.
:param image: str
:param args_path: str, path dir which is mounter inside container
:return: None
:raises RuntimeError | [
"Internal",
"method",
"validate",
"provided",
"args",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L80-L98 | train | 28,578 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.build_image_from_path | def build_image_from_path(self, path, image, use_cache=False, remove_im=True):
"""
build image from provided path and tag it
this operation is asynchronous and you should consume returned generator in order to wait
for build to finish
:param path: str
:param image: Imag... | python | def build_image_from_path(self, path, image, use_cache=False, remove_im=True):
"""
build image from provided path and tag it
this operation is asynchronous and you should consume returned generator in order to wait
for build to finish
:param path: str
:param image: Imag... | [
"def",
"build_image_from_path",
"(",
"self",
",",
"path",
",",
"image",
",",
"use_cache",
"=",
"False",
",",
"remove_im",
"=",
"True",
")",
":",
"logger",
".",
"info",
"(",
"\"building image '%s' from path '%s'\"",
",",
"image",
",",
"path",
")",
"response",
... | build image from provided path and tag it
this operation is asynchronous and you should consume returned generator in order to wait
for build to finish
:param path: str
:param image: ImageName, name of the resulting image
:param stream: bool, True returns generator, False retur... | [
"build",
"image",
"from",
"provided",
"path",
"and",
"tag",
"it"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L346-L364 | train | 28,579 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.build_image_from_git | def build_image_from_git(self, url, image, git_path=None, git_commit=None,
copy_dockerfile_to=None,
stream=False, use_cache=False):
"""
build image from provided url and tag it
this operation is asynchronous and you should consume return... | python | def build_image_from_git(self, url, image, git_path=None, git_commit=None,
copy_dockerfile_to=None,
stream=False, use_cache=False):
"""
build image from provided url and tag it
this operation is asynchronous and you should consume return... | [
"def",
"build_image_from_git",
"(",
"self",
",",
"url",
",",
"image",
",",
"git_path",
"=",
"None",
",",
"git_commit",
"=",
"None",
",",
"copy_dockerfile_to",
"=",
"None",
",",
"stream",
"=",
"False",
",",
"use_cache",
"=",
"False",
")",
":",
"logger",
"... | build image from provided url and tag it
this operation is asynchronous and you should consume returned generator in order to wait
for build to finish
:param url: str
:param image: ImageName, name of the resulting image
:param git_path: str, path to dockerfile within gitrepo
... | [
"build",
"image",
"from",
"provided",
"url",
"and",
"tag",
"it"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L366-L401 | train | 28,580 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.run | def run(self, image, command=None, create_kwargs=None, start_kwargs=None,
volume_bindings=None, privileged=None):
"""
create container from provided image and start it
for more info, see documentation of REST API calls:
* containers/{}/start
* container/create
... | python | def run(self, image, command=None, create_kwargs=None, start_kwargs=None,
volume_bindings=None, privileged=None):
"""
create container from provided image and start it
for more info, see documentation of REST API calls:
* containers/{}/start
* container/create
... | [
"def",
"run",
"(",
"self",
",",
"image",
",",
"command",
"=",
"None",
",",
"create_kwargs",
"=",
"None",
",",
"start_kwargs",
"=",
"None",
",",
"volume_bindings",
"=",
"None",
",",
"privileged",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"cre... | create container from provided image and start it
for more info, see documentation of REST API calls:
* containers/{}/start
* container/create
:param image: ImageName or string, name or id of the image
:param command: str
:param create_kwargs: dict, kwargs for docker.... | [
"create",
"container",
"from",
"provided",
"image",
"and",
"start",
"it"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L403-L440 | train | 28,581 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.commit_container | def commit_container(self, container_id, image=None, message=None):
"""
create image from provided container
:param container_id: str
:param image: ImageName
:param message: str
:return: image_id
"""
logger.info("committing container '%s'", container_id)
... | python | def commit_container(self, container_id, image=None, message=None):
"""
create image from provided container
:param container_id: str
:param image: ImageName
:param message: str
:return: image_id
"""
logger.info("committing container '%s'", container_id)
... | [
"def",
"commit_container",
"(",
"self",
",",
"container_id",
",",
"image",
"=",
"None",
",",
"message",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"committing container '%s'\"",
",",
"container_id",
")",
"logger",
".",
"debug",
"(",
"\"container_id =... | create image from provided container
:param container_id: str
:param image: ImageName
:param message: str
:return: image_id | [
"create",
"image",
"from",
"provided",
"container"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L442-L464 | train | 28,582 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.pull_image | def pull_image(self, image, insecure=False, dockercfg_path=None):
"""
pull provided image from registry
:param image_name: ImageName, image to pull
:param insecure: bool, allow connecting to registry over plain http
:param dockercfg_path: str, path to dockercfg
:return: ... | python | def pull_image(self, image, insecure=False, dockercfg_path=None):
"""
pull provided image from registry
:param image_name: ImageName, image to pull
:param insecure: bool, allow connecting to registry over plain http
:param dockercfg_path: str, path to dockercfg
:return: ... | [
"def",
"pull_image",
"(",
"self",
",",
"image",
",",
"insecure",
"=",
"False",
",",
"dockercfg_path",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"pulling image '%s' from registry\"",
",",
"image",
")",
"logger",
".",
"debug",
"(",
"\"image = '%s', in... | pull provided image from registry
:param image_name: ImageName, image to pull
:param insecure: bool, allow connecting to registry over plain http
:param dockercfg_path: str, path to dockercfg
:return: str, image (reg.om/img:v1) | [
"pull",
"provided",
"image",
"from",
"registry"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L522-L549 | train | 28,583 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.tag_image | def tag_image(self, image, target_image, force=False):
"""
tag provided image with specified image_name, registry and tag
:param image: str or ImageName, image to tag
:param target_image: ImageName, new name for the image
:param force: bool, force tag the image?
:return:... | python | def tag_image(self, image, target_image, force=False):
"""
tag provided image with specified image_name, registry and tag
:param image: str or ImageName, image to tag
:param target_image: ImageName, new name for the image
:param force: bool, force tag the image?
:return:... | [
"def",
"tag_image",
"(",
"self",
",",
"image",
",",
"target_image",
",",
"force",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"\"tagging image '%s' as '%s'\"",
",",
"image",
",",
"target_image",
")",
"logger",
".",
"debug",
"(",
"\"image = '%s', target... | tag provided image with specified image_name, registry and tag
:param image: str or ImageName, image to tag
:param target_image: ImageName, new name for the image
:param force: bool, force tag the image?
:return: str, image (reg.om/img:v1) | [
"tag",
"provided",
"image",
"with",
"specified",
"image_name",
"registry",
"and",
"tag"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L551-L577 | train | 28,584 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.login | def login(self, registry, docker_secret_path):
"""
login to docker registry
:param registry: registry name
:param docker_secret_path: path to docker config directory
"""
logger.info("logging in: registry '%s', secret path '%s'", registry, docker_secret_path)
# Do... | python | def login(self, registry, docker_secret_path):
"""
login to docker registry
:param registry: registry name
:param docker_secret_path: path to docker config directory
"""
logger.info("logging in: registry '%s', secret path '%s'", registry, docker_secret_path)
# Do... | [
"def",
"login",
"(",
"self",
",",
"registry",
",",
"docker_secret_path",
")",
":",
"logger",
".",
"info",
"(",
"\"logging in: registry '%s', secret path '%s'\"",
",",
"registry",
",",
"docker_secret_path",
")",
"# Docker-py needs username",
"dockercfg",
"=",
"Dockercfg"... | login to docker registry
:param registry: registry name
:param docker_secret_path: path to docker config directory | [
"login",
"to",
"docker",
"registry"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L579-L609 | train | 28,585 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.push_image | def push_image(self, image, insecure=False):
"""
push provided image to registry
:param image: ImageName
:param insecure: bool, allow connecting to registry over plain http
:return: str, logs from push
"""
logger.info("pushing image '%s'", image)
logger.d... | python | def push_image(self, image, insecure=False):
"""
push provided image to registry
:param image: ImageName
:param insecure: bool, allow connecting to registry over plain http
:return: str, logs from push
"""
logger.info("pushing image '%s'", image)
logger.d... | [
"def",
"push_image",
"(",
"self",
",",
"image",
",",
"insecure",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"\"pushing image '%s'\"",
",",
"image",
")",
"logger",
".",
"debug",
"(",
"\"image: '%s', insecure: '%s'\"",
",",
"image",
",",
"insecure",
"... | push provided image to registry
:param image: ImageName
:param insecure: bool, allow connecting to registry over plain http
:return: str, logs from push | [
"push",
"provided",
"image",
"to",
"registry"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L611-L635 | train | 28,586 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.tag_and_push_image | def tag_and_push_image(self, image, target_image, insecure=False, force=False,
dockercfg=None):
"""
tag provided image and push it to registry
:param image: str or ImageName, image id or name
:param target_image: ImageName, img
:param insecure: bool, a... | python | def tag_and_push_image(self, image, target_image, insecure=False, force=False,
dockercfg=None):
"""
tag provided image and push it to registry
:param image: str or ImageName, image id or name
:param target_image: ImageName, img
:param insecure: bool, a... | [
"def",
"tag_and_push_image",
"(",
"self",
",",
"image",
",",
"target_image",
",",
"insecure",
"=",
"False",
",",
"force",
"=",
"False",
",",
"dockercfg",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"tagging and pushing image '%s' as '%s'\"",
",",
"ima... | tag provided image and push it to registry
:param image: str or ImageName, image id or name
:param target_image: ImageName, img
:param insecure: bool, allow connecting to registry over plain http
:param force: bool, force the tag?
:param dockercfg: path to docker config
... | [
"tag",
"provided",
"image",
"and",
"push",
"it",
"to",
"registry"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L637-L654 | train | 28,587 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.remove_image | def remove_image(self, image_id, force=False, noprune=False):
"""
remove provided image from filesystem
:param image_id: str or ImageName
:param noprune: bool, keep untagged parents?
:param force: bool, force remove -- just trash it no matter what
:return: None
"... | python | def remove_image(self, image_id, force=False, noprune=False):
"""
remove provided image from filesystem
:param image_id: str or ImageName
:param noprune: bool, keep untagged parents?
:param force: bool, force remove -- just trash it no matter what
:return: None
"... | [
"def",
"remove_image",
"(",
"self",
",",
"image_id",
",",
"force",
"=",
"False",
",",
"noprune",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"\"removing image '%s' from filesystem\"",
",",
"image_id",
")",
"logger",
".",
"debug",
"(",
"\"image_id = '%s... | remove provided image from filesystem
:param image_id: str or ImageName
:param noprune: bool, keep untagged parents?
:param force: bool, force remove -- just trash it no matter what
:return: None | [
"remove",
"provided",
"image",
"from",
"filesystem"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L670-L683 | train | 28,588 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.remove_container | def remove_container(self, container_id, force=False):
"""
remove provided container from filesystem
:param container_id: str
:param force: bool, remove forcefully?
:return: None
"""
logger.info("removing container '%s' from filesystem", container_id)
log... | python | def remove_container(self, container_id, force=False):
"""
remove provided container from filesystem
:param container_id: str
:param force: bool, remove forcefully?
:return: None
"""
logger.info("removing container '%s' from filesystem", container_id)
log... | [
"def",
"remove_container",
"(",
"self",
",",
"container_id",
",",
"force",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"\"removing container '%s' from filesystem\"",
",",
"container_id",
")",
"logger",
".",
"debug",
"(",
"\"container_id = '%s'\"",
",",
"co... | remove provided container from filesystem
:param container_id: str
:param force: bool, remove forcefully?
:return: None | [
"remove",
"provided",
"container",
"from",
"filesystem"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L685-L695 | train | 28,589 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.image_exists | def image_exists(self, image_id):
"""
does provided image exists?
:param image_id: str or ImageName
:return: True if exists, False if not
"""
logger.info("checking whether image '%s' exists", image_id)
logger.debug("image_id = '%s'", image_id)
try:
... | python | def image_exists(self, image_id):
"""
does provided image exists?
:param image_id: str or ImageName
:return: True if exists, False if not
"""
logger.info("checking whether image '%s' exists", image_id)
logger.debug("image_id = '%s'", image_id)
try:
... | [
"def",
"image_exists",
"(",
"self",
",",
"image_id",
")",
":",
"logger",
".",
"info",
"(",
"\"checking whether image '%s' exists\"",
",",
"image_id",
")",
"logger",
".",
"debug",
"(",
"\"image_id = '%s'\"",
",",
"image_id",
")",
"try",
":",
"response",
"=",
"s... | does provided image exists?
:param image_id: str or ImageName
:return: True if exists, False if not | [
"does",
"provided",
"image",
"exists?"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L729-L746 | train | 28,590 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.get_volumes_for_container | def get_volumes_for_container(self, container_id, skip_empty_source=True):
"""
get a list of volumes mounter in a container
:param container_id: str
:param skip_empty_source: bool, don't list volumes which are not created on FS
:return: list, a list of volume names
"""
... | python | def get_volumes_for_container(self, container_id, skip_empty_source=True):
"""
get a list of volumes mounter in a container
:param container_id: str
:param skip_empty_source: bool, don't list volumes which are not created on FS
:return: list, a list of volume names
"""
... | [
"def",
"get_volumes_for_container",
"(",
"self",
",",
"container_id",
",",
"skip_empty_source",
"=",
"True",
")",
":",
"logger",
".",
"info",
"(",
"\"listing volumes for container '%s'\"",
",",
"container_id",
")",
"inspect_output",
"=",
"self",
".",
"d",
".",
"in... | get a list of volumes mounter in a container
:param container_id: str
:param skip_empty_source: bool, don't list volumes which are not created on FS
:return: list, a list of volume names | [
"get",
"a",
"list",
"of",
"volumes",
"mounter",
"in",
"a",
"container"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L764-L782 | train | 28,591 |
projectatomic/atomic-reactor | atomic_reactor/core.py | DockerTasker.remove_volume | def remove_volume(self, volume_name):
"""
remove a volume by its name
:param volume_name: str
:return None
"""
logger.info("removing volume '%s'", volume_name)
try:
self.d.remove_volume(volume_name)
except APIError as ex:
if ex.res... | python | def remove_volume(self, volume_name):
"""
remove a volume by its name
:param volume_name: str
:return None
"""
logger.info("removing volume '%s'", volume_name)
try:
self.d.remove_volume(volume_name)
except APIError as ex:
if ex.res... | [
"def",
"remove_volume",
"(",
"self",
",",
"volume_name",
")",
":",
"logger",
".",
"info",
"(",
"\"removing volume '%s'\"",
",",
"volume_name",
")",
"try",
":",
"self",
".",
"d",
".",
"remove_volume",
"(",
"volume_name",
")",
"except",
"APIError",
"as",
"ex",... | remove a volume by its name
:param volume_name: str
:return None | [
"remove",
"a",
"volume",
"by",
"its",
"name"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/core.py#L784-L798 | train | 28,592 |
projectatomic/atomic-reactor | atomic_reactor/plugins/input_env.py | EnvInputPlugin.run | def run(self):
"""
get json with build config from environment variable
"""
env_name = self.env_name or BUILD_JSON_ENV
try:
build_cfg_json = os.environ[env_name]
except KeyError:
self.log.error("build config not found in env variable '%s'", env_nam... | python | def run(self):
"""
get json with build config from environment variable
"""
env_name = self.env_name or BUILD_JSON_ENV
try:
build_cfg_json = os.environ[env_name]
except KeyError:
self.log.error("build config not found in env variable '%s'", env_nam... | [
"def",
"run",
"(",
"self",
")",
":",
"env_name",
"=",
"self",
".",
"env_name",
"or",
"BUILD_JSON_ENV",
"try",
":",
"build_cfg_json",
"=",
"os",
".",
"environ",
"[",
"env_name",
"]",
"except",
"KeyError",
":",
"self",
".",
"log",
".",
"error",
"(",
"\"b... | get json with build config from environment variable | [
"get",
"json",
"with",
"build",
"config",
"from",
"environment",
"variable"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/input_env.py#L31-L46 | train | 28,593 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_add_filesystem.py | AddFilesystemPlugin.get_default_image_build_conf | def get_default_image_build_conf(self):
"""Create a default image build config
:rtype: ConfigParser
:return: Initialized config with defaults
"""
target = self.koji_target
vcs_info = self.workflow.source.get_vcs_info()
ksurl = '{}#{}'.format(vcs_info.vcs_url, vc... | python | def get_default_image_build_conf(self):
"""Create a default image build config
:rtype: ConfigParser
:return: Initialized config with defaults
"""
target = self.koji_target
vcs_info = self.workflow.source.get_vcs_info()
ksurl = '{}#{}'.format(vcs_info.vcs_url, vc... | [
"def",
"get_default_image_build_conf",
"(",
"self",
")",
":",
"target",
"=",
"self",
".",
"koji_target",
"vcs_info",
"=",
"self",
".",
"workflow",
".",
"source",
".",
"get_vcs_info",
"(",
")",
"ksurl",
"=",
"'{}#{}'",
".",
"format",
"(",
"vcs_info",
".",
"... | Create a default image build config
:rtype: ConfigParser
:return: Initialized config with defaults | [
"Create",
"a",
"default",
"image",
"build",
"config"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_add_filesystem.py#L146-L181 | train | 28,594 |
projectatomic/atomic-reactor | atomic_reactor/plugins/pre_add_filesystem.py | AddFilesystemPlugin.update_config_from_dockerfile | def update_config_from_dockerfile(self, config):
"""Updates build config with values from the Dockerfile
Updates:
* set "name" from LABEL com.redhat.component (if exists)
* set "version" from LABEL version (if exists)
:param config: ConfigParser object
"""
l... | python | def update_config_from_dockerfile(self, config):
"""Updates build config with values from the Dockerfile
Updates:
* set "name" from LABEL com.redhat.component (if exists)
* set "version" from LABEL version (if exists)
:param config: ConfigParser object
"""
l... | [
"def",
"update_config_from_dockerfile",
"(",
"self",
",",
"config",
")",
":",
"labels",
"=",
"Labels",
"(",
"df_parser",
"(",
"self",
".",
"workflow",
".",
"builder",
".",
"df_path",
")",
".",
"labels",
")",
"for",
"config_key",
",",
"label",
"in",
"(",
... | Updates build config with values from the Dockerfile
Updates:
* set "name" from LABEL com.redhat.component (if exists)
* set "version" from LABEL version (if exists)
:param config: ConfigParser object | [
"Updates",
"build",
"config",
"with",
"values",
"from",
"the",
"Dockerfile"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/pre_add_filesystem.py#L183-L202 | train | 28,595 |
projectatomic/atomic-reactor | atomic_reactor/plugin.py | PluginsRunner.load_plugins | def load_plugins(self, plugin_class_name):
"""
load all available plugins
:param plugin_class_name: str, name of plugin class (e.g. 'PreBuildPlugin')
:return: dict, bindings for plugins of the plugin_class_name class
"""
# imp.findmodule('atomic_reactor') doesn't work
... | python | def load_plugins(self, plugin_class_name):
"""
load all available plugins
:param plugin_class_name: str, name of plugin class (e.g. 'PreBuildPlugin')
:return: dict, bindings for plugins of the plugin_class_name class
"""
# imp.findmodule('atomic_reactor') doesn't work
... | [
"def",
"load_plugins",
"(",
"self",
",",
"plugin_class_name",
")",
":",
"# imp.findmodule('atomic_reactor') doesn't work",
"plugins_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'plugins'",
")",
... | load all available plugins
:param plugin_class_name: str, name of plugin class (e.g. 'PreBuildPlugin')
:return: dict, bindings for plugins of the plugin_class_name class | [
"load",
"all",
"available",
"plugins"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugin.py#L129-L174 | train | 28,596 |
projectatomic/atomic-reactor | atomic_reactor/plugin.py | PluginsRunner.get_available_plugins | def get_available_plugins(self):
"""
check requested plugins availability
and handle missing plugins
:return: list of namedtuples, runnable plugins data
"""
available_plugins = []
PluginData = namedtuple('PluginData', 'name, plugin_class, conf, is_allowed_to_fail... | python | def get_available_plugins(self):
"""
check requested plugins availability
and handle missing plugins
:return: list of namedtuples, runnable plugins data
"""
available_plugins = []
PluginData = namedtuple('PluginData', 'name, plugin_class, conf, is_allowed_to_fail... | [
"def",
"get_available_plugins",
"(",
"self",
")",
":",
"available_plugins",
"=",
"[",
"]",
"PluginData",
"=",
"namedtuple",
"(",
"'PluginData'",
",",
"'name, plugin_class, conf, is_allowed_to_fail'",
")",
"for",
"plugin_request",
"in",
"self",
".",
"plugins_conf",
":"... | check requested plugins availability
and handle missing plugins
:return: list of namedtuples, runnable plugins data | [
"check",
"requested",
"plugins",
"availability",
"and",
"handle",
"missing",
"plugins"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugin.py#L196-L231 | train | 28,597 |
projectatomic/atomic-reactor | atomic_reactor/plugin.py | PluginsRunner.run | def run(self, keep_going=False, buildstep_phase=False):
"""
run all requested plugins
:param keep_going: bool, whether to keep going after unexpected
failure (only used for exit plugins)
:param buildstep_phase: bool, when True remaining plugins will
... | python | def run(self, keep_going=False, buildstep_phase=False):
"""
run all requested plugins
:param keep_going: bool, whether to keep going after unexpected
failure (only used for exit plugins)
:param buildstep_phase: bool, when True remaining plugins will
... | [
"def",
"run",
"(",
"self",
",",
"keep_going",
"=",
"False",
",",
"buildstep_phase",
"=",
"False",
")",
":",
"failed_msgs",
"=",
"[",
"]",
"plugin_successful",
"=",
"False",
"plugin_response",
"=",
"None",
"available_plugins",
"=",
"self",
".",
"available_plugi... | run all requested plugins
:param keep_going: bool, whether to keep going after unexpected
failure (only used for exit plugins)
:param buildstep_phase: bool, when True remaining plugins will
not be executed after a plugin completes
... | [
"run",
"all",
"requested",
"plugins"
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugin.py#L233-L331 | train | 28,598 |
projectatomic/atomic-reactor | atomic_reactor/plugins/exit_sendmail.py | SendMailPlugin._should_send | def _should_send(self, rebuild, success, auto_canceled, manual_canceled):
"""Return True if any state in `self.send_on` meets given conditions, thus meaning
that a notification mail should be sent.
"""
should_send = False
should_send_mapping = {
self.MANUAL_SUCCESS: ... | python | def _should_send(self, rebuild, success, auto_canceled, manual_canceled):
"""Return True if any state in `self.send_on` meets given conditions, thus meaning
that a notification mail should be sent.
"""
should_send = False
should_send_mapping = {
self.MANUAL_SUCCESS: ... | [
"def",
"_should_send",
"(",
"self",
",",
"rebuild",
",",
"success",
",",
"auto_canceled",
",",
"manual_canceled",
")",
":",
"should_send",
"=",
"False",
"should_send_mapping",
"=",
"{",
"self",
".",
"MANUAL_SUCCESS",
":",
"not",
"rebuild",
"and",
"success",
",... | Return True if any state in `self.send_on` meets given conditions, thus meaning
that a notification mail should be sent. | [
"Return",
"True",
"if",
"any",
"state",
"in",
"self",
".",
"send_on",
"meets",
"given",
"conditions",
"thus",
"meaning",
"that",
"a",
"notification",
"mail",
"should",
"be",
"sent",
"."
] | fd31c01b964097210bf169960d051e5f04019a80 | https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_sendmail.py#L203-L220 | train | 28,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.