From 14090972ed9aec61a0e23bfdf9211b8bce71d26a Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Jun 09 2017 19:39:10 +0000 Subject: update to latest upstream - 1.39.1 --- diff --git a/.gitignore b/.gitignore index 405d774..ce724f1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /osbs-client-dd5b0ea3f0b77fd3f9f2d55f607dbf4323b4d167.tar.gz /osbs-client-5021224746eb0e6ac12c54c397397b629167030b.tar.gz /osbs-client-696505ae4da4898a4e3689ef18e1f6791b04ea09.tar.gz +/osbs-client-ce184c63bf10bb020aa4039765ccd477cd6f6eea.tar.gz 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 deleted file mode 100644 index f56e4c4..0000000 --- a/osbs-client-0.33_site-specific_koji-kerberos_cancel-build.patch +++ /dev/null @@ -1,1548 +0,0 @@ -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.spec b/osbs-client.spec index 6f25c71..85bdc2e 100644 --- a/osbs-client.spec +++ b/osbs-client.spec @@ -22,16 +22,16 @@ %global with_check 1 %endif -%global commit 696505ae4da4898a4e3689ef18e1f6791b04ea09 +%global commit ce184c63bf10bb020aa4039765ccd477cd6f6eea %global shortcommit %(c=%{commit}; echo ${c:0:7}) # set to 0 to create a normal release %global postrelease 0 -%global release 5 +%global release 1 %global osbs_obsolete_vr 0.14-2 Name: osbs-client -Version: 0.33 +Version: 0.39.1 %if "x%{postrelease}" != "x0" Release: %{release}.%{postrelease}.git.%{shortcommit}%{?dist} %else @@ -44,23 +44,6 @@ License: BSD URL: https://github.com/projectatomic/osbs-client Source0: https://github.com/projectatomic/osbs-client/archive/%{commit}/osbs-client-%{commit}.tar.gz -# Upstream patch submitted to use python-requests instead of pycurl to resolve -# nss initialization issue in a fork -# -# https://github.com/projectatomic/osbs-client/pull/458 -# -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 -# -# Upstream patch submitted to enable site specific customizations -# https://github.com/projectatomic/osbs-client/pull/475 -# -# 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 %if 0%{?with_python3} @@ -89,8 +72,6 @@ BuildRequires: python-pytest-capturelog BuildRequires: python-flexmock BuildRequires: python-six BuildRequires: python-dockerfile-parse -BuildRequires: python-pycurl -BuildRequires: python2-pytest-runner %endif # with_check %if 0%{?with_python3} @@ -105,7 +86,6 @@ BuildRequires: python3-pytest-capturelog BuildRequires: python3-flexmock BuildRequires: python3-six BuildRequires: python3-dockerfile-parse -BuildRequires: python3-pycurl BuildRequires: python3-pytest-runner %endif # with_check %endif # with_python3 @@ -124,7 +104,6 @@ Summary: Python 2 module for OpenShift Build Service Group: Development/Tools License: BSD Requires: python-dockerfile-parse -Requires: python-pycurl Requires: python-setuptools Requires: krb5-workstation %if 0%{?rhel} && 0%{?rhel} <= 6 @@ -153,7 +132,6 @@ Summary: Python 3 module for OpenShift Build Service Group: Development/Tools License: BSD Requires: python3-dockerfile-parse -Requires: python3-pycurl Requires: python3-dateutil Requires: python3-setuptools Requires: python3-requests @@ -174,19 +152,6 @@ This package contains osbs Python 3 bindings. %prep %setup -qn %{name}-%{commit} -# the test_http.py test is no longer needed with the patch -%patch0 -p1 -rm tests/test_http.py - -%patch1 -p1 - -%if ! 0%{?with_check} -# setup now requires pytest-runner which causes the build to fail even when -# we're not running checks -sed -i '/setup_requires/d' setup.py -%endif - - %build %py2_build @@ -246,6 +211,9 @@ LANG=en_US.utf8 py.test-%{python2_version} -vv tests %endif # with_python3 %changelog +* Fri Jun 09 2017 Adam Miller - 0.39.1-1 +- Update to latest upstream + * Sat Feb 11 2017 Fedora Release Engineering - 0.33-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/rewrite-httppy-pycurl-requests-0.30.patch b/rewrite-httppy-pycurl-requests-0.30.patch deleted file mode 100644 index f778cba..0000000 --- a/rewrite-httppy-pycurl-requests-0.30.patch +++ /dev/null @@ -1,518 +0,0 @@ -From 22936cd8ed0f0d5b0c3ece75752e2877f46af455 Mon Sep 17 00:00:00 2001 -From: Patrick Uiterwijk -Date: Wed, 21 Sep 2016 13:48:07 +0000 -Subject: [PATCH 1/3] Rewrite http.py to use python-requests - -This will work around an issue when pycurl is used in the same context as -rpm is, as used by koji-containerbuild. - -Signed-off-by: Patrick Uiterwijk ---- - osbs/http.py | 290 +++++++++-------------------------------------------------- - 1 file changed, 42 insertions(+), 248 deletions(-) - -diff --git a/osbs/http.py b/osbs/http.py -index 9955c55..5f39141 100644 ---- a/osbs/http.py -+++ b/osbs/http.py -@@ -24,77 +24,17 @@ - import logging - from io import BytesIO - --import pycurl -- - from osbs.exceptions import OsbsException, OsbsNetworkException, OsbsResponseException - -+import requests - try: -- # py2 -- import httplib -+ from requests_kerberos import HTTPKerberosAuth - except ImportError: -- # py3 -- import http.client as httplib -+ HTTPKerberosAuth = None - - --logger = logging.getLogger(__name__) - --SELECT_TIMEOUT = 9999 --PYCURL_NETWORK_CODES = [pycurl.E_BAD_CONTENT_ENCODING, -- pycurl.E_BAD_DOWNLOAD_RESUME, -- pycurl.E_CONV_FAILED, -- pycurl.E_CONV_REQD, -- pycurl.E_COULDNT_CONNECT, -- pycurl.E_COULDNT_RESOLVE_HOST, -- pycurl.E_COULDNT_RESOLVE_PROXY, -- pycurl.E_FILESIZE_EXCEEDED, -- pycurl.E_HTTP_POST_ERROR, -- pycurl.E_HTTP_RANGE_ERROR, -- pycurl.E_HTTP_RETURNED_ERROR, -- pycurl.E_LOGIN_DENIED, -- # old pycurl: E_OPERATION_TIMEOUTED, new pycurl: E_OPERATION_TIMEDOUT -- getattr(pycurl, "E_OPERATION_TIMEDOUT", "E_OPERATION_TIMEOUTED"), -- pycurl.E_PARTIAL_FILE, -- pycurl.E_READ_ERROR, -- pycurl.E_RECV_ERROR, -- pycurl.E_REMOTE_FILE_NOT_FOUND, -- pycurl.E_SEND_ERROR, -- pycurl.E_SSL_CACERT, -- pycurl.E_SSL_CERTPROBLEM, -- pycurl.E_SSL_CIPHER, -- pycurl.E_SSL_CONNECT_ERROR, -- pycurl.E_SSL_PEER_CERTIFICATE, -- pycurl.E_SSL_SHUTDOWN_FAILED, -- pycurl.E_TOO_MANY_REDIRECTS, -- pycurl.E_UNSUPPORTED_PROTOCOL, -- pycurl.E_WRITE_ERROR] -- --PYCURL_NETWORK_CODES = [x for x in PYCURL_NETWORK_CODES if x is not None] -- -- --def parse_headers(all_headers): -- # all_headers contains headers from all responses - even without FOLLOWLOCATION there -- # might be multiple sets of headers due to 401 Unauthorized. We only care about the last -- # response. -- try: -- raw_headers = all_headers.split(b"\r\n\r\n")[-2] -- except IndexError: -- logger.warning('Incorrectly terminated http headers') -- raw_headers = all_headers -- -- logger.debug("raw headers: " + repr(raw_headers)) -- -- # http://stackoverflow.com/questions/24728088/python-parse-http-response-string/24729316#24729316 -- class FakeSocket(object): -- def __init__(self, response_str): -- self._file = BytesIO(response_str) -- -- def makefile(self, *args, **kwargs): -- return self._file -- -- response = httplib.HTTPResponse(FakeSocket(raw_headers)) -- response.begin() -- header_list = [(k.lower(), v) for (k, v) in response.getheaders()] -- return dict(header_list) -+logger = logging.getLogger(__name__) - - - class HttpSession(object): -@@ -120,22 +60,9 @@ def request(self, url, *args, **kwargs): - return stream - - with stream as s: -- # joining at once is much faster than doing += in a loop -- all_chunks = list(s.iter_chunks()) -- content = ''.join(all_chunks) -+ content = s.req.content - return HttpResponse(s.status_code, s.headers, content) -- except pycurl.error as ex: -- code = ex.args[0] -- try: -- message = ex.args[1] -- except IndexError: -- # happened on rhel 6 -- message = "" -- if code in PYCURL_NETWORK_CODES: -- raise OsbsNetworkException(url, message, code, *ex.args[2:], -- cause=ex, -- traceback=sys.exc_info()[2]) -- -+ except Exception as ex: - raise OsbsException(cause=ex, traceback=sys.exc_info()[2]) - - -@@ -160,203 +87,68 @@ def __init__(self, url, method, data=None, kerberos_auth=False, - - self.status_code = 0 - self.headers = None -- self.response_buffer = BytesIO() -- self.headers_buffer = BytesIO() -- self.response_decoder = None - - self.url = url - headers = headers or {} - method = method.lower() - -- self.c = pycurl.Curl() -- self.curl_multi = pycurl.CurlMulti() -- -- if method == 'post': -- self.c.setopt(pycurl.POST, 1) -- headers["Expect"] = "" # openshift can't handle Expect -- elif method == 'get': -- self.c.setopt(pycurl.HTTPGET, 1) -- elif method == 'put': -- # self.c.setopt(pycurl.PUT, 1) -- self.c.setopt(pycurl.CUSTOMREQUEST, b"PUT") -- headers["Expect"] = "" -- elif method == 'delete': -- self.c.setopt(pycurl.CUSTOMREQUEST, b"DELETE") -- else: -+ if method not in ['post', 'get', 'put', 'delete']: - raise RuntimeError("Unsupported method '%s' for curl call!" % method) - -- self.c.setopt(pycurl.COOKIEFILE, b'') -- self.c.setopt(pycurl.URL, str(url)) -- self.c.setopt(pycurl.WRITEFUNCTION, self.response_buffer.write) -- self.c.setopt(pycurl.HEADERFUNCTION, self.headers_buffer.write) -- self.c.setopt(pycurl.DEBUGFUNCTION, self._curl_debug) -- self.c.setopt(pycurl.SSL_VERIFYPEER, 1 if verify_ssl else 0) -- self.c.setopt(pycurl.SSL_VERIFYHOST, 2 if verify_ssl else 0) -- if ca: -- logger.info("Setting CAINFO to %r", ca) -- self.c.setopt(pycurl.CAINFO, ca) -- -- self.c.setopt(pycurl.VERBOSE, 1 if verbose else 0) -+ args = {} -+ -+ if method in ['post', 'put']: -+ headers['Expect'] = '' -+ -+ if not verify_ssl: -+ args['verify'] = False -+ else: -+ if ca: -+ args['verify'] = ca -+ else: -+ args['verify'] = True -+ - if username and password: -- username = username.encode('utf-8') -- password = password.encode('utf-8') -- self.c.setopt(pycurl.USERPWD, username + b":" + password) -+ args['auth'] = (username, password) - - if client_cert and client_key: -- self.c.setopt(pycurl.SSLCERTTYPE, "PEM") -- self.c.setopt(pycurl.SSLKEYTYPE, "PEM") -- self.c.setopt(pycurl.SSLCERT, client_cert) -- self.c.setopt(pycurl.SSLKEY, client_key) -+ args['cert'] = (client_cert, client_key) - - if data: -- # curl sets the method to post if one sets any POSTFIELDS (even '') -- self.c.setopt(pycurl.POSTFIELDS, data) -+ args['data'] = data - - if use_json: -- headers['Content-Type'] = b'application/json' -+ headers['Content-Type'] = 'application/json' - -- if allow_redirects: -- self.c.setopt(pycurl.FOLLOWLOCATION, 1) -+ args['allow_redirects'] = allow_redirects - - if kerberos_auth: -- self.c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE) -- self.c.setopt(pycurl.USERPWD, b':') -+ if not HTTPKerberosAuth: -+ raise RuntimeError('Kerberos auth unavailable') -+ args['auth'] = HTTPKerberosAuth() - - if stream: -- headers['Cache-Control'] = b'no-cache' -- -- if headers: -- header_list = [] -- for header_key, header_value in headers.items(): -- header_list.append(str("%s: %s" % (header_key, header_value))) -- self.c.setopt(pycurl.HTTPHEADER, header_list) -- -- self.curl_multi.add_handle(self.c) -- -- # Send request and read all headers. We have all headers once we receive some data or once -- # the response ends. -- # NOTE: HTTP response in chunked encoding can contain additional headers ("trailers") in the -- # last chunk. This is not handled here. -- while not (self.finished or self._any_data_received()): -- self._select() -- self._perform() -- -- self.headers = parse_headers(self.headers_buffer.getvalue()) -- self.status_code = self.c.getinfo(pycurl.HTTP_CODE) -- self.response_decoder = codecs.getincrementaldecoder(self.encoding)() -- -- def _perform(self): -- while True: -- ret, num_handles = self.curl_multi.perform() -- if ret != pycurl.E_CALL_MULTI_PERFORM: -- # see curl_multi_perform manpage -- break -- -- num_q, _, err_list = self.curl_multi.info_read() -- if num_q != 0: -- logger.warning("CurlMulti.info_read() has %s remaining messages", num_q) -- -- if err_list: -- err_obj = err_list[0] -- -- # For anything but the connection being closed, raise -- if err_obj[1] != pycurl.E_PARTIAL_FILE: -- raise OsbsNetworkException(self.url, err_obj[2], err_obj[1]) -- -- self.finished = (num_handles == 0) -- -- def _select(self): -- sel = self.curl_multi.select(SELECT_TIMEOUT) -- if sel == -1: -- raise OsbsException("CurlMulti.select() timed out") -- elif sel == 0: -- # sel==0 means curl_multi_fdset returned -1 -- # manual page suggests sleeping >100ms when this happens:( -- time.sleep(0.1) -- -- def _any_data_received(self): -- return self.response_buffer.tell() != 0 -+ args['stream'] = True -+ -+ args['headers'] = headers -+ self.req = requests.request(method, url, **args) -+ -+ self.headers = self.req.headers -+ self.status_code = self.req.status_code - - def _get_received_data(self): -- result = self.response_buffer.getvalue() -- self.response_buffer.truncate(0) -- self.response_buffer.seek(0) -- return self.response_decoder.decode(result, final=self.finished) -+ return self.req.content - - def iter_chunks(self): -- while True: -- self._perform() -- if self._any_data_received(): -- yield self._get_received_data() -- if self.finished: -- break -- self._select() -- -- logger.debug("end of the stream") -- self.close() -+ return self.req.iter_content(None) - - def iter_lines(self): -- chunks = self.iter_chunks() -- return self._split_lines_from_chunks(chunks) -- -- @staticmethod -- def _split_lines_from_chunks(chunks): -- # same behaviour as requests' Response.iter_lines(...) -- -- pending = None -- for chunk in chunks: -- -- if pending is not None: -- chunk = pending + chunk -- lines = chunk.splitlines() -- -- if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: -- pending = lines.pop() -- else: -- pending = None -- -- for line in lines: -- yield line -- -- if pending is not None: -- yield pending -- -- @staticmethod -- def _curl_debug(debug_type, debug_msg): -- try: -- logger_name = { -- pycurl.INFOTYPE_TEXT: 'curl', -- pycurl.INFOTYPE_HEADER_IN: 'in', -- pycurl.INFOTYPE_HEADER_OUT: 'out' -- }[debug_type] -- except KeyError: -- return -- -- curl_logger = logging.getLogger(__name__ + '.' + logger_name) -- for line in debug_msg.splitlines(): -- if not line: -- continue -- curl_logger.debug(line) -- -- @property -- def encoding(self): -- encoding = None -- if 'content-type' in self.headers: -- content_type = self.headers['content-type'].lower() -- match = re.search(r'charset=(\S+)', content_type) -- if match: -- encoding = match.group(1) -- if encoding is None: -- encoding = 'utf-8' # assume utf-8 -- -- return encoding -+ return self.req.iter_lines() - - def close(self): - if not self.closed: - logger.debug("cleaning up") -- self.curl_multi.remove_handle(self.c) -- self.c.close() -- self.curl_multi.close() -+ del self.req - self.closed = True - - def __del__(self): -@@ -376,7 +168,9 @@ def __init__(self, status_code, headers, content): - self.content = content - - def json(self, check=True): -- if check and self.status_code not in (0, httplib.OK, httplib.CREATED): -+ if check and self.status_code not in (0, requests.codes.OK, requests.codes.CREATED): - raise OsbsResponseException(self.content, self.status_code) - -+ if isinstance(self.content, bytes): -+ self.content = self.content.decode('utf-8') - return json.loads(self.content) - -From b626346936a0cd12cdaed028152311f70afcdc41 Mon Sep 17 00:00:00 2001 -From: Patrick Uiterwijk -Date: Wed, 21 Sep 2016 14:13:25 +0000 -Subject: [PATCH 2/3] Fix tests for porting of http client to requests - -Signed-off-by: Patrick Uiterwijk ---- - tests/test_http.py | 58 +----------------------------------------------------- - 1 file changed, 1 insertion(+), 57 deletions(-) - -diff --git a/tests/test_http.py b/tests/test_http.py -index 674f9eb..30d2f14 100644 ---- a/tests/test_http.py -+++ b/tests/test_http.py -@@ -12,7 +12,7 @@ - import pytest - - import osbs.http as osbs_http --from osbs.http import parse_headers, HttpSession, HttpStream -+from osbs.http import HttpSession, HttpStream - from osbs.exceptions import OsbsNetworkException - - from tests.fake_api import Connection, ResponseMapping -@@ -34,22 +34,6 @@ def has_connection(): - return False - - --class TestParseHeaders(object): -- def test_parse_headers(self): -- conn = Connection("0.5.4") -- rm = ResponseMapping("0.5.4", lookup=conn.get_definition_for) -- -- key, value = conn.get_definition_for("/oauth/authorize") -- file_name = value["get"]["file"] -- raw_headers = rm.get_response_content(file_name) -- -- headers = parse_headers(raw_headers) -- -- assert headers is not None -- assert len(headers.items()) > 0 -- assert headers["location"] -- -- - @pytest.mark.skipif(not has_connection(), - reason="requires internet connection") - class TestHttpSession(object): -@@ -141,43 +125,3 @@ def test_raise(self, s): - with s.get("http://httpbin.org/stream/3", stream=True) as s: - raise RuntimeError("hi") - assert s.closed -- -- --class TestHttpStream(object): -- @pytest.mark.parametrize('chunks,expected_content', [ -- ([b'foo', b'', b'bar', b'baz'], u'foobarbaz'), -- ([b'a', b'b', b'\xc4', b'\x8d', b'x'], u'ab\u010dx'), -- ([b'\xe2', b'\x8a', b'\x86'], u'\u2286'), -- ([b'\xe2\x8a', b'\x86'], u'\u2286'), -- ([b'\xe2', b'\x8a\x86'], u'\u2286'), -- ([b'aaaa', b'\xe2\x8a', b'\x86'], u'aaaa\u2286'), -- ([b'aaaa\xe2\x8a', b'\x86'], u'aaaa\u2286'), -- ([b'\xe2\x8a', b'\x86ffff'], u'\u2286ffff'), -- ]) -- def test_http_multibyte_decoding(self, chunks, expected_content): -- class Whatever(object): -- def __getattr__(self, name): -- return self -- -- def __call__(self, *args, **kwargs): -- return self -- flexmock(pycurl).should_receive('Curl').and_return(Whatever()) -- flexmock(pycurl).should_receive('CurlMulti').and_return(Whatever()) -- (flexmock(osbs_http).should_receive('parse_headers') -- .and_return({'content-type': 'application/json; charset=utf-8'})) -- flexmock(HttpStream, _select=lambda: None) -- -- def mock_perform(self): -- if chunks: -- self.response_buffer.write(chunks.pop(0)) -- else: -- self.finished = True -- -- try: -- orig_perform = HttpStream._perform -- HttpStream._perform = mock_perform -- -- r = HttpSession(verbose=True).get('http://') -- assert r.content == expected_content -- finally: -- HttpStream._perform = orig_perform - -From cdd2061d6397e159bb32413b39e538be7685b505 Mon Sep 17 00:00:00 2001 -From: Patrick Uiterwijk -Date: Wed, 21 Sep 2016 14:27:16 +0000 -Subject: [PATCH 3/3] Update spec file to include python-requests - -Signed-off-by: Patrick Uiterwijk ---- - osbs-client.spec | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/osbs-client.spec b/osbs-client.spec -index 298aadf..c0b3cd5 100644 ---- a/osbs-client.spec -+++ b/osbs-client.spec -@@ -60,7 +60,8 @@ BuildRequires: python-pytest-capturelog - BuildRequires: python-flexmock - BuildRequires: python-six - BuildRequires: python-dockerfile-parse --BuildRequires: python-pycurl -+BuildRequires: python-requests -+BuildRequires: python-requests-kerberos - %endif # with_check - - %if 0%{?with_python3} -@@ -73,7 +74,8 @@ BuildRequires: python3-pytest-capturelog - BuildRequires: python3-flexmock - BuildRequires: python3-six - BuildRequires: python3-dockerfile-parse --BuildRequires: python3-pycurl -+BuildRequires: python3-requests -+BuildRequires: python3-requests-kerberos - %endif # with_check - %endif # with_python3 - -@@ -91,7 +93,8 @@ Summary: Python 2 module for OpenShift Build Service - Group: Development/Tools - License: BSD - Requires: python-dockerfile-parse --Requires: python-pycurl -+Requires: python-requests -+Requires: python-requests-kerberos - Requires: python-setuptools - Requires: krb5-workstation - %if 0%{?rhel} && 0%{?rhel} <= 6 -@@ -113,7 +116,8 @@ Summary: Python 3 module for OpenShift Build Service - Group: Development/Tools - License: BSD - Requires: python3-dockerfile-parse --Requires: python3-pycurl -+Requires: python3-requests -+Requires: python3-requests-kerberos - Requires: python3-dateutil - Requires: python3-setuptools - Requires: krb5-workstation diff --git a/sources b/sources index 5e83b83..1cebdfe 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (osbs-client-696505ae4da4898a4e3689ef18e1f6791b04ea09.tar.gz) = 25a5cf7dccbe5e970ccf7913a4a57aafb7ee3f307a4bf4cfb94e97c49916d8dde76e3600f92cf2e87c79ab6c401fb15f7d00311e9b67e30300b9ee22f7867e3e +SHA512 (osbs-client-ce184c63bf10bb020aa4039765ccd477cd6f6eea.tar.gz) = e89a43cfd94dca783b86db49bb94472cc96c88db477a2c1267ce7e194752ace50f164ebd14b2a85ffcb494c224493c71b2c3881b5771f8e7b1efcb6a2ae80d7e