diff --git a/osbs-client-0.33_site-specific_koji-kerberos_cancel-build.patch b/osbs-client-0.33_site-specific_koji-kerberos_cancel-build.patch new file mode 100644 index 0000000..f56e4c4 --- /dev/null +++ b/osbs-client-0.33_site-specific_koji-kerberos_cancel-build.patch @@ -0,0 +1,1548 @@ +diff --git a/docs/configuration_file.md b/docs/configuration_file.md +index 3ea34af..df300ba 100644 +--- a/docs/configuration_file.md ++++ b/docs/configuration_file.md +@@ -53,6 +53,12 @@ Some options are also mandatory. + + * `koji_certs_secret` (*optional*, `string`) — name of [kubernetes secret](https://github.com/kubernetes/kubernetes/blob/master/docs/design/secrets.md) to use for koji authentication + ++* `koji_use_kerberos` (*optional*, `boolean`) — will set [atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins to use kerberos to authenticate to koji. ++ ++* `koji_kerberos_keytab` (*optional*, `string`) - location of the keytab that will be used to initialize kerberos credentials for [atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins - usually in the form `FILE:`, see [kerberos documentation](http://web.mit.edu/Kerberos/krb5-latest/doc/basic/keytab_def.html) for other possible values ++ ++* `koji_kerberos_principal` (*optional*, `string`) - kerberos principal for the keytab provided in `koji_kerberos_keytab` ++ + * `sources_command` (*optional*, `string`) — command to use to get dist-git artifacts from lookaside cache (e.g. `fedpkg sources`) + + * `username`, `password` (*optional*, `string`) — when OpenShift is hidden behind authentication proxy, you can specify username and password for basic authentication +@@ -110,3 +116,53 @@ Some options are also mandatory. + * `memory_limit` (*optional*, `string`) — memory limit to apply to build (for more info, see [documentation for resources](https://github.com/projectatomic/osbs-client/blob/master/docs/resource.md) + + * `storage_limit` (*optional*, `string`) — storage limit to apply to build (for more info, see [documentation for resources](https://github.com/projectatomic/osbs-client/blob/master/docs/resource.md) ++ ++ ++## Build JSON Templates ++ ++In the `build_json_dir` there must be `prod.json` and `prod_inner.json` which ++defines the [OpenShift Build](https://docs.openshift.org/latest/dev_guide/builds.html) ++specification that will be used to enable the specific ++[atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins that ++should be enabled and the config values for each. ++ ++There is also a third file that is optional that can exist along side the ++previous two in `build_json_dir` which is `prod_customize.json` and it will ++provide the ability to set site-specific customizations such as removing, ++plugins, adding plugins, or overriding arguments passed to existing plugins. ++ ++The syntax of `prod_customize.json` is as follows: ++ ++```json ++{ ++ "disable_plugins": [ ++ { ++ "plugin_type": "foo_type", ++ "plugin_name": "foo_name" ++ }, ++ { ++ "plugin_type": "bar_type", ++ "plugin_name": "bar_name" ++ } ++ ], ++ ++ "enable_plugins": [ ++ { ++ "plugin_type": "foo_type", ++ "plugin_name": "foo_name", ++ "plugin_args": { ++ "foo_arg1": "foo_value1", ++ "foo_arg2": "foo_value2" ++ } ++ } ++ ] ++} ++``` ++ ++Such that: ++ ++* `disable_plugins` will define a list of dicts that define the plugin type of the plugin that is to be removed (`prebuild_plugins`, `prepublish_plugins`, `postbuild_plugins`, `exit_plugins`) and the name of the plugin. ++ ++* `enable_plugins` will define a list of dicts that is used to add plugins or modify already enabled plugins by overriding args passed to the plugin, these must be defined as key-value pairs as illustrated above. It should be noted that plugins added here will be executed at the end of the list of plugins in that particular `plugin_type` (`prebuild_plugins`, `prepublish_plugins`, `postbuild_plugins`, `exit_plugins`), unless the plugin has already been previously added and this setting is only being used to override args. In the case of arg override, the plugin order execution will not change. ++ ++ +diff --git a/inputs/prod_customize.json b/inputs/prod_customize.json +new file mode 100644 +index 0000000..e874211 +--- /dev/null ++++ b/inputs/prod_customize.json +@@ -0,0 +1,7 @@ ++{ ++ "disable_plugins": [ ++ ], ++ ++ "enable_plugins": [ ++ ] ++} +diff --git a/inputs/prod_inner.json b/inputs/prod_inner.json +index 306ac89..d2b5b4e 100644 +--- a/inputs/prod_inner.json ++++ b/inputs/prod_inner.json +@@ -154,7 +154,9 @@ + "kojihub": "{{KOJI_HUB}}", + "url": "{{OPENSHIFT_URI}}", + "verify_ssl": false, +- "blocksize": 10485760 ++ "blocksize": 10485760, ++ "koji_keytab": false, ++ "koji_principal": false + } + }, + { +diff --git a/osbs-client.spec b/osbs-client.spec +index 46423e3..c53b99b 100644 +--- a/osbs-client.spec ++++ b/osbs-client.spec +@@ -22,7 +22,7 @@ + %global with_check 1 + %endif + +-%global commit 5021224746eb0e6ac12c54c397397b629167030b ++%global commit 696505ae4da4898a4e3689ef18e1f6791b04ea09 + %global shortcommit %(c=%{commit}; echo ${c:0:7}) + # set to 0 to create a normal release + %global postrelease 0 +diff --git a/osbs/api.py b/osbs/api.py +index 1a8e5c5..b2c45d2 100644 +--- a/osbs/api.py ++++ b/osbs/api.py +@@ -338,8 +338,9 @@ class OSBS(object): + @osbsapi + def create_prod_build(self, git_uri, git_ref, + git_branch, # may be None +- user, component, +- target, # may be None ++ user, ++ component=None, ++ target=None, + architecture=None, yum_repourls=None, + koji_task_id=None, + scratch=None, +@@ -351,25 +352,35 @@ class OSBS(object): + :param git_ref: str, reference to commit + :param git_branch: str, branch name (may be None) + :param user: str, user name +- :param component: str, component name +- :param target: str, koji target (may be None) ++ :param component: str, not used anymore ++ :param target: str, koji target + :param architecture: str, build architecture + :param yum_repourls: list, URLs for yum repos + :param koji_task_id: int, koji task ID requesting build + :param scratch: bool, this is a scratch build + :return: BuildResponse instance + """ ++ ++ def get_required_label(labels, names): ++ """ ++ get value of label list, first found is returned ++ names has to be non empty tuple ++ """ ++ assert names # always called with a non-empty literal tuple so names[0] is safe ++ for label_name in names: ++ if label_name in labels: ++ return labels[label_name] ++ ++ raise OsbsValidationException("required label '{name}' missing " ++ "from Dockerfile" ++ .format(name=names[0])) ++ + df_parser = utils.get_df_parser(git_uri, git_ref, git_branch=git_branch) + build_request = self.get_build_request() + labels = df_parser.labels +- for name_label_name in ['name', 'Name']: +- if name_label_name in labels: +- name_label = labels[name_label_name] +- break +- else: +- raise OsbsValidationException("required label '{name}' missing " +- "from Dockerfile" +- .format(name=name_label_name)) ++ ++ name_label = get_required_label(labels, ('name', 'Name')) ++ component = get_required_label(labels, ('com.redhat.component', 'BZComponent')) + + build_request.set_params( + git_uri=git_uri, +@@ -393,6 +404,9 @@ class OSBS(object): + koji_target=target, + koji_certs_secret=self.build_conf.get_koji_certs_secret(), + koji_task_id=koji_task_id, ++ koji_use_kerberos=self.build_conf.get_koji_use_kerberos(), ++ koji_kerberos_keytab=self.build_conf.get_koji_kerberos_keytab(), ++ koji_kerberos_principal=self.build_conf.get_koji_kerberos_principal(), + architecture=architecture, + vendor=self.build_conf.get_vendor(), + build_host=self.build_conf.get_build_host(), +@@ -408,8 +422,6 @@ class OSBS(object): + pulp_registry=self.os_conf.get_pulp_registry(), + nfs_server_path=self.os_conf.get_nfs_server_path(), + nfs_dest_dir=self.build_conf.get_nfs_destination_dir(), +- git_push_url=self.build_conf.get_git_push_url(), +- git_push_username=self.build_conf.get_git_push_username(), + builder_build_json_dir=self.build_conf.get_builder_build_json_store(), + scratch=self.build_conf.get_scratch(scratch), + unique_tag_only=self.build_conf.get_unique_tag_only(), +@@ -423,14 +435,16 @@ class OSBS(object): + return response + + @osbsapi +- def create_prod_with_secret_build(self, git_uri, git_ref, git_branch, user, component, +- target, architecture=None, yum_repourls=None, **kwargs): ++ def create_prod_with_secret_build(self, git_uri, git_ref, git_branch, user, component=None, ++ target=None, architecture=None, yum_repourls=None, **kwargs): ++ warnings.warn("create_prod_with_secret_build is deprecated, please use create_build") + return self.create_prod_build(git_uri, git_ref, git_branch, user, component, target, + architecture, yum_repourls=yum_repourls, **kwargs) + + @osbsapi +- def create_prod_without_koji_build(self, git_uri, git_ref, git_branch, user, component, ++ def create_prod_without_koji_build(self, git_uri, git_ref, git_branch, user, component=None, + architecture=None, yum_repourls=None, **kwargs): ++ warnings.warn("create_prod_without_koji_build is deprecated, please use create_build") + return self.create_prod_build(git_uri, git_ref, git_branch, user, component, None, + architecture, yum_repourls=yum_repourls, **kwargs) + +@@ -448,7 +462,6 @@ class OSBS(object): + :return: instance of BuildRequest + """ + kwargs.setdefault('git_branch', None) +- kwargs.setdefault('target', None) + return self.create_prod_build(**kwargs) + + @osbsapi +diff --git a/osbs/build/build_request.py b/osbs/build/build_request.py +index 2dda77d..f8ef056 100644 +--- a/osbs/build/build_request.py ++++ b/osbs/build/build_request.py +@@ -24,7 +24,7 @@ except ImportError: + + from osbs.build.manipulate import DockJsonManipulator + from osbs.build.spec import BuildSpec +-from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE ++from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE, DEFAULT_CUSTOMIZE_CONF + from osbs.exceptions import OsbsException, OsbsValidationException + from osbs.utils import looks_like_git_hash, git_repo_humanish_part_from_uri + +@@ -46,6 +46,7 @@ class BuildRequest(object): + self.build_json = None # rendered template + self._template = None # template loaded from filesystem + self._inner_template = None # dock json ++ self._customize_conf = None # site customize conf for _inner_template + self._dj = None + self._resource_limits = None + self._openshift_required_version = parse_version('1.0.6') +@@ -77,7 +78,6 @@ class BuildRequest(object): + :param distribution_scope: str, distribution scope for this image + (private, authoritative-source-only, restricted, public) + :param use_auth: bool, use auth from atomic-reactor? +- :param git_push_url: str, URL for git push + """ + + # Here we cater to the koji "scratch" build type, this will disable +@@ -136,6 +136,20 @@ class BuildRequest(object): + return self._inner_template + + @property ++ def customize_conf(self): ++ if self._customize_conf is None: ++ path = os.path.join(self.build_json_store, DEFAULT_CUSTOMIZE_CONF) ++ logger.debug("loading customize conf from path %s", path) ++ try: ++ with open(path, "r") as fp: ++ self._customize_conf= json.load(fp) ++ except IOError: ++ # File not found, which is perfectly fine. Set to empty string ++ self._customize_conf = {} ++ ++ return self._customize_conf ++ ++ @property + def dj(self): + if self._dj is None: + self._dj = DockJsonManipulator(self.template, self.inner_template) +@@ -367,7 +381,8 @@ class BuildRequest(object): + # Note: only one for now, but left in a list like other adjust_for_ + # functions in the event that this needs to be expanded + for when, which in [ +- ("exit_plugins", "koji_promote"), ++ ("postbuild_plugins", "compress"), ++ ("exit_plugins", "koji_promote"), + ]: + logger.info("removing %s from request because there are no triggers", + which) +@@ -485,7 +500,15 @@ class BuildRequest(object): + + if use_auth is not None: + self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', +- 'use_auth', use_auth) ++ 'use_auth', use_auth) ++ ++ if (self.spec.koji_use_kerberos.value and ++ self.spec.koji_kerberos_principal.value and ++ self.spec.koji_kerberos_keytab.value): ++ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', ++ 'koji_principal', self.spec.koji_kerberos_principal.value) ++ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', ++ 'koji_keytab', self.spec.koji_kerberos_keytab.value) + else: + logger.info("removing koji_promote from request as no kojihub " + "specified") +@@ -648,10 +671,60 @@ class BuildRequest(object): + self.dj.dock_json_set_arg('postbuild_plugins', 'import_image', + 'insecure_registry', True) + ++ def render_customizations(self): ++ """ ++ Customize prod_inner for site specific customizations ++ """ ++ ++ disable_plugins = self.customize_conf.get('disable_plugins', []) ++ if not disable_plugins: ++ logger.debug("No site-specific plugins to disable") ++ else: ++ for plugin_dict in disable_plugins: ++ try: ++ self.dj.remove_plugin( ++ plugin_dict['plugin_type'], ++ plugin_dict['plugin_name'] ++ ) ++ logger.debug( ++ "site-specific plugin disabled -> Type:{0} Name:{1}".format( ++ plugin_dict['plugin_type'], ++ plugin_dict['plugin_name'] ++ ) ++ ) ++ except KeyError: ++ # Malformed config ++ logger.debug("Invalid custom configuration found for disable_plugins") ++ ++ enable_plugins = self.customize_conf.get('enable_plugins', []) ++ if not enable_plugins: ++ logger.debug("No site-specific plugins to enable") ++ else: ++ for plugin_dict in enable_plugins: ++ try: ++ self.dj.add_plugin( ++ plugin_dict['plugin_type'], ++ plugin_dict['plugin_name'], ++ plugin_dict['plugin_args'] ++ ) ++ logger.debug( ++ "site-specific plugin enabled -> Type:{0} Name:{1} Args: {2}".format( ++ plugin_dict['plugin_type'], ++ plugin_dict['plugin_name'], ++ plugin_dict['plugin_args'] ++ ) ++ ) ++ except KeyError: ++ # Malformed config ++ logger.debug("Invalid custom configuration found for enable_plugins") ++ ++ + def render(self, validate=True): + if validate: + self.spec.validate() + ++ self.render_customizations() ++ + # !IMPORTANT! can't be too long: https://github.com/openshift/origin/issues/733 + self.template['metadata']['name'] = self.spec.name.value + self.render_resource_limits() +@@ -715,16 +788,8 @@ class BuildRequest(object): + self.dj.dock_json_set_arg('prebuild_plugins', "pull_base_image", "parent_registry", + source_registry.docker_uri if source_registry else None) + +- # The rebuild trigger requires git_branch and git_push_url +- # parameters, but those parameters are optional. If either was +- # not provided, remove the trigger. ++ # Set to true to disable triggers in BuildConfig + remove_triggers = False +- for param_name in ['git_branch', 'git_push_url']: +- param = getattr(self.spec, param_name) +- if not param.value: +- logger.info("removing triggers as no %s specified", param_name) +- remove_triggers = True +- # Continue the loop so we log everything that's missing + + if self.is_custom_base_image(): + logger.info('removing triggers for custom base image build') +diff --git a/osbs/build/build_response.py b/osbs/build/build_response.py +index 2e28ee5..8461805 100644 +--- a/osbs/build/build_response.py ++++ b/osbs/build/build_response.py +@@ -27,6 +27,7 @@ class BuildResponse(object): + """ + self.json = build_json + self._status = None ++ self._cancelled = None + + @property + def status(self): +@@ -39,6 +40,18 @@ class BuildResponse(object): + cap_value = value.capitalize() + logger.info("changing status from %s to %s", self.status, cap_value) + self.json['status']['phase'] = cap_value ++ self._status = value ++ ++ @property ++ def cancelled(self): ++ if self._cancelled is None: ++ self._cancelled = self.json['status'].get('cancelled') ++ return self._cancelled ++ ++ @cancelled.setter ++ def cancelled(self, value): ++ self.json['status']['cancelled'] = value ++ self._cancelled = value + + def is_finished(self): + return self.status in BUILD_FINISHED_STATES +diff --git a/osbs/build/manipulate.py b/osbs/build/manipulate.py +index a6b64cf..a0fd1b8 100644 +--- a/osbs/build/manipulate.py ++++ b/osbs/build/manipulate.py +@@ -50,6 +50,21 @@ class DockJsonManipulator(object): + self.dock_json[plugin_type].remove(p) + break + ++ def add_plugin(self, plugin_type, plugin_name, args_dict): ++ """ ++ if config has plugin, override it, else add it ++ """ ++ ++ plugin_modified = False ++ ++ for plugin in self.dock_json[plugin_type]: ++ if plugin['name'] == plugin_name: ++ plugin['args'] = args_dict ++ plugin_modified = True ++ ++ if not plugin_modified: ++ self.dock_json[plugin_type].append({"name": plugin_name, "args": args_dict}) ++ + def dock_json_has_plugin_conf(self, plugin_type, plugin_name): + """ + Check whether a plugin is configured. +diff --git a/osbs/build/spec.py b/osbs/build/spec.py +index 1f68281..40d516c 100644 +--- a/osbs/build/spec.py ++++ b/osbs/build/spec.py +@@ -147,6 +147,9 @@ class BuildSpec(object): + kojihub = BuildParam("kojihub", allow_none=True) + koji_certs_secret = BuildParam("koji_certs_secret", allow_none=True) + koji_task_id = BuildParam("koji_task_id", allow_none=True) ++ koji_use_kerberos = BuildParam("koji_use_kerberos", allow_none=True) ++ koji_kerberos_principal = BuildParam("koji_kerberos_principal", allow_none=True) ++ koji_kerberos_keytab = BuildParam("koji_kerberos_keytab", allow_none=True) + image_tag = BuildParam("image_tag") + pulp_secret = BuildParam("pulp_secret", allow_none=True) + pulp_registry = BuildParam("pulp_registry", allow_none=True) +@@ -155,8 +158,6 @@ class BuildSpec(object): + smtp_uri = BuildParam("smtp_uri", allow_none=True) + nfs_server_path = BuildParam("nfs_server_path", allow_none=True) + nfs_dest_dir = BuildParam("nfs_dest_dir", allow_none=True) +- git_push_url = BuildParam("git_push_url", allow_none=True) +- git_push_username = BuildParam("git_push_username", allow_none=True) + builder_build_json_dir = BuildParam("builder_build_json_dir", allow_none=True) + unique_tag_only = BuildParam("unique_tag_only", allow_none=True) + +@@ -165,7 +166,6 @@ class BuildSpec(object): + self.git_uri, + self.git_ref, + self.user, +- self.component, + self.registry_uris, + self.openshift_uri, + self.sources_command, +@@ -183,8 +183,6 @@ class BuildSpec(object): + self.pdc_url, + self.smtp_uri, + self.nfs_server_path, +- self.git_push_url, +- self.git_push_username, + ] + + def set_params(self, git_uri=None, git_ref=None, +@@ -197,12 +195,13 @@ class BuildSpec(object): + sources_command=None, architecture=None, vendor=None, + build_host=None, authoritative_registry=None, distribution_scope=None, + koji_target=None, kojiroot=None, kojihub=None, koji_certs_secret=None, +- koji_task_id=None, ++ koji_use_kerberos=None, koji_kerberos_keytab=None, ++ koji_kerberos_principal=None, koji_task_id=None, + source_secret=None, # compatibility name for pulp_secret + pulp_secret=None, pulp_registry=None, pdc_secret=None, pdc_url=None, + smtp_uri=None, nfs_server_path=None, + nfs_dest_dir=None, git_branch=None, base_image=None, +- name_label=None, git_push_url=None, git_push_username=None, ++ name_label=None, + builder_build_json_dir=None, registry_api_versions=None, + unique_tag_only=None, + **kwargs): +@@ -240,6 +239,9 @@ class BuildSpec(object): + self.kojiroot.value = kojiroot + self.kojihub.value = kojihub + self.koji_certs_secret.value = koji_certs_secret ++ self.koji_use_kerberos.value = koji_use_kerberos ++ self.koji_kerberos_principal.value = koji_kerberos_principal ++ self.koji_kerberos_keytab.value = koji_kerberos_keytab + self.koji_task_id.value = koji_task_id + self.pulp_secret.value = pulp_secret or source_secret + self.pulp_registry.value = pulp_registry +@@ -248,8 +250,6 @@ class BuildSpec(object): + self.smtp_uri.value = smtp_uri + self.nfs_server_path.value = nfs_server_path + self.nfs_dest_dir.value = nfs_dest_dir +- self.git_push_url.value = git_push_url +- self.git_push_username.value = git_push_username + self.git_branch.value = git_branch + self.name.value = make_name_from_git(self.git_uri.value, self.git_branch.value) + if not base_image: +diff --git a/osbs/cli/main.py b/osbs/cli/main.py +index a828b97..6f6b118 100644 +--- a/osbs/cli/main.py ++++ b/osbs/cli/main.py +@@ -10,6 +10,7 @@ import collections + + import json + import logging ++import pkg_resources + + from textwrap import dedent + import codecs +@@ -277,7 +278,6 @@ def cmd_build(args, osbs): + git_ref=osbs.build_conf.get_git_ref(), + git_branch=osbs.build_conf.get_git_branch(), + user=osbs.build_conf.get_user(), +- component=osbs.build_conf.get_component(), + tag=osbs.build_conf.get_tag(), + target=osbs.build_conf.get_koji_target(), + architecture=osbs.build_conf.get_architecture(), +@@ -458,6 +458,11 @@ def str_on_2_unicode_on_3(s): + + + def cli(): ++ try: ++ version = pkg_resources.get_distribution("osbs-client").version ++ except pkg_resources.DistributionNotFound: ++ version = "GIT" ++ + parser = argparse.ArgumentParser( + description="OpenShift Build Service client" + ) +@@ -466,6 +471,7 @@ def cli(): + # that the option was not specified + exclusive_group.add_argument("--verbose", action="store_true", default=None) + exclusive_group.add_argument("-q", "--quiet", action="store_true") ++ exclusive_group.add_argument("-V", "--version", action="version", version=version) + + subparsers = parser.add_subparsers(help='commands') + +@@ -559,8 +565,8 @@ def cli(): + help="build architecture") + build_parser.add_argument("-u", "--user", action='store', required=True, + help="prefix for docker image repository") +- build_parser.add_argument("-c", "--component", action='store', required=True, +- help="name of component") ++ build_parser.add_argument("-c", "--component", action='store', required=False, ++ help="not used; use com.redhat.component label in Dockerfile") + build_parser.add_argument("-A", "--tag", action='store', required=False, + help="tag of the built image (simple builds only)") + build_parser.add_argument("--no-logs", action='store_true', required=False, default=False, +diff --git a/osbs/conf.py b/osbs/conf.py +index bb92ca7..97cd677 100644 +--- a/osbs/conf.py ++++ b/osbs/conf.py +@@ -186,9 +186,6 @@ class Configuration(object): + """ user namespace when tagging and pushing image """ + return self._get_value("user", self.conf_section, "user") + +- def get_component(self): +- return self._get_value("component", self.conf_section, "component") +- + def get_tag(self): + return self._get_value("tag", self.conf_section, "tag") + +@@ -211,6 +208,15 @@ class Configuration(object): + def get_koji_certs_secret(self): + return self._get_value("koji_certs_secret", self.conf_section, "koji_certs_secret") + ++ def get_koji_use_kerberos(self): ++ return self._get_value("koji_use_kerberos", self.conf_section, "koji_use_kerberos", is_bool_val=True) ++ ++ def get_koji_kerberos_keytab(self): ++ return self._get_value("koji_kerberos_keytab", self.conf_section, "koji_kerberos_keytab") ++ ++ def get_koji_kerberos_principal(self): ++ return self._get_value("koji_kerberos_principal", self.conf_section, "koji_kerberos_principal") ++ + def get_sources_command(self): + return self._get_value("sources_command", self.conf_section, "sources_command") + +@@ -312,9 +318,8 @@ class Configuration(object): + key = "builder_build_json_dir" + builder_build_json_dir = self._get_value(key, self.conf_section, key) + if builder_build_json_dir is None: +- fallback_key = "build_json_dir" +- logger.warning("%r not found, falling back %r", key, fallback_key) +- builder_build_json_dir = self._get_value(fallback_key, self.conf_section, fallback_key) ++ logger.warning("%r not found, falling back to build_json_dir", key) ++ builder_build_json_dir = self.get_build_json_store() + return builder_build_json_dir + + def get_pulp_secret(self): +@@ -353,12 +358,6 @@ class Configuration(object): + def get_storage_limit(self): + return self._get_value("storage_limit", self.conf_section, "storage_limit") + +- def get_git_push_url(self): +- return self._get_value("git_push_url", self.conf_section, "git_push_url") +- +- def get_git_push_username(self): +- return self._get_value("git_push_username", self.conf_section, "git_push_username") +- + def get_build_image(self): + return self._get_value("build_image", self.conf_section, "build_image") + +diff --git a/osbs/constants.py b/osbs/constants.py +index 649626c..282f002 100644 +--- a/osbs/constants.py ++++ b/osbs/constants.py +@@ -18,6 +18,7 @@ DEFAULT_CONFIGURATION_FILE = "/etc/osbs.conf" + DEFAULT_CONFIGURATION_SECTION = "default" + DEFAULT_OUTER_TEMPLATE = "prod.json" + DEFAULT_INNER_TEMPLATE = "prod_inner.json" ++DEFAULT_CUSTOMIZE_CONF = "prod_customize.json" + GENERAL_CONFIGURATION_SECTION = "general" + POD_FINISHED_STATES = ["failed", "succeeded"] + POD_FAILED_STATES = ["failed"] +diff --git a/osbs/core.py b/osbs/core.py +index 9a93846..9eeeece 100755 +--- a/osbs/core.py ++++ b/osbs/core.py +@@ -293,7 +293,7 @@ class Openshift(object): + def cancel_build(self, build_id): + response = self.get_build(build_id) + br = BuildResponse(response.json()) +- br.status = BUILD_CANCELLED_STATE ++ br.cancelled = True + url = self._build_url("builds/%s/" % build_id) + return self._put(url, data=json.dumps(br.json), + headers={"Content-Type": "application/json"}) +diff --git a/tests/build/test_build_request.py b/tests/build/test_build_request.py +index 6af5e53..c32b5d9 100644 +--- a/tests/build/test_build_request.py ++++ b/tests/build/test_build_request.py +@@ -706,7 +706,8 @@ class TestBuildRequest(object): + ['v1', 'v2'], + ['v2'], + ]) +- def test_render_prod_request_v1_v2(self, registry_api_versions): ++ @pytest.mark.parametrize('scratch', [False, True]) ++ def test_render_prod_request_v1_v2(self, registry_api_versions, scratch): + build_request = BuildRequest(INPUTS_PATH) + name_label = "fedora/resultingimage" + pulp_env = 'v1pulp' +@@ -747,6 +748,7 @@ class TestBuildRequest(object): + 'authoritative_registry': "registry.example.com", + 'distribution_scope': "authoritative-source-only", + 'registry_api_versions': registry_api_versions, ++ 'scratch': scratch, + }) + build_request.set_params(**kwargs) + build_json = build_request.render() +@@ -799,8 +801,6 @@ class TestBuildRequest(object): + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "postbuild_plugins", "cp_built_image_to_nfs") + +- assert get_plugin(plugins, "postbuild_plugins", "compress") +- + if 'v1' in registry_api_versions: + assert get_plugin(plugins, "postbuild_plugins", + "pulp_push") +@@ -830,6 +830,16 @@ class TestBuildRequest(object): + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "postbuild_plugins", "pulp_sync") + ++ if scratch: ++ with pytest.raises(NoSuchPluginException): ++ get_plugin(plugins, "postbuild_plugins", "compress") ++ ++ with pytest.raises(NoSuchPluginException): ++ get_plugin(plugins, "exit_plugins", "koji_promote") ++ else: ++ assert get_plugin(plugins, "postbuild_plugins", "compress") ++ assert get_plugin(plugins, "exit_plugins", "koji_promote") ++ + def test_render_with_yum_repourls(self): + kwargs = { + 'git_uri': TEST_GIT_URI, +@@ -1040,7 +1050,6 @@ class TestBuildRequest(object): + self.create_image_change_trigger_json(str(tmpdir)) + build_request = BuildRequest(str(tmpdir)) + name_label = "fedora/resultingimage" +- push_url = "ssh://{username}git.example.com/git/{component}.git" + pdc_secret_name = 'foo' + kwargs = { + 'git_uri': TEST_GIT_URI, +@@ -1061,8 +1070,6 @@ class TestBuildRequest(object): + 'authoritative_registry': "registry.example.com", + 'distribution_scope': "authoritative-source-only", + 'registry_api_versions': ['v1'], +- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT), +- 'git_push_username': 'example', + 'pdc_secret': pdc_secret_name, + 'pdc_url': 'https://pdc.example.com', + 'smtp_uri': 'smtp.example.com', +@@ -1127,57 +1134,38 @@ class TestBuildRequest(object): + 'name': 'sendmail'} + assert get_plugin(plugins, 'exit_plugins', 'sendmail') == expected + +- @pytest.mark.parametrize('missing', [ +- 'git_branch', +- 'git_push_url', +- ]) +- def test_render_prod_request_trigger_missing_param(self, tmpdir, missing): ++ def test_render_custom_base_image_with_trigger(self, tmpdir): + self.create_image_change_trigger_json(str(tmpdir)) + build_request = BuildRequest(str(tmpdir)) +- push_url = "ssh://{username}git.example.com/git/{component}.git" +- kwargs = { +- 'git_uri': TEST_GIT_URI, +- 'git_ref': TEST_GIT_REF, +- 'git_branch': TEST_GIT_BRANCH, +- 'user': "john-foo", +- 'component': TEST_COMPONENT, +- 'base_image': 'fedora:latest', +- 'name_label': 'fedora/resultingimage', +- 'registry_uri': "registry.example.com", +- 'openshift_uri': "http://openshift/", +- 'builder_openshift_url': "http://openshift/", +- 'koji_target': "koji-target", +- 'kojiroot': "http://root/", +- 'kojihub': "http://hub/", +- 'sources_command': "make", +- 'vendor': "Foo Vendor", +- 'authoritative_registry': "registry.example.com", +- 'distribution_scope': "authoritative-source-only", +- 'registry_api_versions': ['v1'], +- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT), +- 'git_push_username': 'example', +- } + +- # Remove one of the parameters required for rebuild triggers +- del kwargs[missing] ++ kwargs = get_sample_prod_params() ++ kwargs['base_image'] = 'koji/image-build' ++ kwargs['yum_repourls'] = ["http://example.com/my.repo"] ++ kwargs['pdc_secret'] = 'foo' ++ kwargs['pdc_url'] = 'https://pdc.example.com' ++ kwargs['smtp_uri'] = 'smtp.example.com' + + build_request.set_params(**kwargs) + build_json = build_request.render() + +- assert build_json["metadata"]["labels"]["git-branch"] is not None ++ assert build_request.is_custom_base_image() is True + + # Verify the triggers are now disabled + assert "triggers" not in build_json["spec"] + + # Verify the rebuild plugins are all disabled + plugins = get_plugins_from_build_json(build_json) ++ + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild") ++ + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "prebuild_plugins", + "stop_autorebuild_if_disabled") ++ + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "postbuild_plugins", "import_image") ++ + with pytest.raises(NoSuchPluginException): + get_plugin(plugins, "exit_plugins", "sendmail") + +@@ -1226,7 +1214,6 @@ class TestBuildRequest(object): + self.create_image_change_trigger_json(str(tmpdir)) + build_request = BuildRequest(str(tmpdir)) + name_label = "fedora/resultingimage" +- push_url = "ssh://{username}git.example.com/git/{component}.git" + koji_certs_secret_name = 'foobar' + koji_task_id = 1234 + kwargs = { +@@ -1249,8 +1236,6 @@ class TestBuildRequest(object): + 'authoritative_registry': "registry.example.com", + 'distribution_scope': "authoritative-source-only", + 'registry_api_versions': ['v1'], +- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT), +- 'git_push_username': 'example', + 'koji_certs_secret': koji_certs_secret_name, + } + build_request.set_params(**kwargs) +@@ -1269,6 +1254,54 @@ class TestBuildRequest(object): + koji_certs_secret_name) + assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_ssl_certs'] == mount_path + ++ def test_render_prod_request_with_koji_kerberos(self, tmpdir): ++ self.create_image_change_trigger_json(str(tmpdir)) ++ build_request = BuildRequest(str(tmpdir)) ++ name_label = "fedora/resultingimage" ++ koji_task_id = 1234 ++ koji_use_kerberos = True ++ koji_kerberos_keytab = "FILE:/tmp/fakekeytab" ++ koji_kerberos_principal = "myprincipal@OSBSDOMAIN.COM" ++ kwargs = { ++ 'git_uri': TEST_GIT_URI, ++ 'git_ref': TEST_GIT_REF, ++ 'git_branch': TEST_GIT_BRANCH, ++ 'user': "john-foo", ++ 'component': TEST_COMPONENT, ++ 'base_image': 'fedora:latest', ++ 'name_label': name_label, ++ 'registry_uri': "example.com", ++ 'openshift_uri': "http://openshift/", ++ 'builder_openshift_url': "http://openshift/", ++ 'koji_target': "koji-target", ++ 'kojiroot': "http://root/", ++ 'kojihub': "http://hub/", ++ 'sources_command': "make", ++ 'koji_task_id': koji_task_id, ++ 'koji_use_kerberos': koji_use_kerberos, ++ 'koji_kerberos_keytab': koji_kerberos_keytab, ++ 'koji_kerberos_principal': koji_kerberos_principal, ++ 'vendor': "Foo Vendor", ++ 'authoritative_registry': "registry.example.com", ++ 'distribution_scope': "authoritative-source-only", ++ 'registry_api_versions': ['v1'], ++ } ++ build_request.set_params(**kwargs) ++ build_json = build_request.render() ++ ++ assert build_json["metadata"]["labels"]["koji-task-id"] == str(koji_task_id) ++ ++ plugins = get_plugins_from_build_json(build_json) ++ assert get_plugin(plugins, "exit_plugins", "koji_promote") ++ assert plugin_value_get(plugins, "exit_plugins", "koji_promote", ++ "args", "kojihub") == kwargs["kojihub"] ++ assert plugin_value_get(plugins, "exit_plugins", "koji_promote", ++ "args", "url") == kwargs["openshift_uri"] ++ ++ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_principal'] == koji_kerberos_principal ++ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_keytab'] == koji_kerberos_keytab ++ ++ + @pytest.mark.parametrize(('base_image', 'is_custom'), [ + ('fedora', False), + ('fedora:latest', False), +@@ -1338,3 +1371,97 @@ class TestBuildRequest(object): + pull_base_image_plugin = get_plugin( + plugins, 'prebuild_plugins', 'pull_base_image') + assert pull_base_image_plugin is not None ++ ++ def test_render_prod_custom_site_plugin_enable(self): ++ """ ++ Test to make sure that when we attempt to enable a plugin, it is ++ actually enabled in the JSON for the build_request after running ++ build_request.render() ++ """ ++ ++ plugin_type = "exit_plugins" ++ plugin_name = "testing_exit_plugin" ++ plugin_args = {"foo": "bar"} ++ ++ build_request = BuildRequest(INPUTS_PATH) ++ build_request.customize_conf['enable_plugins'].append( ++ { ++ "plugin_type": plugin_type, ++ "plugin_name": plugin_name, ++ "plugin_args": plugin_args ++ } ++ ) ++ kwargs = get_sample_prod_params() ++ build_request.set_params(**kwargs) ++ build_request.render() ++ ++ assert { ++ "name": plugin_name, ++ "args": plugin_args ++ } in build_request.dj.dock_json[plugin_type] ++ ++ def test_render_prod_custom_site_plugin_disable(self): ++ """ ++ Test to make sure that when we attempt to disable a plugin, it is ++ actually disabled in the JSON for the build_request after running ++ build_request.render() ++ """ ++ ++ plugin_type = "postbuild_plugins" ++ plugin_name = "compress" ++ ++ build_request = BuildRequest(INPUTS_PATH) ++ build_request.customize_conf['disable_plugins'].append( ++ { ++ "plugin_type": plugin_type, ++ "plugin_name": plugin_name ++ } ++ ) ++ kwargs = get_sample_prod_params() ++ build_request.set_params(**kwargs) ++ build_request.render() ++ ++ for plugin in build_request.dj.dock_json[plugin_type]: ++ if plugin['name'] == plugin_name: ++ assert False ++ ++ def test_render_prod_custom_site_plugin_override(self): ++ """ ++ Test to make sure that when we attempt to override a plugin's args, ++ they are actually overridden in the JSON for the build_request ++ after running build_request.render() ++ """ ++ ++ plugin_type = "postbuild_plugins" ++ plugin_name = "compress" ++ plugin_args = {"foo": "bar"} ++ ++ kwargs = get_sample_prod_params() ++ ++ unmodified_build_request = BuildRequest(INPUTS_PATH) ++ unmodified_build_request.set_params(**kwargs) ++ unmodified_build_request.render() ++ ++ for plugin_dict in unmodified_build_request.dj.dock_json[plugin_type]: ++ if plugin_dict['name'] == plugin_name: ++ plugin_index = unmodified_build_request.dj.dock_json[plugin_type].index(plugin_dict) ++ ++ build_request = BuildRequest(INPUTS_PATH) ++ build_request.customize_conf['enable_plugins'].append( ++ { ++ "plugin_type": plugin_type, ++ "plugin_name": plugin_name, ++ "plugin_args": plugin_args ++ } ++ ) ++ build_request.set_params(**kwargs) ++ build_request.render() ++ ++ ++ assert { ++ "name": plugin_name, ++ "args": plugin_args ++ } in build_request.dj.dock_json[plugin_type] ++ ++ assert unmodified_build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name ++ assert build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name +diff --git a/tests/build/test_build_response.py b/tests/build/test_build_response.py +index 778e79c..23a3a23 100644 +--- a/tests/build/test_build_response.py ++++ b/tests/build/test_build_response.py +@@ -40,6 +40,23 @@ class TestBuildResponse(object): + }) + assert build_response.get_koji_build_id() == koji_build_id + ++ def test_build_cancel(self): ++ build_response = BuildResponse({ ++ 'status': { ++ 'phase': 'Running' ++ } ++ }) ++ assert not build_response.cancelled ++ build_response.cancelled = True ++ assert build_response.cancelled ++ assert 'cancelled' in build_response.json['status'] ++ assert build_response.json['status']['cancelled'] ++ build_response.cancelled = False ++ assert not build_response.cancelled ++ assert 'cancelled' in build_response.json['status'] ++ assert not build_response.json['status'].get('cancelled') ++ ++ + @pytest.mark.parametrize(('plugin', 'message', 'expected_error_message'), [ + ('dockerbuild', None, 'Error in plugin dockerbuild'), + ('foo', 'bar', 'Error in plugin foo: bar'), +diff --git a/tests/constants.py b/tests/constants.py +index 616d469..818c278 100644 +--- a/tests/constants.py ++++ b/tests/constants.py +@@ -13,6 +13,7 @@ HERE = os.path.dirname(__file__) + INPUTS_PATH = os.path.join(HERE, '..', 'inputs') + + TEST_BUILD = "test-build-123" ++TEST_CANCELLED_BUILD = "test-build-cancel-123" + TEST_BUILD_CONFIG = "path-master" + TEST_GIT_URI = "git://hostname/path" + TEST_GIT_URI_HUMAN_NAME = "path" +diff --git a/tests/fake_api.py b/tests/fake_api.py +index d07aa1b..5d1e9b9 100644 +--- a/tests/fake_api.py ++++ b/tests/fake_api.py +@@ -16,7 +16,7 @@ from osbs.core import Openshift + from osbs.http import HttpResponse + from osbs.conf import Configuration + from osbs.api import OSBS +-from tests.constants import (TEST_BUILD, TEST_COMPONENT, TEST_GIT_REF, ++from tests.constants import (TEST_BUILD, TEST_CANCELLED_BUILD, TEST_COMPONENT, TEST_GIT_REF, + TEST_GIT_BRANCH, TEST_BUILD_CONFIG, + TEST_GIT_URI_HUMAN_NAME, TEST_KOJI_TASK_ID) + from tempfile import NamedTemporaryFile +@@ -105,6 +105,20 @@ class Connection(object): + } + }, + ++ # Simulate build cancellation ++ (OAPI_PREFIX + "namespaces/default/builds/%s" % TEST_CANCELLED_BUILD, ++ OAPI_PREFIX + "namespaces/default/builds/%s/" % TEST_CANCELLED_BUILD): { ++ "get": { ++ # Contains a single build in Completed phase ++ # named test-build-123 ++ "file": "build_test-build-cancel-123_get.json", ++ }, ++ "put": { ++ "file": "build_test-build-cancel-123_put.json", ++ } ++ }, ++ ++ + (OAPI_PREFIX + "namespaces/default/builds/%s/log/" % TEST_BUILD, + OAPI_PREFIX + "namespaces/default/builds/%s/log/?follow=0" % TEST_BUILD, + OAPI_PREFIX + "namespaces/default/builds/%s/log/?follow=1" % TEST_BUILD): { +diff --git a/tests/mock_jsons/0.5.4/build_test-build-cancel-123_get.json b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_get.json +new file mode 100644 +index 0000000..1798408 +--- /dev/null ++++ b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_get.json +@@ -0,0 +1,71 @@ ++{ ++ "apiVersion": "v1", ++ "kind": "Build", ++ "metadata": { ++ "annotations": { ++ "artefacts": "", ++ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11", ++ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n", ++ "logs": "{\"stream\":\"Step 0 : FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\\n\"}\r\n\n{\"stream\":\" ---\\u003e ded7cd95e059\\n\"}\r\n\n{\"stream\":\"Step 1 : RUN uname -a \\u0026\\u0026 env\\n\"}\r\n\n{\"stream\":\" ---\\u003e Running in e69a69a94f1f\\n\"}\r\n\n{\"stream\":\"Linux 76cf7f67d83a 3.10.0-229.7.2.el7.x86_64 #1 SMP Fri May 15 21:38:46 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux\\n\"}\r\n\n{\"stream\":\"HOSTNAME=76cf7f67d83a\\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\nPWD=/\\ncontainer_uuid=e69a69a9-4f1f-c9d6-5cd3-b79a589b8cd1\\nSHLVL=1\\nHOME=/root\\n_=/usr/bin/env\\n\"}\r\n\n{\"stream\":\" ---\\u003e 28427eee8785\\n\"}\r\n\n{\"stream\":\"Removing intermediate container e69a69a94f1f\\n\"}\r\n\n{\"stream\":\"Successfully built 28427eee8785\\n\"}\r\n", ++ "repositories": "{\"unique\": [], \"primary\": []}", ++ "rpm-packages": "fedora-repos,22,1,noarch,(none),14147,738a42f51d801fa81537053e69489726,1432046662\nsetup,2.9.6,1.fc22,noarch,(none),704610,02a24708ecd4eac5e67e9c6c95db8e9a,1424705275\nbasesystem,10.0,10.fc21,noarch,(none),0,339071e9aea0d207cecfb3a2e94e2dba,1402110694\ndnf-conf,1.0.0,1.fc22,noarch,(none),32588,4c5bc19884f72f22955660714dc17cc2,1430571608\nxkeyboard-config,2.14,1.fc22,noarch,(none),5404890,c7ca07bdb23899730d406c5c2fb66340,1422495744\nglibc-common,2.21,5.fc22,x86_64,(none),122172241,ef0cb554680cabf2ab3d2a134e7e629c,1424707226\nglibc,2.21,5.fc22,x86_64,(none),14073696,7778017d7a207d79dfd51440c9dd990b,1424707226\nncurses-libs,5.9,18.20150214.fc22,x86_64,(none),988392,8d54c82610ad0f880c4f005ea08445c3,1424448611\nlibsepol,2.3,4.fc22,x86_64,(none),314104,dc960564e0e81f40fd717cd8b590fe62,1408279400\nlibselinux,2.3,9.fc22,x86_64,(none),157786,912d8cabde7091b414b946cecc32a6f2,1429779516\nxz-libs,5.2.0,2.fc22,x86_64,(none),159830,0dc2757f9c180971c87aaffd04c1bef5,1423059095\ninfo,5.2,8.fc22,x86_64,(none),380275,840e5f4a9aff9acd32ddec88211955b2,1422881539\nlibgpg-error,1.17,2.fc22,x86_64,(none),436521,8e55ec056bd135cf003e430c9584c134,1422632222\nexpat,2.1.0,10.fc22,x86_64,(none),207963,5fb825e2f638d632dc874d379b44c163,1408191327\nelfutils-libelf,0.161,6.fc22,x86_64,(none),974956,5841fa84feda1eb574d84b40355beffc,1425978586\nlibattr,2.4.47,9.fc22,x86_64,(none),20253,ff80c2cd1746bdb48a0eaea9fe93d9d1,1408145564\nlibcap,2.24,7.fc22,x86_64,(none),109693,15c077497a556b8de53073c95e5ed3bb,1408265628\nlibuuid,2.26.2,1.fc22,x86_64,(none),21608,0292eb9e5a5ebc1a5c1666c8f3f57ca9,1430391777\nlibgcrypt,1.6.3,4.fc22,x86_64,(none),1017329,4386e1c8c70ffbcddd2c8e2ecaf3fda2,1428073993\nlua,5.3.0,2.fc22,x86_64,(none),864227,52b2febc868e57c35d6c0159535ba52a,1426857011\nlibffi,3.1,7.fc22,x86_64,(none),48764,1c0ff0e068dad7e6909faa6b82f70efb,1421289776\nchkconfig,1.4,1.fc22,x86_64,(none),742470,4f69407e34fe783cc28d0cd2ed5248cc,1427712261\np11-kit,0.23.1,1.fc22,x86_64,(none),496554,39ba0e0653e3fc82551580b3b5202d6a,1424465130\nnss-softokn,3.18.0,1.fc22,x86_64,(none),1117934,9c526169adeba7953e67e0b0490eed72,1426867670\nlibsolv,0.6.10,1.fc22,x86_64,(none),746362,c612191850040b6de7ba644c908a3c3d,1427450973\nlibidn,1.29,3.fc22,x86_64,(none),600556,3efd58d864207fa784b8e1e86c97c117,1427812536\nlibnfnetlink,1.0.1,6.fc22,x86_64,(none),46619,a1473c1214ee836e9baac733174a5446,1408276103\nlibcap-ng,0.7.5,1.fc22,x86_64,(none),50374,56b9e01a818314aa75b2d0da4cf4705d,1431022071\nhawkey,0.5.6,1.fc22,x86_64,(none),144994,c68d8efdd132805ffbbdd60db7f62e97,1431006659\nlibcomps,0.1.6,14.fc22,x86_64,(none),204755,2bbf1d38c87d4ee02d1556b4201fe033,1408267154\nlibss,1.42.12,4.fc22,x86_64,(none),72729,e123e6b352c3d3c2bff213b82e5d128e,1430444535\nlibmetalink,0.1.2,7.fc22,x86_64,(none),68232,7512e6432df4b5e7b1b7f1c4357d02c6,1408274614\nlibdb-utils,5.3.28,9.fc22,x86_64,(none),303160,ce6cbd462d10900a34cee9e8f35d0b57,1408268990\ndiffutils,3.3,9.fc22,x86_64,(none),1073548,32bcaf2c3952ba84fff4c69c53c00b1d,1408169683\nfile-libs,5.22,3.fc22,x86_64,(none),4000750,4dc7338ee7e6186dfe714f7be9d46f94,1430291029\ngmp,6.0.0,9.fc22,x86_64,1,651685,e4384f37940cacf93b808bed58641153,1427989243\nlibxkbcommon,0.5.0,1.fc22,x86_64,(none),274464,6fc1ee5aac34c2a4c5db3e056596b749,1413994202\nustr,1.0.4,18.fc22,x86_64,(none),294991,cf6bfd3f659fb21168243bc8532becf1,1408410168\nkeyutils-libs,1.5.9,4.fc22,x86_64,(none),55142,090face8d1793ca18052e88008e36052,1408250711\nnpth,1.2,1.fc22,x86_64,(none),45546,db7645e1d5158e203c861be272804dbd,1429535820\nlibmnl,1.0.3,9.fc22,x86_64,(none),51503,e0d19f725c10ab408308d3478c195a1b,1408274518\niptables,1.4.21,14.fc22,x86_64,(none),1579944,75fea1c1587a9b50dde6017a7db8b18a,1417435111\nlibsmartcols,2.26.2,1.fc22,x86_64,(none),173802,df3074d486f996d58c9011ae11ec8b1a,1430391777\np11-kit-trust,0.23.1,1.fc22,x86_64,(none),430488,7c8c256d5dfa6aa54d0b5fbf5b5774b5,1424465130\nopenssl-libs,1.0.1k,8.fc22,x86_64,1,2658876,f330cc1c7a8c1fb1cd6ea915b8f4676f,1430399948\nca-certificates,2015.2.4,1.0.fc22,noarch,(none),1186255,7a66af3ac04846640865b131b17b3937,1430850517\npython-libs,2.7.9,6.fc22,x86_64,(none),25158969,a1d52750ee7c896cb680ff55d39df5c0,1429101737\nlibblkid,2.26.2,1.fc22,x86_64,(none),273320,e6e942e10d658250422b4e424514b8fa,1430391777\nlibmount,2.26.2,1.fc22,x86_64,(none),324330,e55c3685e19ba73ddf3a9152b363cdfa,1430391777\nlibfdisk,2.26.2,1.fc22,x86_64,(none),384018,7fe563dfb6a51e49327e75ede7dd8b46,1430391777\npython-hawkey,0.5.6,1.fc22,x86_64,(none),148981,876e237f7b7ab2cbcaa5a854c3989194,1431006659\npython-six,1.9.0,1.fc22,noarch,(none),99018,2c56482e6bbdcdd69a90369b550d7732,1425899883\ngzip,1.6,6.fc22,x86_64,(none),318281,6491eefd4795527d79afff93a372b32a,1409063636\ncracklib-dicts,2.9.1,5.fc22,x86_64,(none),9389116,69bc04b561ed904037bf72c36b58462d,1408162574\nlibpwquality,1.2.4,2.fc22,x86_64,(none),333534,be2afadd2d64cbfbf66b424744bfc0c5,1408278427\nnss,3.18.0,1.fc22,x86_64,(none),2612158,5070459cf44f11a173204f0fac59c232,1426871722\nnss-tools,3.18.0,1.fc22,x86_64,(none),1918262,549cbd61be3294dd9590016527912a07,1426871722\ngnupg2,2.1.2,2.fc22,x86_64,(none),7189617,1b4e2d050c85835e4a0526122ece56f8,1428656209\npygpgme,0.3,12.fc22,x86_64,(none),238515,531cd0347f4d56b0bbb4a7253ecd5657,1408345624\nglib2,2.44.1,1.fc22,x86_64,(none),11063438,f76fa165233d9bdcc8dbd6c05b84daeb,1431509971\nlibuser,0.60,6.fc22,x86_64,(none),1953424,486a925fab5b712e6bb4cdf3f7326c54,1408282568\nlibssh2,1.5.0,1.fc22,x86_64,(none),359640,58d7de89aca37431c64058a855c5f244,1426070746\ndevice-mapper,1.02.93,3.fc22,x86_64,(none),192388,fc565a9c591a2580b17e0a5803d1322c,1422638927\ncryptsetup-libs,1.6.7,1.fc22,x86_64,(none),723879,15f1e247e0d0ee12e29289a2540f8462,1428225281\ndbus,1.8.16,1.fc22,x86_64,1,979105,445114a2c885381cd90b13f6d819cb76,1423510571\nlibrepo,1.7.13,1.fc22,x86_64,(none),155947,610d83cb532394fdf344d469875c26c2,1422024837\nlibarchive,3.1.2,12.fc22,x86_64,(none),740787,2ab4d8f785323f9a13c1ef048947bee7,1430297056\nrpm-libs,4.12.0.1,9.fc22,x86_64,(none),620840,9d1010807f91e6a3154089f8ed13cc6b,1429089697\ndeltarpm,3.6,8.fc22,x86_64,(none),214687,6a2c058885078740409b85f211366d8e,1421217702\nrpm-build-libs,4.12.0.1,9.fc22,x86_64,(none),166776,23e81aff3d7c5e363b1d3d356f182041,1429089697\npython-dnf,1.0.0,1.fc22,noarch,(none),1905093,50d9e137532bbcd51adc628a0130963b,1430571608\ndnf-yum,1.0.0,1.fc22,noarch,(none),24841,3237285cbe626d9b3b233f40ccc969bc,1430571608\ne2fsprogs,1.42.12,4.fc22,x86_64,(none),3003807,b9b79759b100cad845b7d8e004fce64f,1430444535\nrootfiles,8.1,17.fc21,noarch,(none),599,e9f1f3dac9b440c2156a66eddc35f909,1402212160\nlibgcc,5.1.1,1.fc22,x86_64,(none),183368,2daecefe22a5b96fa4393ba6dd6b5837,1429734590\nfedora-release,22,1,noarch,(none),4235,d91558d63d5aa15374f559bb1afcd12d,1432045630\nfilesystem,3.2,32.fc22,x86_64,(none),0,f49bd00613e7e51bc6d3559baae0cc68,1408195967\nlibreport-filesystem,2.5.1,1.fc22,x86_64,(none),0,5cb73843e2289324af75d40946fcff92,1428561525\ntzdata,2015d,1.fc22,noarch,(none),1644030,e834fc7e5e7135e54ebbcfc9ca233b8f,1430190469\nncurses-base,5.9,18.20150214.fc22,noarch,(none),246829,caf6152ababc48e199e64620e0f0d4aa,1424449040\nnss-softokn-freebl,3.18.0,1.fc22,x86_64,(none),521055,9339a991cfdb7cdef717e8d79451acf2,1426867670\nlibstdc++,5.1.1,1.fc22,x86_64,(none),1728084,98cd86a386062c04b9f4ad9b8d365d4e,1429734590\nbash,4.3.33,2.fc22,x86_64,(none),7155962,7e35b3cb74112c21a528dc468c07c1a8,1422029026\npcre,8.37,1.fc22,x86_64,(none),1674885,6b2636121ae2698fa5da07d6b87ed3f2,1430226425\nzlib,1.2.8,7.fc22,x86_64,(none),188155,3ddfcdbd91a0a4a6ef7f04cb3f36c1df,1408431203\nbzip2-libs,1.0.6,14.fc22,x86_64,(none),69829,46751433258eb55f0a5a13e4d8b725d0,1408152466\nlibdb,5.3.28,9.fc22,x86_64,(none),1888520,307580e0ca7e6bdb0f99c97a140a44ca,1408268990\nnspr,4.10.8,1.fc22,x86_64,(none),301230,78511358716d695cac7d0bd766372c1e,1422575653\nnss-util,3.18.0,1.fc22,x86_64,(none),199596,f603494b789bca34aaec99323540a41e,1426864636\npopt,1.16,5.fc22,x86_64,(none),126214,e0b265e6a5621512739e7f3ab363c259,1408340355\nlibacl,2.2.52,7.fc22,x86_64,(none),36600,6f8d43aeb05a58b75c1c13ed26bfdfee,1408137801\nlibcom_err,1.42.12,4.fc22,x86_64,(none),60233,9b40d0c3dd903c3a776c29dcb56bf816,1430444535\naudit-libs,2.4.2,1.fc22,x86_64,(none),236532,146e38d6bfcc4235884fa7e058a7f7ab,1430253368\nreadline,6.3,5.fc22,x86_64,(none),494939,005325df68633ebd9b36029a7bdbac3c,1408365488\nlibxml2,2.9.2,3.fc22,x86_64,(none),1727890,ac02080e61496187a20b084d38c1e1f2,1424271994\nsed,4.2.2,9.fc22,x86_64,(none),605545,26e10d79e2d0f4c4a4d15f17d4e97367,1408380126\ngrep,2.21,5.fc22,x86_64,(none),1262823,6ebca219a7e691041710f701f6033c8f,1428398413\nsqlite,3.8.9,1.fc22,x86_64,(none),935875,519ce8fb5f044470ce6963f0feeab0cd,1429003733\nelfutils-libs,0.161,6.fc22,x86_64,(none),710895,e3d710921b0b34d1bf158dd44093ea08,1425978586\nlibassuan,2.2.0,1.fc22,x86_64,(none),164618,ac28a767a31e0b54cde9aae9bf7869a0,1418999828\nkmod-libs,20,1.fc22,x86_64,(none),118112,2d2bef588c32b051cfcfcf2bb5b957ac,1425306281\ndbus-libs,1.8.16,1.fc22,x86_64,1,335864,275c8eefcec8bc443627bfe332fe5f01,1423510571\nkmod,20,1.fc22,x86_64,(none),207940,d9414f284dd3c3cd75e66afc48b9fdd3,1425306281\npinentry,0.9.1,1.fc22,x86_64,(none),112762,ab3d0dc736bf2a73faaa9e3d99d23cbe,1427312677\ne2fsprogs-libs,1.42.12,4.fc22,x86_64,(none),361897,0af85c4cbd59d23684585ba0e1ebd982,1430444535\nacl,2.2.52,7.fc22,x86_64,(none),189312,4e286726cf67ddb6c496a019a53f656a,1408137801\nlibksba,1.3.2,1.fc22,x86_64,(none),318478,0d85f4840d0099841fd64afd64860963,1417004901\ncyrus-sasl-lib,2.1.26,22.fc22,x86_64,(none),395343,9ed3d368bef4b6048d798880c0ddb1b0,1426523519\ngawk,4.1.1,6.fc22,x86_64,(none),2255738,e952c3e4bd5e96fb44bd86528b1781ff,1420212223\nncurses,5.9,18.20150214.fc22,x86_64,(none),451749,00cd8ef0169eb9ca92c20d5cb54c8389,1424448611\nlibseccomp,2.2.0,0.fc22,x86_64,(none),215242,3fcd5a77fbe7b6856b5069940adc8166,1424100824\nqrencode-libs,3.4.2,4.fc22,x86_64,(none),127918,90b684d658644656c9e84e29d0baae97,1408356554\nlibsemanage,2.3,6.fc22,x86_64,(none),251332,319fe99d5ab566feb2329c6edb17d8ae,1408279593\nlibverto,0.2.6,4.fc22,x86_64,(none),22804,71ac4eed13cfd100c9cb9c205c0db0fd,1408282096\ngdbm,1.11,4.fc22,x86_64,(none),381511,bab745ac6a8bd8d696f911c4091892fb,1408205700\nlibnetfilter_conntrack,1.0.4,4.fc22,x86_64,(none),138286,53fadc1ba11e0c298eb4c5d0b6864ff8,1408276161\nlzo,2.08,3.fc22,x86_64,(none),169709,36ca006519a8193819743c38572fb759,1408290599\nlibtasn1,4.5,1.fc22,x86_64,(none),421320,79319d7c572fcffb1b9906b0f0fce3b3,1430380575\nkrb5-libs,1.13.1,3.fc22,x86_64,(none),2286457,d57b1e21fe7df47809947d7902fed223,1430871086\ncoreutils,8.23,9.fc22,x86_64,(none),16324406,5cdca192845b4d124922f8590f102a25,1429541013\ncrypto-policies,20150305,2.git44afaa1.fc22,noarch,(none),40158,de2a35daa0fa3eb514eb74f90cf4fef3,1425639325\npython,2.7.9,6.fc22,x86_64,(none),79553,b3ff5a133956c02ea8f799f7d6e1434d,1429101737\nshadow-utils,4.2.1,1.fc22,x86_64,2,3711884,bca4896520780a4121320d9032310486,1417014272\nlibutempter,1.1.6,6.fc22,x86_64,(none),49757,f8c1f5fd313a3a150f2a2c8b14d1c5a5,1408281489\npyliblzma,0.5.3,13.fc22,x86_64,(none),198352,5e29b68f0ec46372fd17fa8713337141,1408344571\npython-libcomps,0.1.6,14.fc22,x86_64,(none),143380,80b028706911436dacdfedab86d0d60f,1408267154\npython-iniparse,0.4,15.fc22,noarch,(none),116198,fc2ee5738aade0ded608421f0a47394b,1406817743\ncracklib,2.9.1,5.fc22,x86_64,(none),209978,d43177a41fdd04450a66a3ef262b14ae,1408162574\npam,1.1.8,18.fc22,x86_64,(none),2637337,0839b4995da7b65b4ce9235e6d9e3809,1413541275\nsystemd-libs,219,13.fc22,x86_64,(none),1125568,144a9950fcdfb09a687ee92da97c17a9,1430317607\nnss-sysinit,3.18.0,1.fc22,x86_64,(none),13984,f7ac717c67020893e6e3858b50389bee,1426871722\nopenldap,2.4.40,12.fc22,x86_64,(none),992221,d49479f8b947346aae3b16fa2ace6e26,1430142582\ngpgme,1.4.3,5.fc22,x86_64,(none),607071,85d6ed868865dea6618c7ebc5275ddb5,1417838838\npkgconfig,0.28,8.fc22,x86_64,1,107920,49b9ff6f28962ded92e470a09c121146,1429298835\nshared-mime-info,1.4,2.fc22,x86_64,(none),2123110,2a186e493108a628d060d6339524865d,1423149713\nutil-linux,2.26.2,1.fc22,x86_64,(none),8978494,8dca268037a64736bad953b6494ca2c8,1430391777\nlibcurl,7.40.0,3.fc22,x86_64,(none),498308,0ac103d3c6450f227622552aba4bf0e0,1429709888\ndevice-mapper-libs,1.02.93,3.fc22,x86_64,(none),346908,a137a4620f31d18e9fdced0b07070739,1422638927\nsystemd,219,13.fc22,x86_64,(none),25514617,0be8a3814da5545f80beac320cb6d0e6,1430317607\ncurl,7.40.0,3.fc22,x86_64,(none),556943,135e6ab07141cdd8137e9bde2af1278d,1429709888\npython-librepo,1.7.13,1.fc22,x86_64,(none),145903,74a8048f1ae99b08e581e7bab22bda14,1422024837\nrpm-plugin-selinux,4.12.0.1,9.fc22,x86_64,(none),11504,2f98df94b412264db07f99b4b59dfdea,1429089697\nrpm,4.12.0.1,9.fc22,x86_64,(none),1967009,4ced0dd550667b4279df8d66733224af,1429089697\nrpm-plugin-systemd-inhibit,4.12.0.1,9.fc22,x86_64,(none),11384,9da731676612e9e63f9213564c599180,1429089697\nrpm-python,4.12.0.1,9.fc22,x86_64,(none),169585,9b25fd50ad23da16c302679958deac86,1429089697\ndnf,1.0.0,1.fc22,noarch,(none),724399,baed7804534a7eb0789afd1b0a1eb535,1430571608\nbash-completion,2.1,6.20141110git52d8316.fc22,noarch,1,851628,c3431145e46047a2d320e71443dad93d,1415654944\nvim-minimal,7.4.640,4.fc22,x86_64,2,943934,2dd93d2089331509d83152fff631bdef,1425285494\ngpg-pubkey,8e1431d5,53bcbac7,(none),(none),0,(none),1404877511" ++ }, ++ "creationTimestamp": "2015-08-21T10:12:40Z", ++ "labels": { ++ "buildconfig": "build-20150821111239", ++ "is_autorebuild": "false" ++ }, ++ "name": "test-build-123", ++ "namespace": "default", ++ "resourceVersion": "696", ++ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-123", ++ "uid": "27ccd290-47ed-11e5-969c-52540080e6f8" ++ }, ++ "spec": { ++ "output": { ++ "to": { ++ "kind": "DockerImage", ++ "name": "localhost:5000/twaugh/component:20150821111239" ++ } ++ }, ++ "resources": {}, ++ "source": { ++ "git": { ++ "ref": "master", ++ "uri": "https://github.com/TomasTomecek/docker-hello-world.git" ++ }, ++ "type": "Git" ++ }, ++ "strategy": { ++ "customStrategy": { ++ "env": [ ++ { ++ "name": "ATOMIC_REACTOR_PLUGINS", ++ "value": "{\"prebuild_plugins\": [{\"args\": {}, \"name\": \"pull_base_image\"}, {\"name\": \"change_from_in_dockerfile\"}, {\"name\": \"dockerfile_content\"}], \"exit_plugins\": [{\"args\": {\"url\": \"https://osbs.localdomain:8443/\", \"verify_ssl\": false, \"use_auth\": false}, \"name\": \"store_metadata_in_osv3\"}, {\"name\": \"remove_built_image\"}], \"postbuild_plugins\": [{\"args\": {\"image_id\": \"BUILT_IMAGE_ID\"}, \"name\": \"all_rpm_packages\"}]}" ++ }, ++ { ++ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE", ++ "value": "buildroot:latest" ++ } ++ ], ++ "exposeDockerSocket": true, ++ "from": { ++ "kind": "DockerImage", ++ "name": "buildroot:latest" ++ } ++ }, ++ "type": "Custom" ++ } ++ }, ++ "status": { ++ "completionTimestamp": "2015-08-21T10:13:00Z", ++ "config": { ++ "kind": "BuildConfig", ++ "name": "build-20150821111239", ++ "namespace": "default" ++ }, ++ "duration": 19000000000, ++ "phase": "Running", ++ "startTimestamp": "2015-08-21T10:12:41Z" ++ } ++} +diff --git a/tests/mock_jsons/0.5.4/build_test-build-cancel-123_put.json b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_put.json +new file mode 100644 +index 0000000..87e9a3d +--- /dev/null ++++ b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_put.json +@@ -0,0 +1,71 @@ ++{ ++ "apiVersion": "v1", ++ "kind": "Build", ++ "metadata": { ++ "annotations": { ++ "artefacts": "", ++ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11", ++ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n", ++ "logs": "{\"stream\":\"Step 0 : FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\\n\"}\r\n\n{\"stream\":\" ---\\u003e ded7cd95e059\\n\"}\r\n\n{\"stream\":\"Step 1 : RUN uname -a \\u0026\\u0026 env\\n\"}\r\n\n{\"stream\":\" ---\\u003e Running in e69a69a94f1f\\n\"}\r\n\n{\"stream\":\"Linux 76cf7f67d83a 3.10.0-229.7.2.el7.x86_64 #1 SMP Fri May 15 21:38:46 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux\\n\"}\r\n\n{\"stream\":\"HOSTNAME=76cf7f67d83a\\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\nPWD=/\\ncontainer_uuid=e69a69a9-4f1f-c9d6-5cd3-b79a589b8cd1\\nSHLVL=1\\nHOME=/root\\n_=/usr/bin/env\\n\"}\r\n\n{\"stream\":\" ---\\u003e 28427eee8785\\n\"}\r\n\n{\"stream\":\"Removing intermediate container e69a69a94f1f\\n\"}\r\n\n{\"stream\":\"Successfully built 28427eee8785\\n\"}\r\n", ++ "repositories": "{\"unique\": [], \"primary\": []}", ++ "rpm-packages": "fedora-repos,22,1,noarch,(none),14147,738a42f51d801fa81537053e69489726,1432046662\nsetup,2.9.6,1.fc22,noarch,(none),704610,02a24708ecd4eac5e67e9c6c95db8e9a,1424705275\nbasesystem,10.0,10.fc21,noarch,(none),0,339071e9aea0d207cecfb3a2e94e2dba,1402110694\ndnf-conf,1.0.0,1.fc22,noarch,(none),32588,4c5bc19884f72f22955660714dc17cc2,1430571608\nxkeyboard-config,2.14,1.fc22,noarch,(none),5404890,c7ca07bdb23899730d406c5c2fb66340,1422495744\nglibc-common,2.21,5.fc22,x86_64,(none),122172241,ef0cb554680cabf2ab3d2a134e7e629c,1424707226\nglibc,2.21,5.fc22,x86_64,(none),14073696,7778017d7a207d79dfd51440c9dd990b,1424707226\nncurses-libs,5.9,18.20150214.fc22,x86_64,(none),988392,8d54c82610ad0f880c4f005ea08445c3,1424448611\nlibsepol,2.3,4.fc22,x86_64,(none),314104,dc960564e0e81f40fd717cd8b590fe62,1408279400\nlibselinux,2.3,9.fc22,x86_64,(none),157786,912d8cabde7091b414b946cecc32a6f2,1429779516\nxz-libs,5.2.0,2.fc22,x86_64,(none),159830,0dc2757f9c180971c87aaffd04c1bef5,1423059095\ninfo,5.2,8.fc22,x86_64,(none),380275,840e5f4a9aff9acd32ddec88211955b2,1422881539\nlibgpg-error,1.17,2.fc22,x86_64,(none),436521,8e55ec056bd135cf003e430c9584c134,1422632222\nexpat,2.1.0,10.fc22,x86_64,(none),207963,5fb825e2f638d632dc874d379b44c163,1408191327\nelfutils-libelf,0.161,6.fc22,x86_64,(none),974956,5841fa84feda1eb574d84b40355beffc,1425978586\nlibattr,2.4.47,9.fc22,x86_64,(none),20253,ff80c2cd1746bdb48a0eaea9fe93d9d1,1408145564\nlibcap,2.24,7.fc22,x86_64,(none),109693,15c077497a556b8de53073c95e5ed3bb,1408265628\nlibuuid,2.26.2,1.fc22,x86_64,(none),21608,0292eb9e5a5ebc1a5c1666c8f3f57ca9,1430391777\nlibgcrypt,1.6.3,4.fc22,x86_64,(none),1017329,4386e1c8c70ffbcddd2c8e2ecaf3fda2,1428073993\nlua,5.3.0,2.fc22,x86_64,(none),864227,52b2febc868e57c35d6c0159535ba52a,1426857011\nlibffi,3.1,7.fc22,x86_64,(none),48764,1c0ff0e068dad7e6909faa6b82f70efb,1421289776\nchkconfig,1.4,1.fc22,x86_64,(none),742470,4f69407e34fe783cc28d0cd2ed5248cc,1427712261\np11-kit,0.23.1,1.fc22,x86_64,(none),496554,39ba0e0653e3fc82551580b3b5202d6a,1424465130\nnss-softokn,3.18.0,1.fc22,x86_64,(none),1117934,9c526169adeba7953e67e0b0490eed72,1426867670\nlibsolv,0.6.10,1.fc22,x86_64,(none),746362,c612191850040b6de7ba644c908a3c3d,1427450973\nlibidn,1.29,3.fc22,x86_64,(none),600556,3efd58d864207fa784b8e1e86c97c117,1427812536\nlibnfnetlink,1.0.1,6.fc22,x86_64,(none),46619,a1473c1214ee836e9baac733174a5446,1408276103\nlibcap-ng,0.7.5,1.fc22,x86_64,(none),50374,56b9e01a818314aa75b2d0da4cf4705d,1431022071\nhawkey,0.5.6,1.fc22,x86_64,(none),144994,c68d8efdd132805ffbbdd60db7f62e97,1431006659\nlibcomps,0.1.6,14.fc22,x86_64,(none),204755,2bbf1d38c87d4ee02d1556b4201fe033,1408267154\nlibss,1.42.12,4.fc22,x86_64,(none),72729,e123e6b352c3d3c2bff213b82e5d128e,1430444535\nlibmetalink,0.1.2,7.fc22,x86_64,(none),68232,7512e6432df4b5e7b1b7f1c4357d02c6,1408274614\nlibdb-utils,5.3.28,9.fc22,x86_64,(none),303160,ce6cbd462d10900a34cee9e8f35d0b57,1408268990\ndiffutils,3.3,9.fc22,x86_64,(none),1073548,32bcaf2c3952ba84fff4c69c53c00b1d,1408169683\nfile-libs,5.22,3.fc22,x86_64,(none),4000750,4dc7338ee7e6186dfe714f7be9d46f94,1430291029\ngmp,6.0.0,9.fc22,x86_64,1,651685,e4384f37940cacf93b808bed58641153,1427989243\nlibxkbcommon,0.5.0,1.fc22,x86_64,(none),274464,6fc1ee5aac34c2a4c5db3e056596b749,1413994202\nustr,1.0.4,18.fc22,x86_64,(none),294991,cf6bfd3f659fb21168243bc8532becf1,1408410168\nkeyutils-libs,1.5.9,4.fc22,x86_64,(none),55142,090face8d1793ca18052e88008e36052,1408250711\nnpth,1.2,1.fc22,x86_64,(none),45546,db7645e1d5158e203c861be272804dbd,1429535820\nlibmnl,1.0.3,9.fc22,x86_64,(none),51503,e0d19f725c10ab408308d3478c195a1b,1408274518\niptables,1.4.21,14.fc22,x86_64,(none),1579944,75fea1c1587a9b50dde6017a7db8b18a,1417435111\nlibsmartcols,2.26.2,1.fc22,x86_64,(none),173802,df3074d486f996d58c9011ae11ec8b1a,1430391777\np11-kit-trust,0.23.1,1.fc22,x86_64,(none),430488,7c8c256d5dfa6aa54d0b5fbf5b5774b5,1424465130\nopenssl-libs,1.0.1k,8.fc22,x86_64,1,2658876,f330cc1c7a8c1fb1cd6ea915b8f4676f,1430399948\nca-certificates,2015.2.4,1.0.fc22,noarch,(none),1186255,7a66af3ac04846640865b131b17b3937,1430850517\npython-libs,2.7.9,6.fc22,x86_64,(none),25158969,a1d52750ee7c896cb680ff55d39df5c0,1429101737\nlibblkid,2.26.2,1.fc22,x86_64,(none),273320,e6e942e10d658250422b4e424514b8fa,1430391777\nlibmount,2.26.2,1.fc22,x86_64,(none),324330,e55c3685e19ba73ddf3a9152b363cdfa,1430391777\nlibfdisk,2.26.2,1.fc22,x86_64,(none),384018,7fe563dfb6a51e49327e75ede7dd8b46,1430391777\npython-hawkey,0.5.6,1.fc22,x86_64,(none),148981,876e237f7b7ab2cbcaa5a854c3989194,1431006659\npython-six,1.9.0,1.fc22,noarch,(none),99018,2c56482e6bbdcdd69a90369b550d7732,1425899883\ngzip,1.6,6.fc22,x86_64,(none),318281,6491eefd4795527d79afff93a372b32a,1409063636\ncracklib-dicts,2.9.1,5.fc22,x86_64,(none),9389116,69bc04b561ed904037bf72c36b58462d,1408162574\nlibpwquality,1.2.4,2.fc22,x86_64,(none),333534,be2afadd2d64cbfbf66b424744bfc0c5,1408278427\nnss,3.18.0,1.fc22,x86_64,(none),2612158,5070459cf44f11a173204f0fac59c232,1426871722\nnss-tools,3.18.0,1.fc22,x86_64,(none),1918262,549cbd61be3294dd9590016527912a07,1426871722\ngnupg2,2.1.2,2.fc22,x86_64,(none),7189617,1b4e2d050c85835e4a0526122ece56f8,1428656209\npygpgme,0.3,12.fc22,x86_64,(none),238515,531cd0347f4d56b0bbb4a7253ecd5657,1408345624\nglib2,2.44.1,1.fc22,x86_64,(none),11063438,f76fa165233d9bdcc8dbd6c05b84daeb,1431509971\nlibuser,0.60,6.fc22,x86_64,(none),1953424,486a925fab5b712e6bb4cdf3f7326c54,1408282568\nlibssh2,1.5.0,1.fc22,x86_64,(none),359640,58d7de89aca37431c64058a855c5f244,1426070746\ndevice-mapper,1.02.93,3.fc22,x86_64,(none),192388,fc565a9c591a2580b17e0a5803d1322c,1422638927\ncryptsetup-libs,1.6.7,1.fc22,x86_64,(none),723879,15f1e247e0d0ee12e29289a2540f8462,1428225281\ndbus,1.8.16,1.fc22,x86_64,1,979105,445114a2c885381cd90b13f6d819cb76,1423510571\nlibrepo,1.7.13,1.fc22,x86_64,(none),155947,610d83cb532394fdf344d469875c26c2,1422024837\nlibarchive,3.1.2,12.fc22,x86_64,(none),740787,2ab4d8f785323f9a13c1ef048947bee7,1430297056\nrpm-libs,4.12.0.1,9.fc22,x86_64,(none),620840,9d1010807f91e6a3154089f8ed13cc6b,1429089697\ndeltarpm,3.6,8.fc22,x86_64,(none),214687,6a2c058885078740409b85f211366d8e,1421217702\nrpm-build-libs,4.12.0.1,9.fc22,x86_64,(none),166776,23e81aff3d7c5e363b1d3d356f182041,1429089697\npython-dnf,1.0.0,1.fc22,noarch,(none),1905093,50d9e137532bbcd51adc628a0130963b,1430571608\ndnf-yum,1.0.0,1.fc22,noarch,(none),24841,3237285cbe626d9b3b233f40ccc969bc,1430571608\ne2fsprogs,1.42.12,4.fc22,x86_64,(none),3003807,b9b79759b100cad845b7d8e004fce64f,1430444535\nrootfiles,8.1,17.fc21,noarch,(none),599,e9f1f3dac9b440c2156a66eddc35f909,1402212160\nlibgcc,5.1.1,1.fc22,x86_64,(none),183368,2daecefe22a5b96fa4393ba6dd6b5837,1429734590\nfedora-release,22,1,noarch,(none),4235,d91558d63d5aa15374f559bb1afcd12d,1432045630\nfilesystem,3.2,32.fc22,x86_64,(none),0,f49bd00613e7e51bc6d3559baae0cc68,1408195967\nlibreport-filesystem,2.5.1,1.fc22,x86_64,(none),0,5cb73843e2289324af75d40946fcff92,1428561525\ntzdata,2015d,1.fc22,noarch,(none),1644030,e834fc7e5e7135e54ebbcfc9ca233b8f,1430190469\nncurses-base,5.9,18.20150214.fc22,noarch,(none),246829,caf6152ababc48e199e64620e0f0d4aa,1424449040\nnss-softokn-freebl,3.18.0,1.fc22,x86_64,(none),521055,9339a991cfdb7cdef717e8d79451acf2,1426867670\nlibstdc++,5.1.1,1.fc22,x86_64,(none),1728084,98cd86a386062c04b9f4ad9b8d365d4e,1429734590\nbash,4.3.33,2.fc22,x86_64,(none),7155962,7e35b3cb74112c21a528dc468c07c1a8,1422029026\npcre,8.37,1.fc22,x86_64,(none),1674885,6b2636121ae2698fa5da07d6b87ed3f2,1430226425\nzlib,1.2.8,7.fc22,x86_64,(none),188155,3ddfcdbd91a0a4a6ef7f04cb3f36c1df,1408431203\nbzip2-libs,1.0.6,14.fc22,x86_64,(none),69829,46751433258eb55f0a5a13e4d8b725d0,1408152466\nlibdb,5.3.28,9.fc22,x86_64,(none),1888520,307580e0ca7e6bdb0f99c97a140a44ca,1408268990\nnspr,4.10.8,1.fc22,x86_64,(none),301230,78511358716d695cac7d0bd766372c1e,1422575653\nnss-util,3.18.0,1.fc22,x86_64,(none),199596,f603494b789bca34aaec99323540a41e,1426864636\npopt,1.16,5.fc22,x86_64,(none),126214,e0b265e6a5621512739e7f3ab363c259,1408340355\nlibacl,2.2.52,7.fc22,x86_64,(none),36600,6f8d43aeb05a58b75c1c13ed26bfdfee,1408137801\nlibcom_err,1.42.12,4.fc22,x86_64,(none),60233,9b40d0c3dd903c3a776c29dcb56bf816,1430444535\naudit-libs,2.4.2,1.fc22,x86_64,(none),236532,146e38d6bfcc4235884fa7e058a7f7ab,1430253368\nreadline,6.3,5.fc22,x86_64,(none),494939,005325df68633ebd9b36029a7bdbac3c,1408365488\nlibxml2,2.9.2,3.fc22,x86_64,(none),1727890,ac02080e61496187a20b084d38c1e1f2,1424271994\nsed,4.2.2,9.fc22,x86_64,(none),605545,26e10d79e2d0f4c4a4d15f17d4e97367,1408380126\ngrep,2.21,5.fc22,x86_64,(none),1262823,6ebca219a7e691041710f701f6033c8f,1428398413\nsqlite,3.8.9,1.fc22,x86_64,(none),935875,519ce8fb5f044470ce6963f0feeab0cd,1429003733\nelfutils-libs,0.161,6.fc22,x86_64,(none),710895,e3d710921b0b34d1bf158dd44093ea08,1425978586\nlibassuan,2.2.0,1.fc22,x86_64,(none),164618,ac28a767a31e0b54cde9aae9bf7869a0,1418999828\nkmod-libs,20,1.fc22,x86_64,(none),118112,2d2bef588c32b051cfcfcf2bb5b957ac,1425306281\ndbus-libs,1.8.16,1.fc22,x86_64,1,335864,275c8eefcec8bc443627bfe332fe5f01,1423510571\nkmod,20,1.fc22,x86_64,(none),207940,d9414f284dd3c3cd75e66afc48b9fdd3,1425306281\npinentry,0.9.1,1.fc22,x86_64,(none),112762,ab3d0dc736bf2a73faaa9e3d99d23cbe,1427312677\ne2fsprogs-libs,1.42.12,4.fc22,x86_64,(none),361897,0af85c4cbd59d23684585ba0e1ebd982,1430444535\nacl,2.2.52,7.fc22,x86_64,(none),189312,4e286726cf67ddb6c496a019a53f656a,1408137801\nlibksba,1.3.2,1.fc22,x86_64,(none),318478,0d85f4840d0099841fd64afd64860963,1417004901\ncyrus-sasl-lib,2.1.26,22.fc22,x86_64,(none),395343,9ed3d368bef4b6048d798880c0ddb1b0,1426523519\ngawk,4.1.1,6.fc22,x86_64,(none),2255738,e952c3e4bd5e96fb44bd86528b1781ff,1420212223\nncurses,5.9,18.20150214.fc22,x86_64,(none),451749,00cd8ef0169eb9ca92c20d5cb54c8389,1424448611\nlibseccomp,2.2.0,0.fc22,x86_64,(none),215242,3fcd5a77fbe7b6856b5069940adc8166,1424100824\nqrencode-libs,3.4.2,4.fc22,x86_64,(none),127918,90b684d658644656c9e84e29d0baae97,1408356554\nlibsemanage,2.3,6.fc22,x86_64,(none),251332,319fe99d5ab566feb2329c6edb17d8ae,1408279593\nlibverto,0.2.6,4.fc22,x86_64,(none),22804,71ac4eed13cfd100c9cb9c205c0db0fd,1408282096\ngdbm,1.11,4.fc22,x86_64,(none),381511,bab745ac6a8bd8d696f911c4091892fb,1408205700\nlibnetfilter_conntrack,1.0.4,4.fc22,x86_64,(none),138286,53fadc1ba11e0c298eb4c5d0b6864ff8,1408276161\nlzo,2.08,3.fc22,x86_64,(none),169709,36ca006519a8193819743c38572fb759,1408290599\nlibtasn1,4.5,1.fc22,x86_64,(none),421320,79319d7c572fcffb1b9906b0f0fce3b3,1430380575\nkrb5-libs,1.13.1,3.fc22,x86_64,(none),2286457,d57b1e21fe7df47809947d7902fed223,1430871086\ncoreutils,8.23,9.fc22,x86_64,(none),16324406,5cdca192845b4d124922f8590f102a25,1429541013\ncrypto-policies,20150305,2.git44afaa1.fc22,noarch,(none),40158,de2a35daa0fa3eb514eb74f90cf4fef3,1425639325\npython,2.7.9,6.fc22,x86_64,(none),79553,b3ff5a133956c02ea8f799f7d6e1434d,1429101737\nshadow-utils,4.2.1,1.fc22,x86_64,2,3711884,bca4896520780a4121320d9032310486,1417014272\nlibutempter,1.1.6,6.fc22,x86_64,(none),49757,f8c1f5fd313a3a150f2a2c8b14d1c5a5,1408281489\npyliblzma,0.5.3,13.fc22,x86_64,(none),198352,5e29b68f0ec46372fd17fa8713337141,1408344571\npython-libcomps,0.1.6,14.fc22,x86_64,(none),143380,80b028706911436dacdfedab86d0d60f,1408267154\npython-iniparse,0.4,15.fc22,noarch,(none),116198,fc2ee5738aade0ded608421f0a47394b,1406817743\ncracklib,2.9.1,5.fc22,x86_64,(none),209978,d43177a41fdd04450a66a3ef262b14ae,1408162574\npam,1.1.8,18.fc22,x86_64,(none),2637337,0839b4995da7b65b4ce9235e6d9e3809,1413541275\nsystemd-libs,219,13.fc22,x86_64,(none),1125568,144a9950fcdfb09a687ee92da97c17a9,1430317607\nnss-sysinit,3.18.0,1.fc22,x86_64,(none),13984,f7ac717c67020893e6e3858b50389bee,1426871722\nopenldap,2.4.40,12.fc22,x86_64,(none),992221,d49479f8b947346aae3b16fa2ace6e26,1430142582\ngpgme,1.4.3,5.fc22,x86_64,(none),607071,85d6ed868865dea6618c7ebc5275ddb5,1417838838\npkgconfig,0.28,8.fc22,x86_64,1,107920,49b9ff6f28962ded92e470a09c121146,1429298835\nshared-mime-info,1.4,2.fc22,x86_64,(none),2123110,2a186e493108a628d060d6339524865d,1423149713\nutil-linux,2.26.2,1.fc22,x86_64,(none),8978494,8dca268037a64736bad953b6494ca2c8,1430391777\nlibcurl,7.40.0,3.fc22,x86_64,(none),498308,0ac103d3c6450f227622552aba4bf0e0,1429709888\ndevice-mapper-libs,1.02.93,3.fc22,x86_64,(none),346908,a137a4620f31d18e9fdced0b07070739,1422638927\nsystemd,219,13.fc22,x86_64,(none),25514617,0be8a3814da5545f80beac320cb6d0e6,1430317607\ncurl,7.40.0,3.fc22,x86_64,(none),556943,135e6ab07141cdd8137e9bde2af1278d,1429709888\npython-librepo,1.7.13,1.fc22,x86_64,(none),145903,74a8048f1ae99b08e581e7bab22bda14,1422024837\nrpm-plugin-selinux,4.12.0.1,9.fc22,x86_64,(none),11504,2f98df94b412264db07f99b4b59dfdea,1429089697\nrpm,4.12.0.1,9.fc22,x86_64,(none),1967009,4ced0dd550667b4279df8d66733224af,1429089697\nrpm-plugin-systemd-inhibit,4.12.0.1,9.fc22,x86_64,(none),11384,9da731676612e9e63f9213564c599180,1429089697\nrpm-python,4.12.0.1,9.fc22,x86_64,(none),169585,9b25fd50ad23da16c302679958deac86,1429089697\ndnf,1.0.0,1.fc22,noarch,(none),724399,baed7804534a7eb0789afd1b0a1eb535,1430571608\nbash-completion,2.1,6.20141110git52d8316.fc22,noarch,1,851628,c3431145e46047a2d320e71443dad93d,1415654944\nvim-minimal,7.4.640,4.fc22,x86_64,2,943934,2dd93d2089331509d83152fff631bdef,1425285494\ngpg-pubkey,8e1431d5,53bcbac7,(none),(none),0,(none),1404877511" ++ }, ++ "creationTimestamp": "2015-08-21T10:12:40Z", ++ "labels": { ++ "buildconfig": "build-20150821111239", ++ "is_autorebuild": "false" ++ }, ++ "name": "test-build-cancel-123", ++ "namespace": "default", ++ "resourceVersion": "696", ++ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123", ++ "uid": "27ccd290-47ed-11e5-969c-52540080e6f8" ++ }, ++ "spec": { ++ "output": { ++ "to": { ++ "kind": "DockerImage", ++ "name": "localhost:5000/twaugh/component:20150821111239" ++ } ++ }, ++ "resources": {}, ++ "source": { ++ "git": { ++ "ref": "master", ++ "uri": "https://github.com/TomasTomecek/docker-hello-world.git" ++ }, ++ "type": "Git" ++ }, ++ "strategy": { ++ "customStrategy": { ++ "env": [ ++ { ++ "name": "ATOMIC_REACTOR_PLUGINS", ++ "value": "{\"prebuild_plugins\": [{\"args\": {}, \"name\": \"pull_base_image\"}, {\"name\": \"change_from_in_dockerfile\"}, {\"name\": \"dockerfile_content\"}], \"exit_plugins\": [{\"args\": {\"url\": \"https://osbs.localdomain:8443/\", \"verify_ssl\": false, \"use_auth\": false}, \"name\": \"store_metadata_in_osv3\"}, {\"name\": \"remove_built_image\"}], \"postbuild_plugins\": [{\"args\": {\"image_id\": \"BUILT_IMAGE_ID\"}, \"name\": \"all_rpm_packages\"}]}" ++ }, ++ { ++ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE", ++ "value": "buildroot:latest" ++ } ++ ], ++ "exposeDockerSocket": true, ++ "from": { ++ "kind": "DockerImage", ++ "name": "buildroot:latest" ++ } ++ }, ++ "type": "Custom" ++ } ++ }, ++ "status": { ++ "completionTimestamp": "2015-08-21T10:13:00Z", ++ "config": { ++ "kind": "BuildConfig", ++ "name": "build-20150821111239", ++ "namespace": "default" ++ }, ++ "duration": 19000000000, ++ "phase": "Cancelled", ++ "startTimestamp": "2015-08-21T10:12:41Z" ++ } ++} +diff --git a/tests/mock_jsons/1.0.4/build_test-build-cancel-123_get.json b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_get.json +new file mode 100644 +index 0000000..6911da8 +--- /dev/null ++++ b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_get.json +@@ -0,0 +1,72 @@ ++{ ++ "apiVersion": "v1", ++ "kind": "Build", ++ "metadata": { ++ "annotations": { ++ "artefacts": "", ++ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11", ++ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n", ++ "logs": "{\"stream\":\"Step 0 : FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\\n\"}\r\n\n{\"stream\":\" ---\\u003e ded7cd95e059\\n\"}\r\n\n{\"stream\":\"Step 1 : RUN uname -a \\u0026\\u0026 env\\n\"}\r\n\n{\"stream\":\" ---\\u003e Running in 00efb35008aa\\n\"}\r\n\n{\"stream\":\"Linux 76cf7f67d83a 3.10.0-229.7.2.el7.x86_64 #1 SMP Fri May 15 21:38:46 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux\\n\"}\r\n\n{\"stream\":\"HOSTNAME=76cf7f67d83a\\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\nPWD=/\\ncontainer_uuid=00efb350-08aa-c27a-7fe2-a9d9d15fc432\\nSHLVL=1\\nHOME=/root\\n_=/usr/bin/env\\n\"}\r\n\n{\"stream\":\" ---\\u003e ed4cf0271479\\n\"}\r\n\n{\"stream\":\"Removing intermediate container 00efb35008aa\\n\"}\r\n\n{\"stream\":\"Successfully built ed4cf0271479\\n\"}\r\n", ++ "repositories": "{\"unique\": [], \"primary\": []}", ++ "rpm-packages": "fedora-repos,22,1,noarch,(none),14147,738a42f51d801fa81537053e69489726,1432046662\nsetup,2.9.6,1.fc22,noarch,(none),704610,02a24708ecd4eac5e67e9c6c95db8e9a,1424705275\nbasesystem,10.0,10.fc21,noarch,(none),0,339071e9aea0d207cecfb3a2e94e2dba,1402110694\ndnf-conf,1.0.0,1.fc22,noarch,(none),32588,4c5bc19884f72f22955660714dc17cc2,1430571608\nxkeyboard-config,2.14,1.fc22,noarch,(none),5404890,c7ca07bdb23899730d406c5c2fb66340,1422495744\nglibc-common,2.21,5.fc22,x86_64,(none),122172241,ef0cb554680cabf2ab3d2a134e7e629c,1424707226\nglibc,2.21,5.fc22,x86_64,(none),14073696,7778017d7a207d79dfd51440c9dd990b,1424707226\nncurses-libs,5.9,18.20150214.fc22,x86_64,(none),988392,8d54c82610ad0f880c4f005ea08445c3,1424448611\nlibsepol,2.3,4.fc22,x86_64,(none),314104,dc960564e0e81f40fd717cd8b590fe62,1408279400\nlibselinux,2.3,9.fc22,x86_64,(none),157786,912d8cabde7091b414b946cecc32a6f2,1429779516\nxz-libs,5.2.0,2.fc22,x86_64,(none),159830,0dc2757f9c180971c87aaffd04c1bef5,1423059095\ninfo,5.2,8.fc22,x86_64,(none),380275,840e5f4a9aff9acd32ddec88211955b2,1422881539\nlibgpg-error,1.17,2.fc22,x86_64,(none),436521,8e55ec056bd135cf003e430c9584c134,1422632222\nexpat,2.1.0,10.fc22,x86_64,(none),207963,5fb825e2f638d632dc874d379b44c163,1408191327\nelfutils-libelf,0.161,6.fc22,x86_64,(none),974956,5841fa84feda1eb574d84b40355beffc,1425978586\nlibattr,2.4.47,9.fc22,x86_64,(none),20253,ff80c2cd1746bdb48a0eaea9fe93d9d1,1408145564\nlibcap,2.24,7.fc22,x86_64,(none),109693,15c077497a556b8de53073c95e5ed3bb,1408265628\nlibuuid,2.26.2,1.fc22,x86_64,(none),21608,0292eb9e5a5ebc1a5c1666c8f3f57ca9,1430391777\nlibgcrypt,1.6.3,4.fc22,x86_64,(none),1017329,4386e1c8c70ffbcddd2c8e2ecaf3fda2,1428073993\nlua,5.3.0,2.fc22,x86_64,(none),864227,52b2febc868e57c35d6c0159535ba52a,1426857011\nlibffi,3.1,7.fc22,x86_64,(none),48764,1c0ff0e068dad7e6909faa6b82f70efb,1421289776\nchkconfig,1.4,1.fc22,x86_64,(none),742470,4f69407e34fe783cc28d0cd2ed5248cc,1427712261\np11-kit,0.23.1,1.fc22,x86_64,(none),496554,39ba0e0653e3fc82551580b3b5202d6a,1424465130\nnss-softokn,3.18.0,1.fc22,x86_64,(none),1117934,9c526169adeba7953e67e0b0490eed72,1426867670\nlibsolv,0.6.10,1.fc22,x86_64,(none),746362,c612191850040b6de7ba644c908a3c3d,1427450973\nlibidn,1.29,3.fc22,x86_64,(none),600556,3efd58d864207fa784b8e1e86c97c117,1427812536\nlibnfnetlink,1.0.1,6.fc22,x86_64,(none),46619,a1473c1214ee836e9baac733174a5446,1408276103\nlibcap-ng,0.7.5,1.fc22,x86_64,(none),50374,56b9e01a818314aa75b2d0da4cf4705d,1431022071\nhawkey,0.5.6,1.fc22,x86_64,(none),144994,c68d8efdd132805ffbbdd60db7f62e97,1431006659\nlibcomps,0.1.6,14.fc22,x86_64,(none),204755,2bbf1d38c87d4ee02d1556b4201fe033,1408267154\nlibss,1.42.12,4.fc22,x86_64,(none),72729,e123e6b352c3d3c2bff213b82e5d128e,1430444535\nlibmetalink,0.1.2,7.fc22,x86_64,(none),68232,7512e6432df4b5e7b1b7f1c4357d02c6,1408274614\nlibdb-utils,5.3.28,9.fc22,x86_64,(none),303160,ce6cbd462d10900a34cee9e8f35d0b57,1408268990\ndiffutils,3.3,9.fc22,x86_64,(none),1073548,32bcaf2c3952ba84fff4c69c53c00b1d,1408169683\nfile-libs,5.22,3.fc22,x86_64,(none),4000750,4dc7338ee7e6186dfe714f7be9d46f94,1430291029\ngmp,6.0.0,9.fc22,x86_64,1,651685,e4384f37940cacf93b808bed58641153,1427989243\nlibxkbcommon,0.5.0,1.fc22,x86_64,(none),274464,6fc1ee5aac34c2a4c5db3e056596b749,1413994202\nustr,1.0.4,18.fc22,x86_64,(none),294991,cf6bfd3f659fb21168243bc8532becf1,1408410168\nkeyutils-libs,1.5.9,4.fc22,x86_64,(none),55142,090face8d1793ca18052e88008e36052,1408250711\nnpth,1.2,1.fc22,x86_64,(none),45546,db7645e1d5158e203c861be272804dbd,1429535820\nlibmnl,1.0.3,9.fc22,x86_64,(none),51503,e0d19f725c10ab408308d3478c195a1b,1408274518\niptables,1.4.21,14.fc22,x86_64,(none),1579944,75fea1c1587a9b50dde6017a7db8b18a,1417435111\nlibsmartcols,2.26.2,1.fc22,x86_64,(none),173802,df3074d486f996d58c9011ae11ec8b1a,1430391777\np11-kit-trust,0.23.1,1.fc22,x86_64,(none),430488,7c8c256d5dfa6aa54d0b5fbf5b5774b5,1424465130\nopenssl-libs,1.0.1k,8.fc22,x86_64,1,2658876,f330cc1c7a8c1fb1cd6ea915b8f4676f,1430399948\nca-certificates,2015.2.4,1.0.fc22,noarch,(none),1186255,7a66af3ac04846640865b131b17b3937,1430850517\npython-libs,2.7.9,6.fc22,x86_64,(none),25158969,a1d52750ee7c896cb680ff55d39df5c0,1429101737\nlibblkid,2.26.2,1.fc22,x86_64,(none),273320,e6e942e10d658250422b4e424514b8fa,1430391777\nlibmount,2.26.2,1.fc22,x86_64,(none),324330,e55c3685e19ba73ddf3a9152b363cdfa,1430391777\nlibfdisk,2.26.2,1.fc22,x86_64,(none),384018,7fe563dfb6a51e49327e75ede7dd8b46,1430391777\npython-hawkey,0.5.6,1.fc22,x86_64,(none),148981,876e237f7b7ab2cbcaa5a854c3989194,1431006659\npython-six,1.9.0,1.fc22,noarch,(none),99018,2c56482e6bbdcdd69a90369b550d7732,1425899883\ngzip,1.6,6.fc22,x86_64,(none),318281,6491eefd4795527d79afff93a372b32a,1409063636\ncracklib-dicts,2.9.1,5.fc22,x86_64,(none),9389116,69bc04b561ed904037bf72c36b58462d,1408162574\nlibpwquality,1.2.4,2.fc22,x86_64,(none),333534,be2afadd2d64cbfbf66b424744bfc0c5,1408278427\nnss,3.18.0,1.fc22,x86_64,(none),2612158,5070459cf44f11a173204f0fac59c232,1426871722\nnss-tools,3.18.0,1.fc22,x86_64,(none),1918262,549cbd61be3294dd9590016527912a07,1426871722\ngnupg2,2.1.2,2.fc22,x86_64,(none),7189617,1b4e2d050c85835e4a0526122ece56f8,1428656209\npygpgme,0.3,12.fc22,x86_64,(none),238515,531cd0347f4d56b0bbb4a7253ecd5657,1408345624\nglib2,2.44.1,1.fc22,x86_64,(none),11063438,f76fa165233d9bdcc8dbd6c05b84daeb,1431509971\nlibuser,0.60,6.fc22,x86_64,(none),1953424,486a925fab5b712e6bb4cdf3f7326c54,1408282568\nlibssh2,1.5.0,1.fc22,x86_64,(none),359640,58d7de89aca37431c64058a855c5f244,1426070746\ndevice-mapper,1.02.93,3.fc22,x86_64,(none),192388,fc565a9c591a2580b17e0a5803d1322c,1422638927\ncryptsetup-libs,1.6.7,1.fc22,x86_64,(none),723879,15f1e247e0d0ee12e29289a2540f8462,1428225281\ndbus,1.8.16,1.fc22,x86_64,1,979105,445114a2c885381cd90b13f6d819cb76,1423510571\nlibrepo,1.7.13,1.fc22,x86_64,(none),155947,610d83cb532394fdf344d469875c26c2,1422024837\nlibarchive,3.1.2,12.fc22,x86_64,(none),740787,2ab4d8f785323f9a13c1ef048947bee7,1430297056\nrpm-libs,4.12.0.1,9.fc22,x86_64,(none),620840,9d1010807f91e6a3154089f8ed13cc6b,1429089697\ndeltarpm,3.6,8.fc22,x86_64,(none),214687,6a2c058885078740409b85f211366d8e,1421217702\nrpm-build-libs,4.12.0.1,9.fc22,x86_64,(none),166776,23e81aff3d7c5e363b1d3d356f182041,1429089697\npython-dnf,1.0.0,1.fc22,noarch,(none),1905093,50d9e137532bbcd51adc628a0130963b,1430571608\ndnf-yum,1.0.0,1.fc22,noarch,(none),24841,3237285cbe626d9b3b233f40ccc969bc,1430571608\ne2fsprogs,1.42.12,4.fc22,x86_64,(none),3003807,b9b79759b100cad845b7d8e004fce64f,1430444535\nrootfiles,8.1,17.fc21,noarch,(none),599,e9f1f3dac9b440c2156a66eddc35f909,1402212160\nlibgcc,5.1.1,1.fc22,x86_64,(none),183368,2daecefe22a5b96fa4393ba6dd6b5837,1429734590\nfedora-release,22,1,noarch,(none),4235,d91558d63d5aa15374f559bb1afcd12d,1432045630\nfilesystem,3.2,32.fc22,x86_64,(none),0,f49bd00613e7e51bc6d3559baae0cc68,1408195967\nlibreport-filesystem,2.5.1,1.fc22,x86_64,(none),0,5cb73843e2289324af75d40946fcff92,1428561525\ntzdata,2015d,1.fc22,noarch,(none),1644030,e834fc7e5e7135e54ebbcfc9ca233b8f,1430190469\nncurses-base,5.9,18.20150214.fc22,noarch,(none),246829,caf6152ababc48e199e64620e0f0d4aa,1424449040\nnss-softokn-freebl,3.18.0,1.fc22,x86_64,(none),521055,9339a991cfdb7cdef717e8d79451acf2,1426867670\nlibstdc++,5.1.1,1.fc22,x86_64,(none),1728084,98cd86a386062c04b9f4ad9b8d365d4e,1429734590\nbash,4.3.33,2.fc22,x86_64,(none),7155962,7e35b3cb74112c21a528dc468c07c1a8,1422029026\npcre,8.37,1.fc22,x86_64,(none),1674885,6b2636121ae2698fa5da07d6b87ed3f2,1430226425\nzlib,1.2.8,7.fc22,x86_64,(none),188155,3ddfcdbd91a0a4a6ef7f04cb3f36c1df,1408431203\nbzip2-libs,1.0.6,14.fc22,x86_64,(none),69829,46751433258eb55f0a5a13e4d8b725d0,1408152466\nlibdb,5.3.28,9.fc22,x86_64,(none),1888520,307580e0ca7e6bdb0f99c97a140a44ca,1408268990\nnspr,4.10.8,1.fc22,x86_64,(none),301230,78511358716d695cac7d0bd766372c1e,1422575653\nnss-util,3.18.0,1.fc22,x86_64,(none),199596,f603494b789bca34aaec99323540a41e,1426864636\npopt,1.16,5.fc22,x86_64,(none),126214,e0b265e6a5621512739e7f3ab363c259,1408340355\nlibacl,2.2.52,7.fc22,x86_64,(none),36600,6f8d43aeb05a58b75c1c13ed26bfdfee,1408137801\nlibcom_err,1.42.12,4.fc22,x86_64,(none),60233,9b40d0c3dd903c3a776c29dcb56bf816,1430444535\naudit-libs,2.4.2,1.fc22,x86_64,(none),236532,146e38d6bfcc4235884fa7e058a7f7ab,1430253368\nreadline,6.3,5.fc22,x86_64,(none),494939,005325df68633ebd9b36029a7bdbac3c,1408365488\nlibxml2,2.9.2,3.fc22,x86_64,(none),1727890,ac02080e61496187a20b084d38c1e1f2,1424271994\nsed,4.2.2,9.fc22,x86_64,(none),605545,26e10d79e2d0f4c4a4d15f17d4e97367,1408380126\ngrep,2.21,5.fc22,x86_64,(none),1262823,6ebca219a7e691041710f701f6033c8f,1428398413\nsqlite,3.8.9,1.fc22,x86_64,(none),935875,519ce8fb5f044470ce6963f0feeab0cd,1429003733\nelfutils-libs,0.161,6.fc22,x86_64,(none),710895,e3d710921b0b34d1bf158dd44093ea08,1425978586\nlibassuan,2.2.0,1.fc22,x86_64,(none),164618,ac28a767a31e0b54cde9aae9bf7869a0,1418999828\nkmod-libs,20,1.fc22,x86_64,(none),118112,2d2bef588c32b051cfcfcf2bb5b957ac,1425306281\ndbus-libs,1.8.16,1.fc22,x86_64,1,335864,275c8eefcec8bc443627bfe332fe5f01,1423510571\nkmod,20,1.fc22,x86_64,(none),207940,d9414f284dd3c3cd75e66afc48b9fdd3,1425306281\npinentry,0.9.1,1.fc22,x86_64,(none),112762,ab3d0dc736bf2a73faaa9e3d99d23cbe,1427312677\ne2fsprogs-libs,1.42.12,4.fc22,x86_64,(none),361897,0af85c4cbd59d23684585ba0e1ebd982,1430444535\nacl,2.2.52,7.fc22,x86_64,(none),189312,4e286726cf67ddb6c496a019a53f656a,1408137801\nlibksba,1.3.2,1.fc22,x86_64,(none),318478,0d85f4840d0099841fd64afd64860963,1417004901\ncyrus-sasl-lib,2.1.26,22.fc22,x86_64,(none),395343,9ed3d368bef4b6048d798880c0ddb1b0,1426523519\ngawk,4.1.1,6.fc22,x86_64,(none),2255738,e952c3e4bd5e96fb44bd86528b1781ff,1420212223\nncurses,5.9,18.20150214.fc22,x86_64,(none),451749,00cd8ef0169eb9ca92c20d5cb54c8389,1424448611\nlibseccomp,2.2.0,0.fc22,x86_64,(none),215242,3fcd5a77fbe7b6856b5069940adc8166,1424100824\nqrencode-libs,3.4.2,4.fc22,x86_64,(none),127918,90b684d658644656c9e84e29d0baae97,1408356554\nlibsemanage,2.3,6.fc22,x86_64,(none),251332,319fe99d5ab566feb2329c6edb17d8ae,1408279593\nlibverto,0.2.6,4.fc22,x86_64,(none),22804,71ac4eed13cfd100c9cb9c205c0db0fd,1408282096\ngdbm,1.11,4.fc22,x86_64,(none),381511,bab745ac6a8bd8d696f911c4091892fb,1408205700\nlibnetfilter_conntrack,1.0.4,4.fc22,x86_64,(none),138286,53fadc1ba11e0c298eb4c5d0b6864ff8,1408276161\nlzo,2.08,3.fc22,x86_64,(none),169709,36ca006519a8193819743c38572fb759,1408290599\nlibtasn1,4.5,1.fc22,x86_64,(none),421320,79319d7c572fcffb1b9906b0f0fce3b3,1430380575\nkrb5-libs,1.13.1,3.fc22,x86_64,(none),2286457,d57b1e21fe7df47809947d7902fed223,1430871086\ncoreutils,8.23,9.fc22,x86_64,(none),16324406,5cdca192845b4d124922f8590f102a25,1429541013\ncrypto-policies,20150305,2.git44afaa1.fc22,noarch,(none),40158,de2a35daa0fa3eb514eb74f90cf4fef3,1425639325\npython,2.7.9,6.fc22,x86_64,(none),79553,b3ff5a133956c02ea8f799f7d6e1434d,1429101737\nshadow-utils,4.2.1,1.fc22,x86_64,2,3711884,bca4896520780a4121320d9032310486,1417014272\nlibutempter,1.1.6,6.fc22,x86_64,(none),49757,f8c1f5fd313a3a150f2a2c8b14d1c5a5,1408281489\npyliblzma,0.5.3,13.fc22,x86_64,(none),198352,5e29b68f0ec46372fd17fa8713337141,1408344571\npython-libcomps,0.1.6,14.fc22,x86_64,(none),143380,80b028706911436dacdfedab86d0d60f,1408267154\npython-iniparse,0.4,15.fc22,noarch,(none),116198,fc2ee5738aade0ded608421f0a47394b,1406817743\ncracklib,2.9.1,5.fc22,x86_64,(none),209978,d43177a41fdd04450a66a3ef262b14ae,1408162574\npam,1.1.8,18.fc22,x86_64,(none),2637337,0839b4995da7b65b4ce9235e6d9e3809,1413541275\nsystemd-libs,219,13.fc22,x86_64,(none),1125568,144a9950fcdfb09a687ee92da97c17a9,1430317607\nnss-sysinit,3.18.0,1.fc22,x86_64,(none),13984,f7ac717c67020893e6e3858b50389bee,1426871722\nopenldap,2.4.40,12.fc22,x86_64,(none),992221,d49479f8b947346aae3b16fa2ace6e26,1430142582\ngpgme,1.4.3,5.fc22,x86_64,(none),607071,85d6ed868865dea6618c7ebc5275ddb5,1417838838\npkgconfig,0.28,8.fc22,x86_64,1,107920,49b9ff6f28962ded92e470a09c121146,1429298835\nshared-mime-info,1.4,2.fc22,x86_64,(none),2123110,2a186e493108a628d060d6339524865d,1423149713\nutil-linux,2.26.2,1.fc22,x86_64,(none),8978494,8dca268037a64736bad953b6494ca2c8,1430391777\nlibcurl,7.40.0,3.fc22,x86_64,(none),498308,0ac103d3c6450f227622552aba4bf0e0,1429709888\ndevice-mapper-libs,1.02.93,3.fc22,x86_64,(none),346908,a137a4620f31d18e9fdced0b07070739,1422638927\nsystemd,219,13.fc22,x86_64,(none),25514617,0be8a3814da5545f80beac320cb6d0e6,1430317607\ncurl,7.40.0,3.fc22,x86_64,(none),556943,135e6ab07141cdd8137e9bde2af1278d,1429709888\npython-librepo,1.7.13,1.fc22,x86_64,(none),145903,74a8048f1ae99b08e581e7bab22bda14,1422024837\nrpm-plugin-selinux,4.12.0.1,9.fc22,x86_64,(none),11504,2f98df94b412264db07f99b4b59dfdea,1429089697\nrpm,4.12.0.1,9.fc22,x86_64,(none),1967009,4ced0dd550667b4279df8d66733224af,1429089697\nrpm-plugin-systemd-inhibit,4.12.0.1,9.fc22,x86_64,(none),11384,9da731676612e9e63f9213564c599180,1429089697\nrpm-python,4.12.0.1,9.fc22,x86_64,(none),169585,9b25fd50ad23da16c302679958deac86,1429089697\ndnf,1.0.0,1.fc22,noarch,(none),724399,baed7804534a7eb0789afd1b0a1eb535,1430571608\nbash-completion,2.1,6.20141110git52d8316.fc22,noarch,1,851628,c3431145e46047a2d320e71443dad93d,1415654944\nvim-minimal,7.4.640,4.fc22,x86_64,2,943934,2dd93d2089331509d83152fff631bdef,1425285494\ngpg-pubkey,8e1431d5,53bcbac7,(none),(none),0,(none),1404877511" ++ }, ++ "creationTimestamp": "2015-08-20T16:41:05Z", ++ "labels": { ++ "buildconfig": "build-20150820174104", ++ "is_autorebuild": "false" ++ }, ++ "name": "test-build-cancel-123", ++ "namespace": "default", ++ "resourceVersion": "2958", ++ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123", ++ "uid": "3ff4b700-475a-11e5-acf2-52540080e6f8" ++ }, ++ "spec": { ++ "output": { ++ "to": { ++ "kind": "DockerImage", ++ "name": "localhost:5000/twaugh/component:20150820174104" ++ } ++ }, ++ "resources": {}, ++ "serviceAccount": "builder", ++ "source": { ++ "git": { ++ "ref": "master", ++ "uri": "https://github.com/TomasTomecek/docker-hello-world.git" ++ }, ++ "type": "Git" ++ }, ++ "strategy": { ++ "customStrategy": { ++ "env": [ ++ { ++ "name": "ATOMIC_REACTOR_PLUGINS", ++ "value": "{\"prebuild_plugins\": [{\"args\": {}, \"name\": \"pull_base_image\"}, {\"name\": \"change_from_in_dockerfile\"}, {\"name\": \"dockerfile_content\"}], \"exit_plugins\": [{\"args\": {\"url\": \"https://osbs.localdomain:8443/\", \"verify_ssl\": false, \"use_auth\": false}, \"name\": \"store_metadata_in_osv3\"}, {\"name\": \"remove_built_image\"}], \"postbuild_plugins\": [{\"args\": {\"image_id\": \"BUILT_IMAGE_ID\"}, \"name\": \"all_rpm_packages\"}]}" ++ }, ++ { ++ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE", ++ "value": "buildroot:latest" ++ } ++ ], ++ "exposeDockerSocket": true, ++ "from": { ++ "kind": "DockerImage", ++ "name": "buildroot:latest" ++ } ++ }, ++ "type": "Custom" ++ } ++ }, ++ "status": { ++ "completionTimestamp": "2015-08-20T16:41:45Z", ++ "config": { ++ "kind": "BuildConfig", ++ "name": "test-build-cancel-123", ++ "namespace": "default" ++ }, ++ "duration": 39000000000, ++ "phase": "Running", ++ "startTimestamp": "2015-08-20T16:41:06Z" ++ } ++} +diff --git a/tests/mock_jsons/1.0.4/build_test-build-cancel-123_put.json b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_put.json +new file mode 100644 +index 0000000..53db8c0 +--- /dev/null ++++ b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_put.json +@@ -0,0 +1,72 @@ ++{ ++ "apiVersion": "v1", ++ "kind": "Build", ++ "metadata": { ++ "annotations": { ++ "artefacts": "", ++ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11", ++ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n", ++ "logs": "{\"stream\":\"Step 0 : FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\\n\"}\r\n\n{\"stream\":\" ---\\u003e ded7cd95e059\\n\"}\r\n\n{\"stream\":\"Step 1 : RUN uname -a \\u0026\\u0026 env\\n\"}\r\n\n{\"stream\":\" ---\\u003e Running in 00efb35008aa\\n\"}\r\n\n{\"stream\":\"Linux 76cf7f67d83a 3.10.0-229.7.2.el7.x86_64 #1 SMP Fri May 15 21:38:46 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux\\n\"}\r\n\n{\"stream\":\"HOSTNAME=76cf7f67d83a\\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\nPWD=/\\ncontainer_uuid=00efb350-08aa-c27a-7fe2-a9d9d15fc432\\nSHLVL=1\\nHOME=/root\\n_=/usr/bin/env\\n\"}\r\n\n{\"stream\":\" ---\\u003e ed4cf0271479\\n\"}\r\n\n{\"stream\":\"Removing intermediate container 00efb35008aa\\n\"}\r\n\n{\"stream\":\"Successfully built ed4cf0271479\\n\"}\r\n", ++ "repositories": "{\"unique\": [], \"primary\": []}", ++ "rpm-packages": "fedora-repos,22,1,noarch,(none),14147,738a42f51d801fa81537053e69489726,1432046662\nsetup,2.9.6,1.fc22,noarch,(none),704610,02a24708ecd4eac5e67e9c6c95db8e9a,1424705275\nbasesystem,10.0,10.fc21,noarch,(none),0,339071e9aea0d207cecfb3a2e94e2dba,1402110694\ndnf-conf,1.0.0,1.fc22,noarch,(none),32588,4c5bc19884f72f22955660714dc17cc2,1430571608\nxkeyboard-config,2.14,1.fc22,noarch,(none),5404890,c7ca07bdb23899730d406c5c2fb66340,1422495744\nglibc-common,2.21,5.fc22,x86_64,(none),122172241,ef0cb554680cabf2ab3d2a134e7e629c,1424707226\nglibc,2.21,5.fc22,x86_64,(none),14073696,7778017d7a207d79dfd51440c9dd990b,1424707226\nncurses-libs,5.9,18.20150214.fc22,x86_64,(none),988392,8d54c82610ad0f880c4f005ea08445c3,1424448611\nlibsepol,2.3,4.fc22,x86_64,(none),314104,dc960564e0e81f40fd717cd8b590fe62,1408279400\nlibselinux,2.3,9.fc22,x86_64,(none),157786,912d8cabde7091b414b946cecc32a6f2,1429779516\nxz-libs,5.2.0,2.fc22,x86_64,(none),159830,0dc2757f9c180971c87aaffd04c1bef5,1423059095\ninfo,5.2,8.fc22,x86_64,(none),380275,840e5f4a9aff9acd32ddec88211955b2,1422881539\nlibgpg-error,1.17,2.fc22,x86_64,(none),436521,8e55ec056bd135cf003e430c9584c134,1422632222\nexpat,2.1.0,10.fc22,x86_64,(none),207963,5fb825e2f638d632dc874d379b44c163,1408191327\nelfutils-libelf,0.161,6.fc22,x86_64,(none),974956,5841fa84feda1eb574d84b40355beffc,1425978586\nlibattr,2.4.47,9.fc22,x86_64,(none),20253,ff80c2cd1746bdb48a0eaea9fe93d9d1,1408145564\nlibcap,2.24,7.fc22,x86_64,(none),109693,15c077497a556b8de53073c95e5ed3bb,1408265628\nlibuuid,2.26.2,1.fc22,x86_64,(none),21608,0292eb9e5a5ebc1a5c1666c8f3f57ca9,1430391777\nlibgcrypt,1.6.3,4.fc22,x86_64,(none),1017329,4386e1c8c70ffbcddd2c8e2ecaf3fda2,1428073993\nlua,5.3.0,2.fc22,x86_64,(none),864227,52b2febc868e57c35d6c0159535ba52a,1426857011\nlibffi,3.1,7.fc22,x86_64,(none),48764,1c0ff0e068dad7e6909faa6b82f70efb,1421289776\nchkconfig,1.4,1.fc22,x86_64,(none),742470,4f69407e34fe783cc28d0cd2ed5248cc,1427712261\np11-kit,0.23.1,1.fc22,x86_64,(none),496554,39ba0e0653e3fc82551580b3b5202d6a,1424465130\nnss-softokn,3.18.0,1.fc22,x86_64,(none),1117934,9c526169adeba7953e67e0b0490eed72,1426867670\nlibsolv,0.6.10,1.fc22,x86_64,(none),746362,c612191850040b6de7ba644c908a3c3d,1427450973\nlibidn,1.29,3.fc22,x86_64,(none),600556,3efd58d864207fa784b8e1e86c97c117,1427812536\nlibnfnetlink,1.0.1,6.fc22,x86_64,(none),46619,a1473c1214ee836e9baac733174a5446,1408276103\nlibcap-ng,0.7.5,1.fc22,x86_64,(none),50374,56b9e01a818314aa75b2d0da4cf4705d,1431022071\nhawkey,0.5.6,1.fc22,x86_64,(none),144994,c68d8efdd132805ffbbdd60db7f62e97,1431006659\nlibcomps,0.1.6,14.fc22,x86_64,(none),204755,2bbf1d38c87d4ee02d1556b4201fe033,1408267154\nlibss,1.42.12,4.fc22,x86_64,(none),72729,e123e6b352c3d3c2bff213b82e5d128e,1430444535\nlibmetalink,0.1.2,7.fc22,x86_64,(none),68232,7512e6432df4b5e7b1b7f1c4357d02c6,1408274614\nlibdb-utils,5.3.28,9.fc22,x86_64,(none),303160,ce6cbd462d10900a34cee9e8f35d0b57,1408268990\ndiffutils,3.3,9.fc22,x86_64,(none),1073548,32bcaf2c3952ba84fff4c69c53c00b1d,1408169683\nfile-libs,5.22,3.fc22,x86_64,(none),4000750,4dc7338ee7e6186dfe714f7be9d46f94,1430291029\ngmp,6.0.0,9.fc22,x86_64,1,651685,e4384f37940cacf93b808bed58641153,1427989243\nlibxkbcommon,0.5.0,1.fc22,x86_64,(none),274464,6fc1ee5aac34c2a4c5db3e056596b749,1413994202\nustr,1.0.4,18.fc22,x86_64,(none),294991,cf6bfd3f659fb21168243bc8532becf1,1408410168\nkeyutils-libs,1.5.9,4.fc22,x86_64,(none),55142,090face8d1793ca18052e88008e36052,1408250711\nnpth,1.2,1.fc22,x86_64,(none),45546,db7645e1d5158e203c861be272804dbd,1429535820\nlibmnl,1.0.3,9.fc22,x86_64,(none),51503,e0d19f725c10ab408308d3478c195a1b,1408274518\niptables,1.4.21,14.fc22,x86_64,(none),1579944,75fea1c1587a9b50dde6017a7db8b18a,1417435111\nlibsmartcols,2.26.2,1.fc22,x86_64,(none),173802,df3074d486f996d58c9011ae11ec8b1a,1430391777\np11-kit-trust,0.23.1,1.fc22,x86_64,(none),430488,7c8c256d5dfa6aa54d0b5fbf5b5774b5,1424465130\nopenssl-libs,1.0.1k,8.fc22,x86_64,1,2658876,f330cc1c7a8c1fb1cd6ea915b8f4676f,1430399948\nca-certificates,2015.2.4,1.0.fc22,noarch,(none),1186255,7a66af3ac04846640865b131b17b3937,1430850517\npython-libs,2.7.9,6.fc22,x86_64,(none),25158969,a1d52750ee7c896cb680ff55d39df5c0,1429101737\nlibblkid,2.26.2,1.fc22,x86_64,(none),273320,e6e942e10d658250422b4e424514b8fa,1430391777\nlibmount,2.26.2,1.fc22,x86_64,(none),324330,e55c3685e19ba73ddf3a9152b363cdfa,1430391777\nlibfdisk,2.26.2,1.fc22,x86_64,(none),384018,7fe563dfb6a51e49327e75ede7dd8b46,1430391777\npython-hawkey,0.5.6,1.fc22,x86_64,(none),148981,876e237f7b7ab2cbcaa5a854c3989194,1431006659\npython-six,1.9.0,1.fc22,noarch,(none),99018,2c56482e6bbdcdd69a90369b550d7732,1425899883\ngzip,1.6,6.fc22,x86_64,(none),318281,6491eefd4795527d79afff93a372b32a,1409063636\ncracklib-dicts,2.9.1,5.fc22,x86_64,(none),9389116,69bc04b561ed904037bf72c36b58462d,1408162574\nlibpwquality,1.2.4,2.fc22,x86_64,(none),333534,be2afadd2d64cbfbf66b424744bfc0c5,1408278427\nnss,3.18.0,1.fc22,x86_64,(none),2612158,5070459cf44f11a173204f0fac59c232,1426871722\nnss-tools,3.18.0,1.fc22,x86_64,(none),1918262,549cbd61be3294dd9590016527912a07,1426871722\ngnupg2,2.1.2,2.fc22,x86_64,(none),7189617,1b4e2d050c85835e4a0526122ece56f8,1428656209\npygpgme,0.3,12.fc22,x86_64,(none),238515,531cd0347f4d56b0bbb4a7253ecd5657,1408345624\nglib2,2.44.1,1.fc22,x86_64,(none),11063438,f76fa165233d9bdcc8dbd6c05b84daeb,1431509971\nlibuser,0.60,6.fc22,x86_64,(none),1953424,486a925fab5b712e6bb4cdf3f7326c54,1408282568\nlibssh2,1.5.0,1.fc22,x86_64,(none),359640,58d7de89aca37431c64058a855c5f244,1426070746\ndevice-mapper,1.02.93,3.fc22,x86_64,(none),192388,fc565a9c591a2580b17e0a5803d1322c,1422638927\ncryptsetup-libs,1.6.7,1.fc22,x86_64,(none),723879,15f1e247e0d0ee12e29289a2540f8462,1428225281\ndbus,1.8.16,1.fc22,x86_64,1,979105,445114a2c885381cd90b13f6d819cb76,1423510571\nlibrepo,1.7.13,1.fc22,x86_64,(none),155947,610d83cb532394fdf344d469875c26c2,1422024837\nlibarchive,3.1.2,12.fc22,x86_64,(none),740787,2ab4d8f785323f9a13c1ef048947bee7,1430297056\nrpm-libs,4.12.0.1,9.fc22,x86_64,(none),620840,9d1010807f91e6a3154089f8ed13cc6b,1429089697\ndeltarpm,3.6,8.fc22,x86_64,(none),214687,6a2c058885078740409b85f211366d8e,1421217702\nrpm-build-libs,4.12.0.1,9.fc22,x86_64,(none),166776,23e81aff3d7c5e363b1d3d356f182041,1429089697\npython-dnf,1.0.0,1.fc22,noarch,(none),1905093,50d9e137532bbcd51adc628a0130963b,1430571608\ndnf-yum,1.0.0,1.fc22,noarch,(none),24841,3237285cbe626d9b3b233f40ccc969bc,1430571608\ne2fsprogs,1.42.12,4.fc22,x86_64,(none),3003807,b9b79759b100cad845b7d8e004fce64f,1430444535\nrootfiles,8.1,17.fc21,noarch,(none),599,e9f1f3dac9b440c2156a66eddc35f909,1402212160\nlibgcc,5.1.1,1.fc22,x86_64,(none),183368,2daecefe22a5b96fa4393ba6dd6b5837,1429734590\nfedora-release,22,1,noarch,(none),4235,d91558d63d5aa15374f559bb1afcd12d,1432045630\nfilesystem,3.2,32.fc22,x86_64,(none),0,f49bd00613e7e51bc6d3559baae0cc68,1408195967\nlibreport-filesystem,2.5.1,1.fc22,x86_64,(none),0,5cb73843e2289324af75d40946fcff92,1428561525\ntzdata,2015d,1.fc22,noarch,(none),1644030,e834fc7e5e7135e54ebbcfc9ca233b8f,1430190469\nncurses-base,5.9,18.20150214.fc22,noarch,(none),246829,caf6152ababc48e199e64620e0f0d4aa,1424449040\nnss-softokn-freebl,3.18.0,1.fc22,x86_64,(none),521055,9339a991cfdb7cdef717e8d79451acf2,1426867670\nlibstdc++,5.1.1,1.fc22,x86_64,(none),1728084,98cd86a386062c04b9f4ad9b8d365d4e,1429734590\nbash,4.3.33,2.fc22,x86_64,(none),7155962,7e35b3cb74112c21a528dc468c07c1a8,1422029026\npcre,8.37,1.fc22,x86_64,(none),1674885,6b2636121ae2698fa5da07d6b87ed3f2,1430226425\nzlib,1.2.8,7.fc22,x86_64,(none),188155,3ddfcdbd91a0a4a6ef7f04cb3f36c1df,1408431203\nbzip2-libs,1.0.6,14.fc22,x86_64,(none),69829,46751433258eb55f0a5a13e4d8b725d0,1408152466\nlibdb,5.3.28,9.fc22,x86_64,(none),1888520,307580e0ca7e6bdb0f99c97a140a44ca,1408268990\nnspr,4.10.8,1.fc22,x86_64,(none),301230,78511358716d695cac7d0bd766372c1e,1422575653\nnss-util,3.18.0,1.fc22,x86_64,(none),199596,f603494b789bca34aaec99323540a41e,1426864636\npopt,1.16,5.fc22,x86_64,(none),126214,e0b265e6a5621512739e7f3ab363c259,1408340355\nlibacl,2.2.52,7.fc22,x86_64,(none),36600,6f8d43aeb05a58b75c1c13ed26bfdfee,1408137801\nlibcom_err,1.42.12,4.fc22,x86_64,(none),60233,9b40d0c3dd903c3a776c29dcb56bf816,1430444535\naudit-libs,2.4.2,1.fc22,x86_64,(none),236532,146e38d6bfcc4235884fa7e058a7f7ab,1430253368\nreadline,6.3,5.fc22,x86_64,(none),494939,005325df68633ebd9b36029a7bdbac3c,1408365488\nlibxml2,2.9.2,3.fc22,x86_64,(none),1727890,ac02080e61496187a20b084d38c1e1f2,1424271994\nsed,4.2.2,9.fc22,x86_64,(none),605545,26e10d79e2d0f4c4a4d15f17d4e97367,1408380126\ngrep,2.21,5.fc22,x86_64,(none),1262823,6ebca219a7e691041710f701f6033c8f,1428398413\nsqlite,3.8.9,1.fc22,x86_64,(none),935875,519ce8fb5f044470ce6963f0feeab0cd,1429003733\nelfutils-libs,0.161,6.fc22,x86_64,(none),710895,e3d710921b0b34d1bf158dd44093ea08,1425978586\nlibassuan,2.2.0,1.fc22,x86_64,(none),164618,ac28a767a31e0b54cde9aae9bf7869a0,1418999828\nkmod-libs,20,1.fc22,x86_64,(none),118112,2d2bef588c32b051cfcfcf2bb5b957ac,1425306281\ndbus-libs,1.8.16,1.fc22,x86_64,1,335864,275c8eefcec8bc443627bfe332fe5f01,1423510571\nkmod,20,1.fc22,x86_64,(none),207940,d9414f284dd3c3cd75e66afc48b9fdd3,1425306281\npinentry,0.9.1,1.fc22,x86_64,(none),112762,ab3d0dc736bf2a73faaa9e3d99d23cbe,1427312677\ne2fsprogs-libs,1.42.12,4.fc22,x86_64,(none),361897,0af85c4cbd59d23684585ba0e1ebd982,1430444535\nacl,2.2.52,7.fc22,x86_64,(none),189312,4e286726cf67ddb6c496a019a53f656a,1408137801\nlibksba,1.3.2,1.fc22,x86_64,(none),318478,0d85f4840d0099841fd64afd64860963,1417004901\ncyrus-sasl-lib,2.1.26,22.fc22,x86_64,(none),395343,9ed3d368bef4b6048d798880c0ddb1b0,1426523519\ngawk,4.1.1,6.fc22,x86_64,(none),2255738,e952c3e4bd5e96fb44bd86528b1781ff,1420212223\nncurses,5.9,18.20150214.fc22,x86_64,(none),451749,00cd8ef0169eb9ca92c20d5cb54c8389,1424448611\nlibseccomp,2.2.0,0.fc22,x86_64,(none),215242,3fcd5a77fbe7b6856b5069940adc8166,1424100824\nqrencode-libs,3.4.2,4.fc22,x86_64,(none),127918,90b684d658644656c9e84e29d0baae97,1408356554\nlibsemanage,2.3,6.fc22,x86_64,(none),251332,319fe99d5ab566feb2329c6edb17d8ae,1408279593\nlibverto,0.2.6,4.fc22,x86_64,(none),22804,71ac4eed13cfd100c9cb9c205c0db0fd,1408282096\ngdbm,1.11,4.fc22,x86_64,(none),381511,bab745ac6a8bd8d696f911c4091892fb,1408205700\nlibnetfilter_conntrack,1.0.4,4.fc22,x86_64,(none),138286,53fadc1ba11e0c298eb4c5d0b6864ff8,1408276161\nlzo,2.08,3.fc22,x86_64,(none),169709,36ca006519a8193819743c38572fb759,1408290599\nlibtasn1,4.5,1.fc22,x86_64,(none),421320,79319d7c572fcffb1b9906b0f0fce3b3,1430380575\nkrb5-libs,1.13.1,3.fc22,x86_64,(none),2286457,d57b1e21fe7df47809947d7902fed223,1430871086\ncoreutils,8.23,9.fc22,x86_64,(none),16324406,5cdca192845b4d124922f8590f102a25,1429541013\ncrypto-policies,20150305,2.git44afaa1.fc22,noarch,(none),40158,de2a35daa0fa3eb514eb74f90cf4fef3,1425639325\npython,2.7.9,6.fc22,x86_64,(none),79553,b3ff5a133956c02ea8f799f7d6e1434d,1429101737\nshadow-utils,4.2.1,1.fc22,x86_64,2,3711884,bca4896520780a4121320d9032310486,1417014272\nlibutempter,1.1.6,6.fc22,x86_64,(none),49757,f8c1f5fd313a3a150f2a2c8b14d1c5a5,1408281489\npyliblzma,0.5.3,13.fc22,x86_64,(none),198352,5e29b68f0ec46372fd17fa8713337141,1408344571\npython-libcomps,0.1.6,14.fc22,x86_64,(none),143380,80b028706911436dacdfedab86d0d60f,1408267154\npython-iniparse,0.4,15.fc22,noarch,(none),116198,fc2ee5738aade0ded608421f0a47394b,1406817743\ncracklib,2.9.1,5.fc22,x86_64,(none),209978,d43177a41fdd04450a66a3ef262b14ae,1408162574\npam,1.1.8,18.fc22,x86_64,(none),2637337,0839b4995da7b65b4ce9235e6d9e3809,1413541275\nsystemd-libs,219,13.fc22,x86_64,(none),1125568,144a9950fcdfb09a687ee92da97c17a9,1430317607\nnss-sysinit,3.18.0,1.fc22,x86_64,(none),13984,f7ac717c67020893e6e3858b50389bee,1426871722\nopenldap,2.4.40,12.fc22,x86_64,(none),992221,d49479f8b947346aae3b16fa2ace6e26,1430142582\ngpgme,1.4.3,5.fc22,x86_64,(none),607071,85d6ed868865dea6618c7ebc5275ddb5,1417838838\npkgconfig,0.28,8.fc22,x86_64,1,107920,49b9ff6f28962ded92e470a09c121146,1429298835\nshared-mime-info,1.4,2.fc22,x86_64,(none),2123110,2a186e493108a628d060d6339524865d,1423149713\nutil-linux,2.26.2,1.fc22,x86_64,(none),8978494,8dca268037a64736bad953b6494ca2c8,1430391777\nlibcurl,7.40.0,3.fc22,x86_64,(none),498308,0ac103d3c6450f227622552aba4bf0e0,1429709888\ndevice-mapper-libs,1.02.93,3.fc22,x86_64,(none),346908,a137a4620f31d18e9fdced0b07070739,1422638927\nsystemd,219,13.fc22,x86_64,(none),25514617,0be8a3814da5545f80beac320cb6d0e6,1430317607\ncurl,7.40.0,3.fc22,x86_64,(none),556943,135e6ab07141cdd8137e9bde2af1278d,1429709888\npython-librepo,1.7.13,1.fc22,x86_64,(none),145903,74a8048f1ae99b08e581e7bab22bda14,1422024837\nrpm-plugin-selinux,4.12.0.1,9.fc22,x86_64,(none),11504,2f98df94b412264db07f99b4b59dfdea,1429089697\nrpm,4.12.0.1,9.fc22,x86_64,(none),1967009,4ced0dd550667b4279df8d66733224af,1429089697\nrpm-plugin-systemd-inhibit,4.12.0.1,9.fc22,x86_64,(none),11384,9da731676612e9e63f9213564c599180,1429089697\nrpm-python,4.12.0.1,9.fc22,x86_64,(none),169585,9b25fd50ad23da16c302679958deac86,1429089697\ndnf,1.0.0,1.fc22,noarch,(none),724399,baed7804534a7eb0789afd1b0a1eb535,1430571608\nbash-completion,2.1,6.20141110git52d8316.fc22,noarch,1,851628,c3431145e46047a2d320e71443dad93d,1415654944\nvim-minimal,7.4.640,4.fc22,x86_64,2,943934,2dd93d2089331509d83152fff631bdef,1425285494\ngpg-pubkey,8e1431d5,53bcbac7,(none),(none),0,(none),1404877511" ++ }, ++ "creationTimestamp": "2015-08-20T16:41:05Z", ++ "labels": { ++ "buildconfig": "build-20150820174104", ++ "is_autorebuild": "false" ++ }, ++ "name": "test-build-cancel-123", ++ "namespace": "default", ++ "resourceVersion": "2958", ++ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123", ++ "uid": "3ff4b700-475a-11e5-acf2-52540080e6f8" ++ }, ++ "spec": { ++ "output": { ++ "to": { ++ "kind": "DockerImage", ++ "name": "localhost:5000/twaugh/component:20150820174104" ++ } ++ }, ++ "resources": {}, ++ "serviceAccount": "builder", ++ "source": { ++ "git": { ++ "ref": "master", ++ "uri": "https://github.com/TomasTomecek/docker-hello-world.git" ++ }, ++ "type": "Git" ++ }, ++ "strategy": { ++ "customStrategy": { ++ "env": [ ++ { ++ "name": "ATOMIC_REACTOR_PLUGINS", ++ "value": "{\"prebuild_plugins\": [{\"args\": {}, \"name\": \"pull_base_image\"}, {\"name\": \"change_from_in_dockerfile\"}, {\"name\": \"dockerfile_content\"}], \"exit_plugins\": [{\"args\": {\"url\": \"https://osbs.localdomain:8443/\", \"verify_ssl\": false, \"use_auth\": false}, \"name\": \"store_metadata_in_osv3\"}, {\"name\": \"remove_built_image\"}], \"postbuild_plugins\": [{\"args\": {\"image_id\": \"BUILT_IMAGE_ID\"}, \"name\": \"all_rpm_packages\"}]}" ++ }, ++ { ++ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE", ++ "value": "buildroot:latest" ++ } ++ ], ++ "exposeDockerSocket": true, ++ "from": { ++ "kind": "DockerImage", ++ "name": "buildroot:latest" ++ } ++ }, ++ "type": "Custom" ++ } ++ }, ++ "status": { ++ "completionTimestamp": "2015-08-20T16:41:45Z", ++ "config": { ++ "kind": "BuildConfig", ++ "name": "test-build-cancel-123", ++ "namespace": "default" ++ }, ++ "duration": 39000000000, ++ "phase": "Cancelled", ++ "startTimestamp": "2015-08-20T16:41:06Z" ++ } ++} +diff --git a/tests/test_api.py b/tests/test_api.py +index 0566971..42670a9 100644 +--- a/tests/test_api.py ++++ b/tests/test_api.py +@@ -72,7 +72,7 @@ class TestOSBS(object): + + def test_create_build_with_deprecated_params(self, osbs): + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -102,7 +102,7 @@ class TestOSBS(object): + def test_create_prod_build(self, osbs, name_label_name): + # TODO: test situation when a buildconfig already exists + class MockParser(object): +- labels = {name_label_name: 'fedora23/something'} ++ labels = {name_label_name: 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -116,7 +116,7 @@ class TestOSBS(object): + @pytest.mark.parametrize('unique_tag_only', [True, False, None]) + def test_create_prod_build_unique_tag_only(self, osbs, unique_tag_only): + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -140,7 +140,6 @@ class TestOSBS(object): + TEST_COMPONENT, TEST_TARGET, TEST_ARCH) + assert isinstance(response, BuildResponse) + +- + def test_create_prod_build_missing_name_label(self, osbs): + class MockParser(object): + labels = {} +@@ -154,9 +153,32 @@ class TestOSBS(object): + TEST_GIT_BRANCH, TEST_USER, + TEST_COMPONENT, TEST_TARGET, TEST_ARCH) + ++ @pytest.mark.parametrize('label_name', ['BZComponent', 'com.redhat.component', 'Name', 'name']) ++ def test_missing_component_and_name_labels(self, osbs, label_name): ++ """ ++ tests if raises exception if there is only component ++ or only name in labels ++ """ ++ ++ class MockParser(object): ++ labels = {label_name: 'something'} ++ baseimage = 'fedora23/python' ++ (flexmock(utils) ++ .should_receive('get_df_parser') ++ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH) ++ .and_return(MockParser())) ++ with pytest.raises(OsbsValidationException): ++ osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF, ++ TEST_GIT_BRANCH, TEST_USER, ++ TEST_COMPONENT, TEST_TARGET, TEST_ARCH) ++ + def test_create_prod_build_missing_args(self, osbs): ++ """ ++ tests if setdefault for arguments works in create_build ++ """ ++ + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -169,7 +191,6 @@ class TestOSBS(object): + git_branch=None, + user=TEST_USER, + component=TEST_COMPONENT, +- target=None, + architecture=TEST_ARCH) + .once() + .and_return(None)) +@@ -179,9 +200,42 @@ class TestOSBS(object): + component=TEST_COMPONENT, + architecture=TEST_ARCH) + ++ @pytest.mark.parametrize('component_label_name', ['com.redhat.component', 'BZComponent']) ++ def test_component_is_changed_from_label(self, osbs, component_label_name): ++ """ ++ tests if component is changed in create_prod_build ++ with value from component label ++ """ ++ ++ class MockParser(object): ++ labels = {'Name': 'fedora23/something', component_label_name: TEST_COMPONENT} ++ baseimage = 'fedora23/python' ++ (flexmock(utils) ++ .should_receive('get_df_parser') ++ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH) ++ .and_return(MockParser())) ++ flexmock(OSBS, _create_build_config_and_build=request_as_response) ++ req = osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF, ++ TEST_GIT_BRANCH, TEST_USER, ++ TEST_COMPONENT, TEST_TARGET, ++ TEST_ARCH) ++ assert req.spec.component.value == TEST_COMPONENT ++ ++ def test_missing_component_argument_doesnt_break_build(self, osbs): ++ class MockParser(object): ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} ++ baseimage = 'fedora23/python' ++ (flexmock(utils) ++ .should_receive('get_df_parser') ++ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH) ++ .and_return(MockParser())) ++ response = osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF, ++ TEST_GIT_BRANCH, TEST_USER) ++ assert isinstance(response, BuildResponse) ++ + def test_create_prod_build_set_required_version(self, osbs106): + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -199,7 +253,7 @@ class TestOSBS(object): + def test_create_prod_with_secret_build(self, osbs): + # TODO: test situation when a buildconfig already exists + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -214,7 +268,7 @@ class TestOSBS(object): + def test_create_prod_without_koji_build(self, osbs): + # TODO: test situation when a buildconfig already exists + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -429,7 +483,7 @@ build_image = {build_image} + assert config.get_build_image() == build_image + + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + (flexmock(utils) + .should_receive('get_df_parser') +@@ -884,7 +938,7 @@ build_image = {build_image} + osbs = OSBS(config, config) + + class MockParser(object): +- labels = {'Name': 'fedora23/something'} ++ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT} + baseimage = 'fedora23/python' + + kwargs = { +diff --git a/tests/test_conf.py b/tests/test_conf.py +index 81514d5..99bc0a2 100644 +--- a/tests/test_conf.py ++++ b/tests/test_conf.py +@@ -244,3 +244,19 @@ class TestConfiguration(object): + + for fn, value in expected.items(): + assert getattr(conf, fn)() == value ++ ++ @pytest.mark.parametrize(('config', 'expected'), [ ++ ({ ++ 'default': {'builder_build_json_dir': 'builder'}, ++ 'general': {'build_json_dir': 'general'}, ++ }, 'builder'), ++ ({ ++ 'default': {}, ++ 'general': {'build_json_dir': 'general'}, ++ }, 'general'), ++ ]) ++ def test_builder_build_json_dir(self, config, expected): ++ with self.config_file(config) as config_file: ++ conf = Configuration(conf_file=config_file) ++ ++ assert conf.get_builder_build_json_store() == expected +diff --git a/tests/test_core.py b/tests/test_core.py +index 3c7f303..6684275 100644 +--- a/tests/test_core.py ++++ b/tests/test_core.py +@@ -12,12 +12,14 @@ import time + import json + + from osbs.http import HttpResponse +-from osbs.constants import BUILD_FINISHED_STATES ++from osbs.constants import (BUILD_FINISHED_STATES, BUILD_RUNNING_STATES, ++ BUILD_CANCELLED_STATE) + from osbs.exceptions import (OsbsResponseException, OsbsNetworkException, + OsbsException) + from osbs.core import check_response + +-from tests.constants import TEST_BUILD, TEST_LABEL, TEST_LABEL_VALUE, TEST_BUILD_CONFIG ++from tests.constants import (TEST_BUILD, TEST_CANCELLED_BUILD, TEST_LABEL, ++ TEST_LABEL_VALUE, TEST_BUILD_CONFIG) + from tests.fake_api import openshift + import pytest + +@@ -142,6 +144,12 @@ class TestOpenshift(object): + assert response.json()["metadata"]["name"] == TEST_BUILD + assert response.json()["status"]["phase"].lower() in BUILD_FINISHED_STATES + ++ def test_cancel_build(self, openshift): ++ response = openshift.cancel_build(TEST_CANCELLED_BUILD) ++ assert response is not None ++ assert response.json()["metadata"]["name"] == TEST_CANCELLED_BUILD ++ assert response.json()["status"]["phase"].lower() in BUILD_CANCELLED_STATE ++ + def test_get_build_config(self, openshift): + mock_response = {"spam": "maps"} + build_config_name = 'some-build-config-name' diff --git a/osbs-client-koji_krb5.patch b/osbs-client-koji_krb5.patch deleted file mode 100644 index a65b900..0000000 --- a/osbs-client-koji_krb5.patch +++ /dev/null @@ -1,181 +0,0 @@ -diff --git a/docs/configuration_file.md b/docs/configuration_file.md -index 3ea34af..c200e86 100644 ---- a/docs/configuration_file.md -+++ b/docs/configuration_file.md -@@ -53,6 +53,12 @@ Some options are also mandatory. - - * `koji_certs_secret` (*optional*, `string`) — name of [kubernetes secret](https://github.com/kubernetes/kubernetes/blob/master/docs/design/secrets.md) to use for koji authentication - -+* `koji_use_kerberos` (*optional*, `boolean`) — will set [atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins to use kerberos to authenticate to koji. -+ -+* `koji_kerberos_keytab` (*optional*, `string`) - location of the keytab that will be used to initialize kerberos credentials for [atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins - usually in the form `FILE:`, see [kerberos documentation](http://web.mit.edu/Kerberos/krb5-latest/doc/basic/keytab_def.html) for other possible values -+ -+* `koji_kerberos_principal` (*optional*, `string`) - kerberos principal for the keytab provided in `koji_kerberos_keytab` -+ - * `sources_command` (*optional*, `string`) — command to use to get dist-git artifacts from lookaside cache (e.g. `fedpkg sources`) - - * `username`, `password` (*optional*, `string`) — when OpenShift is hidden behind authentication proxy, you can specify username and password for basic authentication -diff --git a/inputs/prod_inner.json b/inputs/prod_inner.json -index 306ac89..d2b5b4e 100644 ---- a/inputs/prod_inner.json -+++ b/inputs/prod_inner.json -@@ -154,7 +154,9 @@ - "kojihub": "{{KOJI_HUB}}", - "url": "{{OPENSHIFT_URI}}", - "verify_ssl": false, -- "blocksize": 10485760 -+ "blocksize": 10485760, -+ "koji_keytab": false, -+ "koji_principal": false - } - }, - { -diff --git a/osbs/api.py b/osbs/api.py -index 1a8e5c5..8d1883c 100644 ---- a/osbs/api.py -+++ b/osbs/api.py -@@ -393,6 +393,9 @@ class OSBS(object): - koji_target=target, - koji_certs_secret=self.build_conf.get_koji_certs_secret(), - koji_task_id=koji_task_id, -+ koji_use_kerberos=self.build_conf.get_koji_use_kerberos(), -+ koji_kerberos_keytab=self.build_conf.get_koji_kerberos_keytab(), -+ koji_kerberos_principal=self.build_conf.get_koji_kerberos_principal(), - architecture=architecture, - vendor=self.build_conf.get_vendor(), - build_host=self.build_conf.get_build_host(), -diff --git a/osbs/build/build_request.py b/osbs/build/build_request.py -index a890d0b..9f9824a 100644 ---- a/osbs/build/build_request.py -+++ b/osbs/build/build_request.py -@@ -486,7 +486,13 @@ class BuildRequest(object): - - if use_auth is not None: - self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', -- 'use_auth', use_auth) -+ 'use_auth', use_auth) -+ -+ if self.spec.koji_use_kerberos.value: -+ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', -+ 'koji_principal', self.spec.koji_kerberos_principal.value) -+ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote', -+ 'koji_keytab', self.spec.koji_kerberos_keytab.value) - else: - logger.info("removing koji_promote from request as no kojihub " - "specified") -diff --git a/osbs/build/spec.py b/osbs/build/spec.py -index 1f68281..bcab0fe 100644 ---- a/osbs/build/spec.py -+++ b/osbs/build/spec.py -@@ -147,6 +147,9 @@ class BuildSpec(object): - kojihub = BuildParam("kojihub", allow_none=True) - koji_certs_secret = BuildParam("koji_certs_secret", allow_none=True) - koji_task_id = BuildParam("koji_task_id", allow_none=True) -+ koji_use_kerberos = BuildParam("koji_use_kerberos", allow_none=True) -+ koji_kerberos_principal = BuildParam("koji_kerberos_principal", allow_none=True) -+ koji_kerberos_keytab = BuildParam("koji_kerberos_keytab", allow_none=True) - image_tag = BuildParam("image_tag") - pulp_secret = BuildParam("pulp_secret", allow_none=True) - pulp_registry = BuildParam("pulp_registry", allow_none=True) -@@ -197,7 +200,8 @@ class BuildSpec(object): - sources_command=None, architecture=None, vendor=None, - build_host=None, authoritative_registry=None, distribution_scope=None, - koji_target=None, kojiroot=None, kojihub=None, koji_certs_secret=None, -- koji_task_id=None, -+ koji_use_kerberos=None, koji_kerberos_keytab=None, -+ koji_kerberos_principal=None, koji_task_id=None, - source_secret=None, # compatibility name for pulp_secret - pulp_secret=None, pulp_registry=None, pdc_secret=None, pdc_url=None, - smtp_uri=None, nfs_server_path=None, -@@ -240,6 +244,9 @@ class BuildSpec(object): - self.kojiroot.value = kojiroot - self.kojihub.value = kojihub - self.koji_certs_secret.value = koji_certs_secret -+ self.koji_use_kerberos.value = koji_use_kerberos -+ self.koji_kerberos_principal.value = koji_kerberos_principal -+ self.koji_kerberos_keytab.value = koji_kerberos_keytab - self.koji_task_id.value = koji_task_id - self.pulp_secret.value = pulp_secret or source_secret - self.pulp_registry.value = pulp_registry -diff --git a/osbs/conf.py b/osbs/conf.py -index bb92ca7..324fdbf 100644 ---- a/osbs/conf.py -+++ b/osbs/conf.py -@@ -211,6 +211,15 @@ class Configuration(object): - def get_koji_certs_secret(self): - return self._get_value("koji_certs_secret", self.conf_section, "koji_certs_secret") - -+ def get_koji_use_kerberos(self): -+ return self._get_value("koji_use_kerberos", self.conf_section, "koji_use_kerberos", is_bool_val=True) -+ -+ def get_koji_kerberos_keytab(self): -+ return self._get_value("koji_kerberos_keytab", self.conf_section, "koji_kerberos_keytab") -+ -+ def get_koji_kerberos_principal(self): -+ return self._get_value("koji_kerberos_principal", self.conf_section, "koji_kerberos_principal") -+ - def get_sources_command(self): - return self._get_value("sources_command", self.conf_section, "sources_command") - -diff --git a/tests/build/test_build_request.py b/tests/build/test_build_request.py -index add97d3..c10de7e 100644 ---- a/tests/build/test_build_request.py -+++ b/tests/build/test_build_request.py -@@ -1279,6 +1279,57 @@ class TestBuildRequest(object): - koji_certs_secret_name) - assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_ssl_certs'] == mount_path - -+ def test_render_prod_request_with_koji_kerberos(self, tmpdir): -+ self.create_image_change_trigger_json(str(tmpdir)) -+ build_request = BuildRequest(str(tmpdir)) -+ name_label = "fedora/resultingimage" -+ push_url = "ssh://{username}git.example.com/git/{component}.git" -+ koji_task_id = 1234 -+ koji_use_kerberos = True -+ koji_kerberos_keytab = "FILE:/tmp/fakekeytab" -+ koji_kerberos_principal = "myprincipal@OSBSDOMAIN.COM" -+ kwargs = { -+ 'git_uri': TEST_GIT_URI, -+ 'git_ref': TEST_GIT_REF, -+ 'git_branch': TEST_GIT_BRANCH, -+ 'user': "john-foo", -+ 'component': TEST_COMPONENT, -+ 'base_image': 'fedora:latest', -+ 'name_label': name_label, -+ 'registry_uri': "example.com", -+ 'openshift_uri': "http://openshift/", -+ 'builder_openshift_url': "http://openshift/", -+ 'koji_target': "koji-target", -+ 'kojiroot': "http://root/", -+ 'kojihub': "http://hub/", -+ 'sources_command': "make", -+ 'koji_task_id': koji_task_id, -+ 'koji_use_kerberos': koji_use_kerberos, -+ 'koji_kerberos_keytab': koji_kerberos_keytab, -+ 'koji_kerberos_principal': koji_kerberos_principal, -+ 'vendor': "Foo Vendor", -+ 'authoritative_registry': "registry.example.com", -+ 'distribution_scope': "authoritative-source-only", -+ 'registry_api_versions': ['v1'], -+ 'git_push_url': push_url.format(username='', component=TEST_COMPONENT), -+ 'git_push_username': 'example', -+ } -+ build_request.set_params(**kwargs) -+ build_json = build_request.render() -+ -+ assert build_json["metadata"]["labels"]["koji-task-id"] == str(koji_task_id) -+ -+ plugins = get_plugins_from_build_json(build_json) -+ assert get_plugin(plugins, "exit_plugins", "koji_promote") -+ assert plugin_value_get(plugins, "exit_plugins", "koji_promote", -+ "args", "kojihub") == kwargs["kojihub"] -+ assert plugin_value_get(plugins, "exit_plugins", "koji_promote", -+ "args", "url") == kwargs["openshift_uri"] -+ -+ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_principal'] == koji_kerberos_principal -+ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_keytab'] == koji_kerberos_keytab -+ -+ - @pytest.mark.parametrize(('base_image', 'is_custom'), [ - ('fedora', False), - ('fedora:latest', False), diff --git a/osbs-client-site-customizations.patch b/osbs-client-site-customizations.patch deleted file mode 100644 index 8ffa43f..0000000 --- a/osbs-client-site-customizations.patch +++ /dev/null @@ -1,314 +0,0 @@ -diff --git a/docs/configuration_file.md b/docs/configuration_file.md -index 3ea34af..5876c9a 100644 ---- a/docs/configuration_file.md -+++ b/docs/configuration_file.md -@@ -110,3 +110,53 @@ Some options are also mandatory. - * `memory_limit` (*optional*, `string`) — memory limit to apply to build (for more info, see [documentation for resources](https://github.com/projectatomic/osbs-client/blob/master/docs/resource.md) - - * `storage_limit` (*optional*, `string`) — storage limit to apply to build (for more info, see [documentation for resources](https://github.com/projectatomic/osbs-client/blob/master/docs/resource.md) -+ -+ -+## Build JSON Templates -+ -+In the `build_json_dir` there must be `prod.json` and `prod_inner.json` which -+defines the [OpenShift Build](https://docs.openshift.org/latest/dev_guide/builds.html) -+specification that will be used to enable the specific -+[atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins that -+should be enabled and the config values for each. -+ -+There is also a third file that is optional that can exist along side the -+previous two in `build_json_dir` which is `prod_customize.json` and it will -+provide the ability to set site-specific customizations such as removing, -+plugins, adding plugins, or overriding arguments passed to existing plugins. -+ -+The syntax of `prod_customize.json` is as follows: -+ -+```json -+{ -+ "disable_plugins": [ -+ { -+ "plugin_type": "foo_type", -+ "plugin_name": "foo_name" -+ }, -+ { -+ "plugin_type": "bar_type", -+ "plugin_name": "bar_name" -+ } -+ ], -+ -+ "enable_plugins": [ -+ { -+ "plugin_type": "foo_type", -+ "plugin_name": "foo_name", -+ "plugin_args": { -+ "foo_arg1": "foo_value1", -+ "foo_arg2": "foo_value2" -+ } -+ } -+ ] -+} -+``` -+ -+Such that: -+ -+* `disable_plugins` will define a list of lists that define the plugin type of the plugin that is to be removed (`prebuild_plugins`, `prepublish_plugins`, `postbuild_plugins`, `exit_plugins`) and the name of the plugin. -+ -+* `enable_plugins` is used to add plugins or modify already enabled plugins by overriding args passed to the plugin, these must be defined as key-value pairs as illustrated above. It should be noted that plugins added here will be executed at the end of the list of plugins in that particular `plugin_type` (`prebuild_plugins`, `prepublish_plugins`, `postbuild_plugins`, `exit_plugins`). -+ -+ -diff --git a/inputs/prod_customize.json b/inputs/prod_customize.json -new file mode 100644 -index 0000000..e874211 ---- /dev/null -+++ b/inputs/prod_customize.json -@@ -0,0 +1,7 @@ -+{ -+ "disable_plugins": [ -+ ], -+ -+ "enable_plugins": [ -+ ] -+} -diff --git a/osbs/build/build_request.py b/osbs/build/build_request.py -index a890d0b..aeceeaa 100644 ---- a/osbs/build/build_request.py -+++ b/osbs/build/build_request.py -@@ -24,7 +24,7 @@ except ImportError: - - from osbs.build.manipulate import DockJsonManipulator - from osbs.build.spec import BuildSpec --from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE -+from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE, DEFAULT_CUSTOMIZE_CONF - from osbs.exceptions import OsbsException, OsbsValidationException - from osbs.utils import looks_like_git_hash, git_repo_humanish_part_from_uri - -@@ -46,6 +46,7 @@ class BuildRequest(object): - self.build_json = None # rendered template - self._template = None # template loaded from filesystem - self._inner_template = None # dock json -+ self._customize_conf = None # site customize conf for _inner_template - self._dj = None - self._resource_limits = None - self._openshift_required_version = parse_version('1.0.6') -@@ -136,6 +137,20 @@ class BuildRequest(object): - return self._inner_template - - @property -+ def customize_conf(self): -+ if self._customize_conf is None: -+ path = os.path.join(self.build_json_store, DEFAULT_CUSTOMIZE_CONF) -+ logger.debug("loading customize conf from path %s", path) -+ try: -+ with open(path, "r") as fp: -+ self._customize_conf= json.load(fp) -+ except IOError: -+ # File not found, which is perfectly fine. Set to empty string -+ self._customize_conf = {} -+ -+ return self._customize_conf -+ -+ @property - def dj(self): - if self._dj is None: - self._dj = DockJsonManipulator(self.template, self.inner_template) -@@ -649,10 +664,60 @@ class BuildRequest(object): - self.dj.dock_json_set_arg('postbuild_plugins', 'import_image', - 'insecure_registry', True) - -+ def render_customizations(self): -+ """ -+ Customize prod_inner for site specific customizations -+ """ -+ -+ disable_plugins = self.customize_conf.get('disable_plugins', []) -+ if not disable_plugins: -+ logger.debug("No site-specific plugins to disable") -+ else: -+ for plugin_dict in disable_plugins: -+ try: -+ self.dj.remove_plugin( -+ plugin_dict['plugin_type'], -+ plugin_dict['plugin_name'] -+ ) -+ logger.debug( -+ "site-specific plugin disabled -> Type:{0} Name:{1}".format( -+ plugin_dict['plugin_type'], -+ plugin_dict['plugin_name'] -+ ) -+ ) -+ except KeyError: -+ # Malformed config -+ logger.debug("Invalid custom configuration found for disable_plugins") -+ -+ enable_plugins = self.customize_conf.get('enable_plugins', []) -+ if not enable_plugins: -+ logger.debug("No site-specific plugins to enable") -+ else: -+ for plugin_dict in enable_plugins: -+ try: -+ self.dj.add_plugin( -+ plugin_dict['plugin_type'], -+ plugin_dict['plugin_name'], -+ plugin_dict['plugin_args'] -+ ) -+ logger.debug( -+ "site-specific plugin enabled -> Type:{0} Name:{1} Args: {2}".format( -+ plugin_dict['plugin_type'], -+ plugin_dict['plugin_name'], -+ plugin_dict['plugin_args'] -+ ) -+ ) -+ except KeyError: -+ # Malformed config -+ logger.debug("Invalid custom configuration found for enable_plugins") -+ -+ - def render(self, validate=True): - if validate: - self.spec.validate() - -+ self.render_customizations() -+ - # !IMPORTANT! can't be too long: https://github.com/openshift/origin/issues/733 - self.template['metadata']['name'] = self.spec.name.value - self.render_resource_limits() -diff --git a/osbs/build/manipulate.py b/osbs/build/manipulate.py -index a6b64cf..a0fd1b8 100644 ---- a/osbs/build/manipulate.py -+++ b/osbs/build/manipulate.py -@@ -50,6 +50,21 @@ class DockJsonManipulator(object): - self.dock_json[plugin_type].remove(p) - break - -+ def add_plugin(self, plugin_type, plugin_name, args_dict): -+ """ -+ if config has plugin, override it, else add it -+ """ -+ -+ plugin_modified = False -+ -+ for plugin in self.dock_json[plugin_type]: -+ if plugin['name'] == plugin_name: -+ plugin['args'] = args_dict -+ plugin_modified = True -+ -+ if not plugin_modified: -+ self.dock_json[plugin_type].append({"name": plugin_name, "args": args_dict}) -+ - def dock_json_has_plugin_conf(self, plugin_type, plugin_name): - """ - Check whether a plugin is configured. -diff --git a/osbs/constants.py b/osbs/constants.py -index 649626c..282f002 100644 ---- a/osbs/constants.py -+++ b/osbs/constants.py -@@ -18,6 +18,7 @@ DEFAULT_CONFIGURATION_FILE = "/etc/osbs.conf" - DEFAULT_CONFIGURATION_SECTION = "default" - DEFAULT_OUTER_TEMPLATE = "prod.json" - DEFAULT_INNER_TEMPLATE = "prod_inner.json" -+DEFAULT_CUSTOMIZE_CONF = "prod_customize.json" - GENERAL_CONFIGURATION_SECTION = "general" - POD_FINISHED_STATES = ["failed", "succeeded"] - POD_FAILED_STATES = ["failed"] -diff --git a/tests/build/test_build_request.py b/tests/build/test_build_request.py -index add97d3..96c642e 100644 ---- a/tests/build/test_build_request.py -+++ b/tests/build/test_build_request.py -@@ -1348,3 +1348,97 @@ class TestBuildRequest(object): - pull_base_image_plugin = get_plugin( - plugins, 'prebuild_plugins', 'pull_base_image') - assert pull_base_image_plugin is not None -+ -+ def test_render_prod_custom_site_plugin_enable(self): -+ """ -+ Test to make sure that when we attempt to enable a plugin, it is -+ actually enabled in the JSON for the build_request after running -+ build_request.render() -+ """ -+ -+ plugin_type = "exit_plugins" -+ plugin_name = "testing_exit_plugin" -+ plugin_args = {"foo": "bar"} -+ -+ build_request = BuildRequest(INPUTS_PATH) -+ build_request.customize_conf['enable_plugins'].append( -+ { -+ "plugin_type": plugin_type, -+ "plugin_name": plugin_name, -+ "plugin_args": plugin_args -+ } -+ ) -+ kwargs = get_sample_prod_params() -+ build_request.set_params(**kwargs) -+ build_request.render() -+ -+ assert { -+ "name": plugin_name, -+ "args": plugin_args -+ } in build_request.dj.dock_json[plugin_type] -+ -+ def test_render_prod_custom_site_plugin_disable(self): -+ """ -+ Test to make sure that when we attempt to disable a plugin, it is -+ actually disabled in the JSON for the build_request after running -+ build_request.render() -+ """ -+ -+ plugin_type = "postbuild_plugins" -+ plugin_name = "compress" -+ -+ build_request = BuildRequest(INPUTS_PATH) -+ build_request.customize_conf['disable_plugins'].append( -+ { -+ "plugin_type": plugin_type, -+ "plugin_name": plugin_name -+ } -+ ) -+ kwargs = get_sample_prod_params() -+ build_request.set_params(**kwargs) -+ build_request.render() -+ -+ for plugin in build_request.dj.dock_json[plugin_type]: -+ if plugin['name'] == plugin_name: -+ assert False -+ -+ def test_render_prod_custom_site_plugin_override(self): -+ """ -+ Test to make sure that when we attempt to override a plugin's args, -+ they are actually overridden in the JSON for the build_request -+ after running build_request.render() -+ """ -+ -+ plugin_type = "postbuild_plugins" -+ plugin_name = "compress" -+ plugin_args = {"foo": "bar"} -+ -+ kwargs = get_sample_prod_params() -+ -+ unmodified_build_request = BuildRequest(INPUTS_PATH) -+ unmodified_build_request.set_params(**kwargs) -+ unmodified_build_request.render() -+ -+ for plugin_dict in unmodified_build_request.dj.dock_json[plugin_type]: -+ if plugin_dict['name'] == plugin_name: -+ plugin_index = unmodified_build_request.dj.dock_json[plugin_type].index(plugin_dict) -+ -+ build_request = BuildRequest(INPUTS_PATH) -+ build_request.customize_conf['enable_plugins'].append( -+ { -+ "plugin_type": plugin_type, -+ "plugin_name": plugin_name, -+ "plugin_args": plugin_args -+ } -+ ) -+ build_request.set_params(**kwargs) -+ build_request.render() -+ -+ -+ assert { -+ "name": plugin_name, -+ "args": plugin_args -+ } in build_request.dj.dock_json[plugin_type] -+ -+ assert unmodified_build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name -+ assert build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name diff --git a/osbs-client.spec b/osbs-client.spec index a98554a..aef836b 100644 --- a/osbs-client.spec +++ b/osbs-client.spec @@ -52,14 +52,14 @@ Source0: https://github.com/projectatomic/osbs-client/archive/%{commit}/o Patch0: rewrite-httppy-pycurl-requests-0.30.patch # Upstream patch submitted to enable koji krb5 auth to be used -# # https://github.com/projectatomic/osbs-client/pull/482 -Patch1: osbs-client-koji_krb5.patch - +# # Upstream patch submitted to enable site specific customizations +# https://github.com/projectatomic/osbs-client/pull/475 # -# https://github.com/projectatomic/osbs-client/pull/475 -Patch2: osbs-client-site-customizations.patch +# Upstream patch for status.cancelled for cancel-build +# https://github.com/projectatomic/osbs-client/pull/478 +Patch1: osbs-client-0.33_site-specific_koji-kerberos_cancel-build.patch BuildArch: noarch @@ -179,7 +179,6 @@ This package contains osbs Python 3 bindings. rm tests/test_http.py %patch1 -p1 -%patch2 -p1 %if ! 0%{?with_check} # setup now requires pytest-runner which causes the build to fail even when @@ -247,6 +246,10 @@ LANG=en_US.utf8 py.test-%{python2_version} -vv tests %endif # with_python3 %changelog +* Thu Dec 15 2016 Adam Miller - 0.33-3 +- Update patch for site specific customizations to be in line with upstream +- Add cancel-build patch + * Fri Dec 02 2016 Adam Miller - 0.33-2 - Patch for koji krb5 - Patch for site specific customizations diff --git a/sources b/sources index a3f88c7..5e83b83 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -bc77cae5c4fe899972b1e557beaff296 osbs-client-696505ae4da4898a4e3689ef18e1f6791b04ea09.tar.gz +SHA512 (osbs-client-696505ae4da4898a4e3689ef18e1f6791b04ea09.tar.gz) = 25a5cf7dccbe5e970ccf7913a4a57aafb7ee3f307a4bf4cfb94e97c49916d8dde76e3600f92cf2e87c79ab6c401fb15f7d00311e9b67e30300b9ee22f7867e3e