|
|
f0b3403 |
diff --git a/docs/configuration_file.md b/docs/configuration_file.md
|
|
|
f0b3403 |
index 3ea34af..df300ba 100644
|
|
|
f0b3403 |
--- a/docs/configuration_file.md
|
|
|
f0b3403 |
+++ b/docs/configuration_file.md
|
|
|
f0b3403 |
@@ -53,6 +53,12 @@ Some options are also mandatory.
|
|
|
f0b3403 |
|
|
|
f0b3403 |
* `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
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+* `koji_use_kerberos` (*optional*, `boolean`) — will set [atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins to use kerberos to authenticate to koji.
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+* `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:<absolute_path>`, see [kerberos documentation](http://web.mit.edu/Kerberos/krb5-latest/doc/basic/keytab_def.html) for other possible values
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+* `koji_kerberos_principal` (*optional*, `string`) - kerberos principal for the keytab provided in `koji_kerberos_keytab`
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
* `sources_command` (*optional*, `string`) — command to use to get dist-git artifacts from lookaside cache (e.g. `fedpkg sources`)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
* `username`, `password` (*optional*, `string`) — when OpenShift is hidden behind authentication proxy, you can specify username and password for basic authentication
|
|
|
f0b3403 |
@@ -110,3 +116,53 @@ Some options are also mandatory.
|
|
|
f0b3403 |
* `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)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
* `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)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+## Build JSON Templates
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+In the `build_json_dir` there must be `prod.json` and `prod_inner.json` which
|
|
|
f0b3403 |
+defines the [OpenShift Build](https://docs.openshift.org/latest/dev_guide/builds.html)
|
|
|
f0b3403 |
+specification that will be used to enable the specific
|
|
|
f0b3403 |
+[atomic-reactor](https://github.com/projectatomic/atomic-reactor) plugins that
|
|
|
f0b3403 |
+should be enabled and the config values for each.
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+There is also a third file that is optional that can exist along side the
|
|
|
f0b3403 |
+previous two in `build_json_dir` which is `prod_customize.json` and it will
|
|
|
f0b3403 |
+provide the ability to set site-specific customizations such as removing,
|
|
|
f0b3403 |
+plugins, adding plugins, or overriding arguments passed to existing plugins.
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+The syntax of `prod_customize.json` is as follows:
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+```json
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "disable_plugins": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": "foo_type",
|
|
|
f0b3403 |
+ "plugin_name": "foo_name"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": "bar_type",
|
|
|
f0b3403 |
+ "plugin_name": "bar_name"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ "enable_plugins": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": "foo_type",
|
|
|
f0b3403 |
+ "plugin_name": "foo_name",
|
|
|
f0b3403 |
+ "plugin_args": {
|
|
|
f0b3403 |
+ "foo_arg1": "foo_value1",
|
|
|
f0b3403 |
+ "foo_arg2": "foo_value2"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ]
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
+```
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+Such that:
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+* `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.
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+* `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.
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
diff --git a/inputs/prod_customize.json b/inputs/prod_customize.json
|
|
|
f0b3403 |
new file mode 100644
|
|
|
f0b3403 |
index 0000000..e874211
|
|
|
f0b3403 |
--- /dev/null
|
|
|
f0b3403 |
+++ b/inputs/prod_customize.json
|
|
|
f0b3403 |
@@ -0,0 +1,7 @@
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "disable_plugins": [
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ "enable_plugins": [
|
|
|
f0b3403 |
+ ]
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
diff --git a/inputs/prod_inner.json b/inputs/prod_inner.json
|
|
|
f0b3403 |
index 306ac89..d2b5b4e 100644
|
|
|
f0b3403 |
--- a/inputs/prod_inner.json
|
|
|
f0b3403 |
+++ b/inputs/prod_inner.json
|
|
|
f0b3403 |
@@ -154,7 +154,9 @@
|
|
|
f0b3403 |
"kojihub": "{{KOJI_HUB}}",
|
|
|
f0b3403 |
"url": "{{OPENSHIFT_URI}}",
|
|
|
f0b3403 |
"verify_ssl": false,
|
|
|
f0b3403 |
- "blocksize": 10485760
|
|
|
f0b3403 |
+ "blocksize": 10485760,
|
|
|
f0b3403 |
+ "koji_keytab": false,
|
|
|
f0b3403 |
+ "koji_principal": false
|
|
|
f0b3403 |
}
|
|
|
f0b3403 |
},
|
|
|
f0b3403 |
{
|
|
|
f0b3403 |
diff --git a/osbs-client.spec b/osbs-client.spec
|
|
|
f0b3403 |
index 46423e3..c53b99b 100644
|
|
|
f0b3403 |
--- a/osbs-client.spec
|
|
|
f0b3403 |
+++ b/osbs-client.spec
|
|
|
f0b3403 |
@@ -22,7 +22,7 @@
|
|
|
f0b3403 |
%global with_check 1
|
|
|
f0b3403 |
%endif
|
|
|
f0b3403 |
|
|
|
f0b3403 |
-%global commit 5021224746eb0e6ac12c54c397397b629167030b
|
|
|
f0b3403 |
+%global commit 696505ae4da4898a4e3689ef18e1f6791b04ea09
|
|
|
f0b3403 |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
f0b3403 |
# set to 0 to create a normal release
|
|
|
f0b3403 |
%global postrelease 0
|
|
|
f0b3403 |
diff --git a/osbs/api.py b/osbs/api.py
|
|
|
f0b3403 |
index 1a8e5c5..b2c45d2 100644
|
|
|
f0b3403 |
--- a/osbs/api.py
|
|
|
f0b3403 |
+++ b/osbs/api.py
|
|
|
f0b3403 |
@@ -338,8 +338,9 @@ class OSBS(object):
|
|
|
f0b3403 |
@osbsapi
|
|
|
f0b3403 |
def create_prod_build(self, git_uri, git_ref,
|
|
|
f0b3403 |
git_branch, # may be None
|
|
|
f0b3403 |
- user, component,
|
|
|
f0b3403 |
- target, # may be None
|
|
|
f0b3403 |
+ user,
|
|
|
f0b3403 |
+ component=None,
|
|
|
f0b3403 |
+ target=None,
|
|
|
f0b3403 |
architecture=None, yum_repourls=None,
|
|
|
f0b3403 |
koji_task_id=None,
|
|
|
f0b3403 |
scratch=None,
|
|
|
f0b3403 |
@@ -351,25 +352,35 @@ class OSBS(object):
|
|
|
f0b3403 |
:param git_ref: str, reference to commit
|
|
|
f0b3403 |
:param git_branch: str, branch name (may be None)
|
|
|
f0b3403 |
:param user: str, user name
|
|
|
f0b3403 |
- :param component: str, component name
|
|
|
f0b3403 |
- :param target: str, koji target (may be None)
|
|
|
f0b3403 |
+ :param component: str, not used anymore
|
|
|
f0b3403 |
+ :param target: str, koji target
|
|
|
f0b3403 |
:param architecture: str, build architecture
|
|
|
f0b3403 |
:param yum_repourls: list, URLs for yum repos
|
|
|
f0b3403 |
:param koji_task_id: int, koji task ID requesting build
|
|
|
f0b3403 |
:param scratch: bool, this is a scratch build
|
|
|
f0b3403 |
:return: BuildResponse instance
|
|
|
f0b3403 |
"""
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def get_required_label(labels, names):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ get value of label list, first found is returned
|
|
|
f0b3403 |
+ names has to be non empty tuple
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ assert names # always called with a non-empty literal tuple so names[0] is safe
|
|
|
f0b3403 |
+ for label_name in names:
|
|
|
f0b3403 |
+ if label_name in labels:
|
|
|
f0b3403 |
+ return labels[label_name]
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ raise OsbsValidationException("required label '{name}' missing "
|
|
|
f0b3403 |
+ "from Dockerfile"
|
|
|
f0b3403 |
+ .format(name=names[0]))
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
df_parser = utils.get_df_parser(git_uri, git_ref, git_branch=git_branch)
|
|
|
f0b3403 |
build_request = self.get_build_request()
|
|
|
f0b3403 |
labels = df_parser.labels
|
|
|
f0b3403 |
- for name_label_name in ['name', 'Name']:
|
|
|
f0b3403 |
- if name_label_name in labels:
|
|
|
f0b3403 |
- name_label = labels[name_label_name]
|
|
|
f0b3403 |
- break
|
|
|
f0b3403 |
- else:
|
|
|
f0b3403 |
- raise OsbsValidationException("required label '{name}' missing "
|
|
|
f0b3403 |
- "from Dockerfile"
|
|
|
f0b3403 |
- .format(name=name_label_name))
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ name_label = get_required_label(labels, ('name', 'Name'))
|
|
|
f0b3403 |
+ component = get_required_label(labels, ('com.redhat.component', 'BZComponent'))
|
|
|
f0b3403 |
|
|
|
f0b3403 |
build_request.set_params(
|
|
|
f0b3403 |
git_uri=git_uri,
|
|
|
f0b3403 |
@@ -393,6 +404,9 @@ class OSBS(object):
|
|
|
f0b3403 |
koji_target=target,
|
|
|
f0b3403 |
koji_certs_secret=self.build_conf.get_koji_certs_secret(),
|
|
|
f0b3403 |
koji_task_id=koji_task_id,
|
|
|
f0b3403 |
+ koji_use_kerberos=self.build_conf.get_koji_use_kerberos(),
|
|
|
f0b3403 |
+ koji_kerberos_keytab=self.build_conf.get_koji_kerberos_keytab(),
|
|
|
f0b3403 |
+ koji_kerberos_principal=self.build_conf.get_koji_kerberos_principal(),
|
|
|
f0b3403 |
architecture=architecture,
|
|
|
f0b3403 |
vendor=self.build_conf.get_vendor(),
|
|
|
f0b3403 |
build_host=self.build_conf.get_build_host(),
|
|
|
f0b3403 |
@@ -408,8 +422,6 @@ class OSBS(object):
|
|
|
f0b3403 |
pulp_registry=self.os_conf.get_pulp_registry(),
|
|
|
f0b3403 |
nfs_server_path=self.os_conf.get_nfs_server_path(),
|
|
|
f0b3403 |
nfs_dest_dir=self.build_conf.get_nfs_destination_dir(),
|
|
|
f0b3403 |
- git_push_url=self.build_conf.get_git_push_url(),
|
|
|
f0b3403 |
- git_push_username=self.build_conf.get_git_push_username(),
|
|
|
f0b3403 |
builder_build_json_dir=self.build_conf.get_builder_build_json_store(),
|
|
|
f0b3403 |
scratch=self.build_conf.get_scratch(scratch),
|
|
|
f0b3403 |
unique_tag_only=self.build_conf.get_unique_tag_only(),
|
|
|
f0b3403 |
@@ -423,14 +435,16 @@ class OSBS(object):
|
|
|
f0b3403 |
return response
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@osbsapi
|
|
|
f0b3403 |
- def create_prod_with_secret_build(self, git_uri, git_ref, git_branch, user, component,
|
|
|
f0b3403 |
- target, architecture=None, yum_repourls=None, **kwargs):
|
|
|
f0b3403 |
+ def create_prod_with_secret_build(self, git_uri, git_ref, git_branch, user, component=None,
|
|
|
f0b3403 |
+ target=None, architecture=None, yum_repourls=None, **kwargs):
|
|
|
f0b3403 |
+ warnings.warn("create_prod_with_secret_build is deprecated, please use create_build")
|
|
|
f0b3403 |
return self.create_prod_build(git_uri, git_ref, git_branch, user, component, target,
|
|
|
f0b3403 |
architecture, yum_repourls=yum_repourls, **kwargs)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@osbsapi
|
|
|
f0b3403 |
- def create_prod_without_koji_build(self, git_uri, git_ref, git_branch, user, component,
|
|
|
f0b3403 |
+ def create_prod_without_koji_build(self, git_uri, git_ref, git_branch, user, component=None,
|
|
|
f0b3403 |
architecture=None, yum_repourls=None, **kwargs):
|
|
|
f0b3403 |
+ warnings.warn("create_prod_without_koji_build is deprecated, please use create_build")
|
|
|
f0b3403 |
return self.create_prod_build(git_uri, git_ref, git_branch, user, component, None,
|
|
|
f0b3403 |
architecture, yum_repourls=yum_repourls, **kwargs)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -448,7 +462,6 @@ class OSBS(object):
|
|
|
f0b3403 |
:return: instance of BuildRequest
|
|
|
f0b3403 |
"""
|
|
|
f0b3403 |
kwargs.setdefault('git_branch', None)
|
|
|
f0b3403 |
- kwargs.setdefault('target', None)
|
|
|
f0b3403 |
return self.create_prod_build(**kwargs)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@osbsapi
|
|
|
f0b3403 |
diff --git a/osbs/build/build_request.py b/osbs/build/build_request.py
|
|
|
f0b3403 |
index 2dda77d..f8ef056 100644
|
|
|
f0b3403 |
--- a/osbs/build/build_request.py
|
|
|
f0b3403 |
+++ b/osbs/build/build_request.py
|
|
|
f0b3403 |
@@ -24,7 +24,7 @@ except ImportError:
|
|
|
f0b3403 |
|
|
|
f0b3403 |
from osbs.build.manipulate import DockJsonManipulator
|
|
|
f0b3403 |
from osbs.build.spec import BuildSpec
|
|
|
f0b3403 |
-from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE
|
|
|
f0b3403 |
+from osbs.constants import SECRETS_PATH, DEFAULT_OUTER_TEMPLATE, DEFAULT_INNER_TEMPLATE, DEFAULT_CUSTOMIZE_CONF
|
|
|
f0b3403 |
from osbs.exceptions import OsbsException, OsbsValidationException
|
|
|
f0b3403 |
from osbs.utils import looks_like_git_hash, git_repo_humanish_part_from_uri
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -46,6 +46,7 @@ class BuildRequest(object):
|
|
|
f0b3403 |
self.build_json = None # rendered template
|
|
|
f0b3403 |
self._template = None # template loaded from filesystem
|
|
|
f0b3403 |
self._inner_template = None # dock json
|
|
|
f0b3403 |
+ self._customize_conf = None # site customize conf for _inner_template
|
|
|
f0b3403 |
self._dj = None
|
|
|
f0b3403 |
self._resource_limits = None
|
|
|
f0b3403 |
self._openshift_required_version = parse_version('1.0.6')
|
|
|
f0b3403 |
@@ -77,7 +78,6 @@ class BuildRequest(object):
|
|
|
f0b3403 |
:param distribution_scope: str, distribution scope for this image
|
|
|
f0b3403 |
(private, authoritative-source-only, restricted, public)
|
|
|
f0b3403 |
:param use_auth: bool, use auth from atomic-reactor?
|
|
|
f0b3403 |
- :param git_push_url: str, URL for git push
|
|
|
f0b3403 |
"""
|
|
|
f0b3403 |
|
|
|
f0b3403 |
# Here we cater to the koji "scratch" build type, this will disable
|
|
|
f0b3403 |
@@ -136,6 +136,20 @@ class BuildRequest(object):
|
|
|
f0b3403 |
return self._inner_template
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@property
|
|
|
f0b3403 |
+ def customize_conf(self):
|
|
|
f0b3403 |
+ if self._customize_conf is None:
|
|
|
f0b3403 |
+ path = os.path.join(self.build_json_store, DEFAULT_CUSTOMIZE_CONF)
|
|
|
f0b3403 |
+ logger.debug("loading customize conf from path %s", path)
|
|
|
f0b3403 |
+ try:
|
|
|
f0b3403 |
+ with open(path, "r") as fp:
|
|
|
f0b3403 |
+ self._customize_conf= json.load(fp)
|
|
|
f0b3403 |
+ except IOError:
|
|
|
f0b3403 |
+ # File not found, which is perfectly fine. Set to empty string
|
|
|
f0b3403 |
+ self._customize_conf = {}
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ return self._customize_conf
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ @property
|
|
|
f0b3403 |
def dj(self):
|
|
|
f0b3403 |
if self._dj is None:
|
|
|
f0b3403 |
self._dj = DockJsonManipulator(self.template, self.inner_template)
|
|
|
f0b3403 |
@@ -367,7 +381,8 @@ class BuildRequest(object):
|
|
|
f0b3403 |
# Note: only one for now, but left in a list like other adjust_for_
|
|
|
f0b3403 |
# functions in the event that this needs to be expanded
|
|
|
f0b3403 |
for when, which in [
|
|
|
f0b3403 |
- ("exit_plugins", "koji_promote"),
|
|
|
f0b3403 |
+ ("postbuild_plugins", "compress"),
|
|
|
f0b3403 |
+ ("exit_plugins", "koji_promote"),
|
|
|
f0b3403 |
]:
|
|
|
f0b3403 |
logger.info("removing %s from request because there are no triggers",
|
|
|
f0b3403 |
which)
|
|
|
f0b3403 |
@@ -485,7 +500,15 @@ class BuildRequest(object):
|
|
|
f0b3403 |
|
|
|
f0b3403 |
if use_auth is not None:
|
|
|
f0b3403 |
self.dj.dock_json_set_arg('exit_plugins', 'koji_promote',
|
|
|
f0b3403 |
- 'use_auth', use_auth)
|
|
|
f0b3403 |
+ 'use_auth', use_auth)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ if (self.spec.koji_use_kerberos.value and
|
|
|
f0b3403 |
+ self.spec.koji_kerberos_principal.value and
|
|
|
f0b3403 |
+ self.spec.koji_kerberos_keytab.value):
|
|
|
f0b3403 |
+ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote',
|
|
|
f0b3403 |
+ 'koji_principal', self.spec.koji_kerberos_principal.value)
|
|
|
f0b3403 |
+ self.dj.dock_json_set_arg('exit_plugins', 'koji_promote',
|
|
|
f0b3403 |
+ 'koji_keytab', self.spec.koji_kerberos_keytab.value)
|
|
|
f0b3403 |
else:
|
|
|
f0b3403 |
logger.info("removing koji_promote from request as no kojihub "
|
|
|
f0b3403 |
"specified")
|
|
|
f0b3403 |
@@ -648,10 +671,60 @@ class BuildRequest(object):
|
|
|
f0b3403 |
self.dj.dock_json_set_arg('postbuild_plugins', 'import_image',
|
|
|
f0b3403 |
'insecure_registry', True)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def render_customizations(self):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ Customize prod_inner for site specific customizations
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ disable_plugins = self.customize_conf.get('disable_plugins', [])
|
|
|
f0b3403 |
+ if not disable_plugins:
|
|
|
f0b3403 |
+ logger.debug("No site-specific plugins to disable")
|
|
|
f0b3403 |
+ else:
|
|
|
f0b3403 |
+ for plugin_dict in disable_plugins:
|
|
|
f0b3403 |
+ try:
|
|
|
f0b3403 |
+ self.dj.remove_plugin(
|
|
|
f0b3403 |
+ plugin_dict['plugin_type'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_name']
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ logger.debug(
|
|
|
f0b3403 |
+ "site-specific plugin disabled -> Type:{0} Name:{1}".format(
|
|
|
f0b3403 |
+ plugin_dict['plugin_type'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_name']
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ except KeyError:
|
|
|
f0b3403 |
+ # Malformed config
|
|
|
f0b3403 |
+ logger.debug("Invalid custom configuration found for disable_plugins")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ enable_plugins = self.customize_conf.get('enable_plugins', [])
|
|
|
f0b3403 |
+ if not enable_plugins:
|
|
|
f0b3403 |
+ logger.debug("No site-specific plugins to enable")
|
|
|
f0b3403 |
+ else:
|
|
|
f0b3403 |
+ for plugin_dict in enable_plugins:
|
|
|
f0b3403 |
+ try:
|
|
|
f0b3403 |
+ self.dj.add_plugin(
|
|
|
f0b3403 |
+ plugin_dict['plugin_type'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_name'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_args']
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ logger.debug(
|
|
|
f0b3403 |
+ "site-specific plugin enabled -> Type:{0} Name:{1} Args: {2}".format(
|
|
|
f0b3403 |
+ plugin_dict['plugin_type'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_name'],
|
|
|
f0b3403 |
+ plugin_dict['plugin_args']
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ except KeyError:
|
|
|
f0b3403 |
+ # Malformed config
|
|
|
f0b3403 |
+ logger.debug("Invalid custom configuration found for enable_plugins")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def render(self, validate=True):
|
|
|
f0b3403 |
if validate:
|
|
|
f0b3403 |
self.spec.validate()
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ self.render_customizations()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
# !IMPORTANT! can't be too long: https://github.com/openshift/origin/issues/733
|
|
|
f0b3403 |
self.template['metadata']['name'] = self.spec.name.value
|
|
|
f0b3403 |
self.render_resource_limits()
|
|
|
f0b3403 |
@@ -715,16 +788,8 @@ class BuildRequest(object):
|
|
|
f0b3403 |
self.dj.dock_json_set_arg('prebuild_plugins', "pull_base_image", "parent_registry",
|
|
|
f0b3403 |
source_registry.docker_uri if source_registry else None)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- # The rebuild trigger requires git_branch and git_push_url
|
|
|
f0b3403 |
- # parameters, but those parameters are optional. If either was
|
|
|
f0b3403 |
- # not provided, remove the trigger.
|
|
|
f0b3403 |
+ # Set to true to disable triggers in BuildConfig
|
|
|
f0b3403 |
remove_triggers = False
|
|
|
f0b3403 |
- for param_name in ['git_branch', 'git_push_url']:
|
|
|
f0b3403 |
- param = getattr(self.spec, param_name)
|
|
|
f0b3403 |
- if not param.value:
|
|
|
f0b3403 |
- logger.info("removing triggers as no %s specified", param_name)
|
|
|
f0b3403 |
- remove_triggers = True
|
|
|
f0b3403 |
- # Continue the loop so we log everything that's missing
|
|
|
f0b3403 |
|
|
|
f0b3403 |
if self.is_custom_base_image():
|
|
|
f0b3403 |
logger.info('removing triggers for custom base image build')
|
|
|
f0b3403 |
diff --git a/osbs/build/build_response.py b/osbs/build/build_response.py
|
|
|
f0b3403 |
index 2e28ee5..8461805 100644
|
|
|
f0b3403 |
--- a/osbs/build/build_response.py
|
|
|
f0b3403 |
+++ b/osbs/build/build_response.py
|
|
|
f0b3403 |
@@ -27,6 +27,7 @@ class BuildResponse(object):
|
|
|
f0b3403 |
"""
|
|
|
f0b3403 |
self.json = build_json
|
|
|
f0b3403 |
self._status = None
|
|
|
f0b3403 |
+ self._cancelled = None
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@property
|
|
|
f0b3403 |
def status(self):
|
|
|
f0b3403 |
@@ -39,6 +40,18 @@ class BuildResponse(object):
|
|
|
f0b3403 |
cap_value = value.capitalize()
|
|
|
f0b3403 |
logger.info("changing status from %s to %s", self.status, cap_value)
|
|
|
f0b3403 |
self.json['status']['phase'] = cap_value
|
|
|
f0b3403 |
+ self._status = value
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ @property
|
|
|
f0b3403 |
+ def cancelled(self):
|
|
|
f0b3403 |
+ if self._cancelled is None:
|
|
|
f0b3403 |
+ self._cancelled = self.json['status'].get('cancelled')
|
|
|
f0b3403 |
+ return self._cancelled
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ @cancelled.setter
|
|
|
f0b3403 |
+ def cancelled(self, value):
|
|
|
f0b3403 |
+ self.json['status']['cancelled'] = value
|
|
|
f0b3403 |
+ self._cancelled = value
|
|
|
f0b3403 |
|
|
|
f0b3403 |
def is_finished(self):
|
|
|
f0b3403 |
return self.status in BUILD_FINISHED_STATES
|
|
|
f0b3403 |
diff --git a/osbs/build/manipulate.py b/osbs/build/manipulate.py
|
|
|
f0b3403 |
index a6b64cf..a0fd1b8 100644
|
|
|
f0b3403 |
--- a/osbs/build/manipulate.py
|
|
|
f0b3403 |
+++ b/osbs/build/manipulate.py
|
|
|
f0b3403 |
@@ -50,6 +50,21 @@ class DockJsonManipulator(object):
|
|
|
f0b3403 |
self.dock_json[plugin_type].remove(p)
|
|
|
f0b3403 |
break
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def add_plugin(self, plugin_type, plugin_name, args_dict):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ if config has plugin, override it, else add it
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ plugin_modified = False
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ for plugin in self.dock_json[plugin_type]:
|
|
|
f0b3403 |
+ if plugin['name'] == plugin_name:
|
|
|
f0b3403 |
+ plugin['args'] = args_dict
|
|
|
f0b3403 |
+ plugin_modified = True
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ if not plugin_modified:
|
|
|
f0b3403 |
+ self.dock_json[plugin_type].append({"name": plugin_name, "args": args_dict})
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def dock_json_has_plugin_conf(self, plugin_type, plugin_name):
|
|
|
f0b3403 |
"""
|
|
|
f0b3403 |
Check whether a plugin is configured.
|
|
|
f0b3403 |
diff --git a/osbs/build/spec.py b/osbs/build/spec.py
|
|
|
f0b3403 |
index 1f68281..40d516c 100644
|
|
|
f0b3403 |
--- a/osbs/build/spec.py
|
|
|
f0b3403 |
+++ b/osbs/build/spec.py
|
|
|
f0b3403 |
@@ -147,6 +147,9 @@ class BuildSpec(object):
|
|
|
f0b3403 |
kojihub = BuildParam("kojihub", allow_none=True)
|
|
|
f0b3403 |
koji_certs_secret = BuildParam("koji_certs_secret", allow_none=True)
|
|
|
f0b3403 |
koji_task_id = BuildParam("koji_task_id", allow_none=True)
|
|
|
f0b3403 |
+ koji_use_kerberos = BuildParam("koji_use_kerberos", allow_none=True)
|
|
|
f0b3403 |
+ koji_kerberos_principal = BuildParam("koji_kerberos_principal", allow_none=True)
|
|
|
f0b3403 |
+ koji_kerberos_keytab = BuildParam("koji_kerberos_keytab", allow_none=True)
|
|
|
f0b3403 |
image_tag = BuildParam("image_tag")
|
|
|
f0b3403 |
pulp_secret = BuildParam("pulp_secret", allow_none=True)
|
|
|
f0b3403 |
pulp_registry = BuildParam("pulp_registry", allow_none=True)
|
|
|
f0b3403 |
@@ -155,8 +158,6 @@ class BuildSpec(object):
|
|
|
f0b3403 |
smtp_uri = BuildParam("smtp_uri", allow_none=True)
|
|
|
f0b3403 |
nfs_server_path = BuildParam("nfs_server_path", allow_none=True)
|
|
|
f0b3403 |
nfs_dest_dir = BuildParam("nfs_dest_dir", allow_none=True)
|
|
|
f0b3403 |
- git_push_url = BuildParam("git_push_url", allow_none=True)
|
|
|
f0b3403 |
- git_push_username = BuildParam("git_push_username", allow_none=True)
|
|
|
f0b3403 |
builder_build_json_dir = BuildParam("builder_build_json_dir", allow_none=True)
|
|
|
f0b3403 |
unique_tag_only = BuildParam("unique_tag_only", allow_none=True)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -165,7 +166,6 @@ class BuildSpec(object):
|
|
|
f0b3403 |
self.git_uri,
|
|
|
f0b3403 |
self.git_ref,
|
|
|
f0b3403 |
self.user,
|
|
|
f0b3403 |
- self.component,
|
|
|
f0b3403 |
self.registry_uris,
|
|
|
f0b3403 |
self.openshift_uri,
|
|
|
f0b3403 |
self.sources_command,
|
|
|
f0b3403 |
@@ -183,8 +183,6 @@ class BuildSpec(object):
|
|
|
f0b3403 |
self.pdc_url,
|
|
|
f0b3403 |
self.smtp_uri,
|
|
|
f0b3403 |
self.nfs_server_path,
|
|
|
f0b3403 |
- self.git_push_url,
|
|
|
f0b3403 |
- self.git_push_username,
|
|
|
f0b3403 |
]
|
|
|
f0b3403 |
|
|
|
f0b3403 |
def set_params(self, git_uri=None, git_ref=None,
|
|
|
f0b3403 |
@@ -197,12 +195,13 @@ class BuildSpec(object):
|
|
|
f0b3403 |
sources_command=None, architecture=None, vendor=None,
|
|
|
f0b3403 |
build_host=None, authoritative_registry=None, distribution_scope=None,
|
|
|
f0b3403 |
koji_target=None, kojiroot=None, kojihub=None, koji_certs_secret=None,
|
|
|
f0b3403 |
- koji_task_id=None,
|
|
|
f0b3403 |
+ koji_use_kerberos=None, koji_kerberos_keytab=None,
|
|
|
f0b3403 |
+ koji_kerberos_principal=None, koji_task_id=None,
|
|
|
f0b3403 |
source_secret=None, # compatibility name for pulp_secret
|
|
|
f0b3403 |
pulp_secret=None, pulp_registry=None, pdc_secret=None, pdc_url=None,
|
|
|
f0b3403 |
smtp_uri=None, nfs_server_path=None,
|
|
|
f0b3403 |
nfs_dest_dir=None, git_branch=None, base_image=None,
|
|
|
f0b3403 |
- name_label=None, git_push_url=None, git_push_username=None,
|
|
|
f0b3403 |
+ name_label=None,
|
|
|
f0b3403 |
builder_build_json_dir=None, registry_api_versions=None,
|
|
|
f0b3403 |
unique_tag_only=None,
|
|
|
f0b3403 |
**kwargs):
|
|
|
f0b3403 |
@@ -240,6 +239,9 @@ class BuildSpec(object):
|
|
|
f0b3403 |
self.kojiroot.value = kojiroot
|
|
|
f0b3403 |
self.kojihub.value = kojihub
|
|
|
f0b3403 |
self.koji_certs_secret.value = koji_certs_secret
|
|
|
f0b3403 |
+ self.koji_use_kerberos.value = koji_use_kerberos
|
|
|
f0b3403 |
+ self.koji_kerberos_principal.value = koji_kerberos_principal
|
|
|
f0b3403 |
+ self.koji_kerberos_keytab.value = koji_kerberos_keytab
|
|
|
f0b3403 |
self.koji_task_id.value = koji_task_id
|
|
|
f0b3403 |
self.pulp_secret.value = pulp_secret or source_secret
|
|
|
f0b3403 |
self.pulp_registry.value = pulp_registry
|
|
|
f0b3403 |
@@ -248,8 +250,6 @@ class BuildSpec(object):
|
|
|
f0b3403 |
self.smtp_uri.value = smtp_uri
|
|
|
f0b3403 |
self.nfs_server_path.value = nfs_server_path
|
|
|
f0b3403 |
self.nfs_dest_dir.value = nfs_dest_dir
|
|
|
f0b3403 |
- self.git_push_url.value = git_push_url
|
|
|
f0b3403 |
- self.git_push_username.value = git_push_username
|
|
|
f0b3403 |
self.git_branch.value = git_branch
|
|
|
f0b3403 |
self.name.value = make_name_from_git(self.git_uri.value, self.git_branch.value)
|
|
|
f0b3403 |
if not base_image:
|
|
|
f0b3403 |
diff --git a/osbs/cli/main.py b/osbs/cli/main.py
|
|
|
f0b3403 |
index a828b97..6f6b118 100644
|
|
|
f0b3403 |
--- a/osbs/cli/main.py
|
|
|
f0b3403 |
+++ b/osbs/cli/main.py
|
|
|
f0b3403 |
@@ -10,6 +10,7 @@ import collections
|
|
|
f0b3403 |
|
|
|
f0b3403 |
import json
|
|
|
f0b3403 |
import logging
|
|
|
f0b3403 |
+import pkg_resources
|
|
|
f0b3403 |
|
|
|
f0b3403 |
from textwrap import dedent
|
|
|
f0b3403 |
import codecs
|
|
|
f0b3403 |
@@ -277,7 +278,6 @@ def cmd_build(args, osbs):
|
|
|
f0b3403 |
git_ref=osbs.build_conf.get_git_ref(),
|
|
|
f0b3403 |
git_branch=osbs.build_conf.get_git_branch(),
|
|
|
f0b3403 |
user=osbs.build_conf.get_user(),
|
|
|
f0b3403 |
- component=osbs.build_conf.get_component(),
|
|
|
f0b3403 |
tag=osbs.build_conf.get_tag(),
|
|
|
f0b3403 |
target=osbs.build_conf.get_koji_target(),
|
|
|
f0b3403 |
architecture=osbs.build_conf.get_architecture(),
|
|
|
f0b3403 |
@@ -458,6 +458,11 @@ def str_on_2_unicode_on_3(s):
|
|
|
f0b3403 |
|
|
|
f0b3403 |
|
|
|
f0b3403 |
def cli():
|
|
|
f0b3403 |
+ try:
|
|
|
f0b3403 |
+ version = pkg_resources.get_distribution("osbs-client").version
|
|
|
f0b3403 |
+ except pkg_resources.DistributionNotFound:
|
|
|
f0b3403 |
+ version = "GIT"
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
parser = argparse.ArgumentParser(
|
|
|
f0b3403 |
description="OpenShift Build Service client"
|
|
|
f0b3403 |
)
|
|
|
f0b3403 |
@@ -466,6 +471,7 @@ def cli():
|
|
|
f0b3403 |
# that the option was not specified
|
|
|
f0b3403 |
exclusive_group.add_argument("--verbose", action="store_true", default=None)
|
|
|
f0b3403 |
exclusive_group.add_argument("-q", "--quiet", action="store_true")
|
|
|
f0b3403 |
+ exclusive_group.add_argument("-V", "--version", action="version", version=version)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
subparsers = parser.add_subparsers(help='commands')
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -559,8 +565,8 @@ def cli():
|
|
|
f0b3403 |
help="build architecture")
|
|
|
f0b3403 |
build_parser.add_argument("-u", "--user", action='store', required=True,
|
|
|
f0b3403 |
help="prefix for docker image repository")
|
|
|
f0b3403 |
- build_parser.add_argument("-c", "--component", action='store', required=True,
|
|
|
f0b3403 |
- help="name of component")
|
|
|
f0b3403 |
+ build_parser.add_argument("-c", "--component", action='store', required=False,
|
|
|
f0b3403 |
+ help="not used; use com.redhat.component label in Dockerfile")
|
|
|
f0b3403 |
build_parser.add_argument("-A", "--tag", action='store', required=False,
|
|
|
f0b3403 |
help="tag of the built image (simple builds only)")
|
|
|
f0b3403 |
build_parser.add_argument("--no-logs", action='store_true', required=False, default=False,
|
|
|
f0b3403 |
diff --git a/osbs/conf.py b/osbs/conf.py
|
|
|
f0b3403 |
index bb92ca7..97cd677 100644
|
|
|
f0b3403 |
--- a/osbs/conf.py
|
|
|
f0b3403 |
+++ b/osbs/conf.py
|
|
|
f0b3403 |
@@ -186,9 +186,6 @@ class Configuration(object):
|
|
|
f0b3403 |
""" user namespace when tagging and pushing image """
|
|
|
f0b3403 |
return self._get_value("user", self.conf_section, "user")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- def get_component(self):
|
|
|
f0b3403 |
- return self._get_value("component", self.conf_section, "component")
|
|
|
f0b3403 |
-
|
|
|
f0b3403 |
def get_tag(self):
|
|
|
f0b3403 |
return self._get_value("tag", self.conf_section, "tag")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -211,6 +208,15 @@ class Configuration(object):
|
|
|
f0b3403 |
def get_koji_certs_secret(self):
|
|
|
f0b3403 |
return self._get_value("koji_certs_secret", self.conf_section, "koji_certs_secret")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def get_koji_use_kerberos(self):
|
|
|
f0b3403 |
+ return self._get_value("koji_use_kerberos", self.conf_section, "koji_use_kerberos", is_bool_val=True)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def get_koji_kerberos_keytab(self):
|
|
|
f0b3403 |
+ return self._get_value("koji_kerberos_keytab", self.conf_section, "koji_kerberos_keytab")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def get_koji_kerberos_principal(self):
|
|
|
f0b3403 |
+ return self._get_value("koji_kerberos_principal", self.conf_section, "koji_kerberos_principal")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def get_sources_command(self):
|
|
|
f0b3403 |
return self._get_value("sources_command", self.conf_section, "sources_command")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -312,9 +318,8 @@ class Configuration(object):
|
|
|
f0b3403 |
key = "builder_build_json_dir"
|
|
|
f0b3403 |
builder_build_json_dir = self._get_value(key, self.conf_section, key)
|
|
|
f0b3403 |
if builder_build_json_dir is None:
|
|
|
f0b3403 |
- fallback_key = "build_json_dir"
|
|
|
f0b3403 |
- logger.warning("%r not found, falling back %r", key, fallback_key)
|
|
|
f0b3403 |
- builder_build_json_dir = self._get_value(fallback_key, self.conf_section, fallback_key)
|
|
|
f0b3403 |
+ logger.warning("%r not found, falling back to build_json_dir", key)
|
|
|
f0b3403 |
+ builder_build_json_dir = self.get_build_json_store()
|
|
|
f0b3403 |
return builder_build_json_dir
|
|
|
f0b3403 |
|
|
|
f0b3403 |
def get_pulp_secret(self):
|
|
|
f0b3403 |
@@ -353,12 +358,6 @@ class Configuration(object):
|
|
|
f0b3403 |
def get_storage_limit(self):
|
|
|
f0b3403 |
return self._get_value("storage_limit", self.conf_section, "storage_limit")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- def get_git_push_url(self):
|
|
|
f0b3403 |
- return self._get_value("git_push_url", self.conf_section, "git_push_url")
|
|
|
f0b3403 |
-
|
|
|
f0b3403 |
- def get_git_push_username(self):
|
|
|
f0b3403 |
- return self._get_value("git_push_username", self.conf_section, "git_push_username")
|
|
|
f0b3403 |
-
|
|
|
f0b3403 |
def get_build_image(self):
|
|
|
f0b3403 |
return self._get_value("build_image", self.conf_section, "build_image")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
diff --git a/osbs/constants.py b/osbs/constants.py
|
|
|
f0b3403 |
index 649626c..282f002 100644
|
|
|
f0b3403 |
--- a/osbs/constants.py
|
|
|
f0b3403 |
+++ b/osbs/constants.py
|
|
|
f0b3403 |
@@ -18,6 +18,7 @@ DEFAULT_CONFIGURATION_FILE = "/etc/osbs.conf"
|
|
|
f0b3403 |
DEFAULT_CONFIGURATION_SECTION = "default"
|
|
|
f0b3403 |
DEFAULT_OUTER_TEMPLATE = "prod.json"
|
|
|
f0b3403 |
DEFAULT_INNER_TEMPLATE = "prod_inner.json"
|
|
|
f0b3403 |
+DEFAULT_CUSTOMIZE_CONF = "prod_customize.json"
|
|
|
f0b3403 |
GENERAL_CONFIGURATION_SECTION = "general"
|
|
|
f0b3403 |
POD_FINISHED_STATES = ["failed", "succeeded"]
|
|
|
f0b3403 |
POD_FAILED_STATES = ["failed"]
|
|
|
f0b3403 |
diff --git a/osbs/core.py b/osbs/core.py
|
|
|
f0b3403 |
index 9a93846..9eeeece 100755
|
|
|
f0b3403 |
--- a/osbs/core.py
|
|
|
f0b3403 |
+++ b/osbs/core.py
|
|
|
f0b3403 |
@@ -293,7 +293,7 @@ class Openshift(object):
|
|
|
f0b3403 |
def cancel_build(self, build_id):
|
|
|
f0b3403 |
response = self.get_build(build_id)
|
|
|
f0b3403 |
br = BuildResponse(response.json())
|
|
|
f0b3403 |
- br.status = BUILD_CANCELLED_STATE
|
|
|
f0b3403 |
+ br.cancelled = True
|
|
|
f0b3403 |
url = self._build_url("builds/%s/" % build_id)
|
|
|
f0b3403 |
return self._put(url, data=json.dumps(br.json),
|
|
|
f0b3403 |
headers={"Content-Type": "application/json"})
|
|
|
f0b3403 |
diff --git a/tests/build/test_build_request.py b/tests/build/test_build_request.py
|
|
|
f0b3403 |
index 6af5e53..c32b5d9 100644
|
|
|
f0b3403 |
--- a/tests/build/test_build_request.py
|
|
|
f0b3403 |
+++ b/tests/build/test_build_request.py
|
|
|
f0b3403 |
@@ -706,7 +706,8 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
['v1', 'v2'],
|
|
|
f0b3403 |
['v2'],
|
|
|
f0b3403 |
])
|
|
|
f0b3403 |
- def test_render_prod_request_v1_v2(self, registry_api_versions):
|
|
|
f0b3403 |
+ @pytest.mark.parametrize('scratch', [False, True])
|
|
|
f0b3403 |
+ def test_render_prod_request_v1_v2(self, registry_api_versions, scratch):
|
|
|
f0b3403 |
build_request = BuildRequest(INPUTS_PATH)
|
|
|
f0b3403 |
name_label = "fedora/resultingimage"
|
|
|
f0b3403 |
pulp_env = 'v1pulp'
|
|
|
f0b3403 |
@@ -747,6 +748,7 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
'authoritative_registry': "registry.example.com",
|
|
|
f0b3403 |
'distribution_scope': "authoritative-source-only",
|
|
|
f0b3403 |
'registry_api_versions': registry_api_versions,
|
|
|
f0b3403 |
+ 'scratch': scratch,
|
|
|
f0b3403 |
})
|
|
|
f0b3403 |
build_request.set_params(**kwargs)
|
|
|
f0b3403 |
build_json = build_request.render()
|
|
|
f0b3403 |
@@ -799,8 +801,6 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "postbuild_plugins", "cp_built_image_to_nfs")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- assert get_plugin(plugins, "postbuild_plugins", "compress")
|
|
|
f0b3403 |
-
|
|
|
f0b3403 |
if 'v1' in registry_api_versions:
|
|
|
f0b3403 |
assert get_plugin(plugins, "postbuild_plugins",
|
|
|
f0b3403 |
"pulp_push")
|
|
|
f0b3403 |
@@ -830,6 +830,16 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "postbuild_plugins", "pulp_sync")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ if scratch:
|
|
|
f0b3403 |
+ with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
+ get_plugin(plugins, "postbuild_plugins", "compress")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
+ get_plugin(plugins, "exit_plugins", "koji_promote")
|
|
|
f0b3403 |
+ else:
|
|
|
f0b3403 |
+ assert get_plugin(plugins, "postbuild_plugins", "compress")
|
|
|
f0b3403 |
+ assert get_plugin(plugins, "exit_plugins", "koji_promote")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def test_render_with_yum_repourls(self):
|
|
|
f0b3403 |
kwargs = {
|
|
|
f0b3403 |
'git_uri': TEST_GIT_URI,
|
|
|
f0b3403 |
@@ -1040,7 +1050,6 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
self.create_image_change_trigger_json(str(tmpdir))
|
|
|
f0b3403 |
build_request = BuildRequest(str(tmpdir))
|
|
|
f0b3403 |
name_label = "fedora/resultingimage"
|
|
|
f0b3403 |
- push_url = "ssh://{username}git.example.com/git/{component}.git"
|
|
|
f0b3403 |
pdc_secret_name = 'foo'
|
|
|
f0b3403 |
kwargs = {
|
|
|
f0b3403 |
'git_uri': TEST_GIT_URI,
|
|
|
f0b3403 |
@@ -1061,8 +1070,6 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
'authoritative_registry': "registry.example.com",
|
|
|
f0b3403 |
'distribution_scope': "authoritative-source-only",
|
|
|
f0b3403 |
'registry_api_versions': ['v1'],
|
|
|
f0b3403 |
- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT),
|
|
|
f0b3403 |
- 'git_push_username': 'example',
|
|
|
f0b3403 |
'pdc_secret': pdc_secret_name,
|
|
|
f0b3403 |
'pdc_url': 'https://pdc.example.com',
|
|
|
f0b3403 |
'smtp_uri': 'smtp.example.com',
|
|
|
f0b3403 |
@@ -1127,57 +1134,38 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
'name': 'sendmail'}
|
|
|
f0b3403 |
assert get_plugin(plugins, 'exit_plugins', 'sendmail') == expected
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- @pytest.mark.parametrize('missing', [
|
|
|
f0b3403 |
- 'git_branch',
|
|
|
f0b3403 |
- 'git_push_url',
|
|
|
f0b3403 |
- ])
|
|
|
f0b3403 |
- def test_render_prod_request_trigger_missing_param(self, tmpdir, missing):
|
|
|
f0b3403 |
+ def test_render_custom_base_image_with_trigger(self, tmpdir):
|
|
|
f0b3403 |
self.create_image_change_trigger_json(str(tmpdir))
|
|
|
f0b3403 |
build_request = BuildRequest(str(tmpdir))
|
|
|
f0b3403 |
- push_url = "ssh://{username}git.example.com/git/{component}.git"
|
|
|
f0b3403 |
- kwargs = {
|
|
|
f0b3403 |
- 'git_uri': TEST_GIT_URI,
|
|
|
f0b3403 |
- 'git_ref': TEST_GIT_REF,
|
|
|
f0b3403 |
- 'git_branch': TEST_GIT_BRANCH,
|
|
|
f0b3403 |
- 'user': "john-foo",
|
|
|
f0b3403 |
- 'component': TEST_COMPONENT,
|
|
|
f0b3403 |
- 'base_image': 'fedora:latest',
|
|
|
f0b3403 |
- 'name_label': 'fedora/resultingimage',
|
|
|
f0b3403 |
- 'registry_uri': "registry.example.com",
|
|
|
f0b3403 |
- 'openshift_uri': "http://openshift/",
|
|
|
f0b3403 |
- 'builder_openshift_url': "http://openshift/",
|
|
|
f0b3403 |
- 'koji_target': "koji-target",
|
|
|
f0b3403 |
- 'kojiroot': "http://root/",
|
|
|
f0b3403 |
- 'kojihub': "http://hub/",
|
|
|
f0b3403 |
- 'sources_command': "make",
|
|
|
f0b3403 |
- 'vendor': "Foo Vendor",
|
|
|
f0b3403 |
- 'authoritative_registry': "registry.example.com",
|
|
|
f0b3403 |
- 'distribution_scope': "authoritative-source-only",
|
|
|
f0b3403 |
- 'registry_api_versions': ['v1'],
|
|
|
f0b3403 |
- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT),
|
|
|
f0b3403 |
- 'git_push_username': 'example',
|
|
|
f0b3403 |
- }
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- # Remove one of the parameters required for rebuild triggers
|
|
|
f0b3403 |
- del kwargs[missing]
|
|
|
f0b3403 |
+ kwargs = get_sample_prod_params()
|
|
|
f0b3403 |
+ kwargs['base_image'] = 'koji/image-build'
|
|
|
f0b3403 |
+ kwargs['yum_repourls'] = ["http://example.com/my.repo"]
|
|
|
f0b3403 |
+ kwargs['pdc_secret'] = 'foo'
|
|
|
f0b3403 |
+ kwargs['pdc_url'] = 'https://pdc.example.com'
|
|
|
f0b3403 |
+ kwargs['smtp_uri'] = 'smtp.example.com'
|
|
|
f0b3403 |
|
|
|
f0b3403 |
build_request.set_params(**kwargs)
|
|
|
f0b3403 |
build_json = build_request.render()
|
|
|
f0b3403 |
|
|
|
f0b3403 |
- assert build_json["metadata"]["labels"]["git-branch"] is not None
|
|
|
f0b3403 |
+ assert build_request.is_custom_base_image() is True
|
|
|
f0b3403 |
|
|
|
f0b3403 |
# Verify the triggers are now disabled
|
|
|
f0b3403 |
assert "triggers" not in build_json["spec"]
|
|
|
f0b3403 |
|
|
|
f0b3403 |
# Verify the rebuild plugins are all disabled
|
|
|
f0b3403 |
plugins = get_plugins_from_build_json(build_json)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "prebuild_plugins", "check_and_set_rebuild")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "prebuild_plugins",
|
|
|
f0b3403 |
"stop_autorebuild_if_disabled")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "postbuild_plugins", "import_image")
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
with pytest.raises(NoSuchPluginException):
|
|
|
f0b3403 |
get_plugin(plugins, "exit_plugins", "sendmail")
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -1226,7 +1214,6 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
self.create_image_change_trigger_json(str(tmpdir))
|
|
|
f0b3403 |
build_request = BuildRequest(str(tmpdir))
|
|
|
f0b3403 |
name_label = "fedora/resultingimage"
|
|
|
f0b3403 |
- push_url = "ssh://{username}git.example.com/git/{component}.git"
|
|
|
f0b3403 |
koji_certs_secret_name = 'foobar'
|
|
|
f0b3403 |
koji_task_id = 1234
|
|
|
f0b3403 |
kwargs = {
|
|
|
f0b3403 |
@@ -1249,8 +1236,6 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
'authoritative_registry': "registry.example.com",
|
|
|
f0b3403 |
'distribution_scope': "authoritative-source-only",
|
|
|
f0b3403 |
'registry_api_versions': ['v1'],
|
|
|
f0b3403 |
- 'git_push_url': push_url.format(username='', component=TEST_COMPONENT),
|
|
|
f0b3403 |
- 'git_push_username': 'example',
|
|
|
f0b3403 |
'koji_certs_secret': koji_certs_secret_name,
|
|
|
f0b3403 |
}
|
|
|
f0b3403 |
build_request.set_params(**kwargs)
|
|
|
f0b3403 |
@@ -1269,6 +1254,54 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
koji_certs_secret_name)
|
|
|
f0b3403 |
assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_ssl_certs'] == mount_path
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def test_render_prod_request_with_koji_kerberos(self, tmpdir):
|
|
|
f0b3403 |
+ self.create_image_change_trigger_json(str(tmpdir))
|
|
|
f0b3403 |
+ build_request = BuildRequest(str(tmpdir))
|
|
|
f0b3403 |
+ name_label = "fedora/resultingimage"
|
|
|
f0b3403 |
+ koji_task_id = 1234
|
|
|
f0b3403 |
+ koji_use_kerberos = True
|
|
|
f0b3403 |
+ koji_kerberos_keytab = "FILE:/tmp/fakekeytab"
|
|
|
f0b3403 |
+ koji_kerberos_principal = "myprincipal@OSBSDOMAIN.COM"
|
|
|
f0b3403 |
+ kwargs = {
|
|
|
f0b3403 |
+ 'git_uri': TEST_GIT_URI,
|
|
|
f0b3403 |
+ 'git_ref': TEST_GIT_REF,
|
|
|
f0b3403 |
+ 'git_branch': TEST_GIT_BRANCH,
|
|
|
f0b3403 |
+ 'user': "john-foo",
|
|
|
f0b3403 |
+ 'component': TEST_COMPONENT,
|
|
|
f0b3403 |
+ 'base_image': 'fedora:latest',
|
|
|
f0b3403 |
+ 'name_label': name_label,
|
|
|
f0b3403 |
+ 'registry_uri': "example.com",
|
|
|
f0b3403 |
+ 'openshift_uri': "http://openshift/",
|
|
|
f0b3403 |
+ 'builder_openshift_url': "http://openshift/",
|
|
|
f0b3403 |
+ 'koji_target': "koji-target",
|
|
|
f0b3403 |
+ 'kojiroot': "http://root/",
|
|
|
f0b3403 |
+ 'kojihub': "http://hub/",
|
|
|
f0b3403 |
+ 'sources_command': "make",
|
|
|
f0b3403 |
+ 'koji_task_id': koji_task_id,
|
|
|
f0b3403 |
+ 'koji_use_kerberos': koji_use_kerberos,
|
|
|
f0b3403 |
+ 'koji_kerberos_keytab': koji_kerberos_keytab,
|
|
|
f0b3403 |
+ 'koji_kerberos_principal': koji_kerberos_principal,
|
|
|
f0b3403 |
+ 'vendor': "Foo Vendor",
|
|
|
f0b3403 |
+ 'authoritative_registry': "registry.example.com",
|
|
|
f0b3403 |
+ 'distribution_scope': "authoritative-source-only",
|
|
|
f0b3403 |
+ 'registry_api_versions': ['v1'],
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ build_request.set_params(**kwargs)
|
|
|
f0b3403 |
+ build_json = build_request.render()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert build_json["metadata"]["labels"]["koji-task-id"] == str(koji_task_id)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ plugins = get_plugins_from_build_json(build_json)
|
|
|
f0b3403 |
+ assert get_plugin(plugins, "exit_plugins", "koji_promote")
|
|
|
f0b3403 |
+ assert plugin_value_get(plugins, "exit_plugins", "koji_promote",
|
|
|
f0b3403 |
+ "args", "kojihub") == kwargs["kojihub"]
|
|
|
f0b3403 |
+ assert plugin_value_get(plugins, "exit_plugins", "koji_promote",
|
|
|
f0b3403 |
+ "args", "url") == kwargs["openshift_uri"]
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_principal'] == koji_kerberos_principal
|
|
|
f0b3403 |
+ assert get_plugin(plugins, 'exit_plugins', 'koji_promote')['args']['koji_keytab'] == koji_kerberos_keytab
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
@pytest.mark.parametrize(('base_image', 'is_custom'), [
|
|
|
f0b3403 |
('fedora', False),
|
|
|
f0b3403 |
('fedora:latest', False),
|
|
|
f0b3403 |
@@ -1338,3 +1371,97 @@ class TestBuildRequest(object):
|
|
|
f0b3403 |
pull_base_image_plugin = get_plugin(
|
|
|
f0b3403 |
plugins, 'prebuild_plugins', 'pull_base_image')
|
|
|
f0b3403 |
assert pull_base_image_plugin is not None
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def test_render_prod_custom_site_plugin_enable(self):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ Test to make sure that when we attempt to enable a plugin, it is
|
|
|
f0b3403 |
+ actually enabled in the JSON for the build_request after running
|
|
|
f0b3403 |
+ build_request.render()
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ plugin_type = "exit_plugins"
|
|
|
f0b3403 |
+ plugin_name = "testing_exit_plugin"
|
|
|
f0b3403 |
+ plugin_args = {"foo": "bar"}
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ build_request = BuildRequest(INPUTS_PATH)
|
|
|
f0b3403 |
+ build_request.customize_conf['enable_plugins'].append(
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": plugin_type,
|
|
|
f0b3403 |
+ "plugin_name": plugin_name,
|
|
|
f0b3403 |
+ "plugin_args": plugin_args
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ kwargs = get_sample_prod_params()
|
|
|
f0b3403 |
+ build_request.set_params(**kwargs)
|
|
|
f0b3403 |
+ build_request.render()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert {
|
|
|
f0b3403 |
+ "name": plugin_name,
|
|
|
f0b3403 |
+ "args": plugin_args
|
|
|
f0b3403 |
+ } in build_request.dj.dock_json[plugin_type]
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def test_render_prod_custom_site_plugin_disable(self):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ Test to make sure that when we attempt to disable a plugin, it is
|
|
|
f0b3403 |
+ actually disabled in the JSON for the build_request after running
|
|
|
f0b3403 |
+ build_request.render()
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ plugin_type = "postbuild_plugins"
|
|
|
f0b3403 |
+ plugin_name = "compress"
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ build_request = BuildRequest(INPUTS_PATH)
|
|
|
f0b3403 |
+ build_request.customize_conf['disable_plugins'].append(
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": plugin_type,
|
|
|
f0b3403 |
+ "plugin_name": plugin_name
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ kwargs = get_sample_prod_params()
|
|
|
f0b3403 |
+ build_request.set_params(**kwargs)
|
|
|
f0b3403 |
+ build_request.render()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ for plugin in build_request.dj.dock_json[plugin_type]:
|
|
|
f0b3403 |
+ if plugin['name'] == plugin_name:
|
|
|
f0b3403 |
+ assert False
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def test_render_prod_custom_site_plugin_override(self):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ Test to make sure that when we attempt to override a plugin's args,
|
|
|
f0b3403 |
+ they are actually overridden in the JSON for the build_request
|
|
|
f0b3403 |
+ after running build_request.render()
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ plugin_type = "postbuild_plugins"
|
|
|
f0b3403 |
+ plugin_name = "compress"
|
|
|
f0b3403 |
+ plugin_args = {"foo": "bar"}
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ kwargs = get_sample_prod_params()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ unmodified_build_request = BuildRequest(INPUTS_PATH)
|
|
|
f0b3403 |
+ unmodified_build_request.set_params(**kwargs)
|
|
|
f0b3403 |
+ unmodified_build_request.render()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ for plugin_dict in unmodified_build_request.dj.dock_json[plugin_type]:
|
|
|
f0b3403 |
+ if plugin_dict['name'] == plugin_name:
|
|
|
f0b3403 |
+ plugin_index = unmodified_build_request.dj.dock_json[plugin_type].index(plugin_dict)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ build_request = BuildRequest(INPUTS_PATH)
|
|
|
f0b3403 |
+ build_request.customize_conf['enable_plugins'].append(
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "plugin_type": plugin_type,
|
|
|
f0b3403 |
+ "plugin_name": plugin_name,
|
|
|
f0b3403 |
+ "plugin_args": plugin_args
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ )
|
|
|
f0b3403 |
+ build_request.set_params(**kwargs)
|
|
|
f0b3403 |
+ build_request.render()
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert {
|
|
|
f0b3403 |
+ "name": plugin_name,
|
|
|
f0b3403 |
+ "args": plugin_args
|
|
|
f0b3403 |
+ } in build_request.dj.dock_json[plugin_type]
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert unmodified_build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name
|
|
|
f0b3403 |
+ assert build_request.dj.dock_json[plugin_type][plugin_index]['name'] == plugin_name
|
|
|
f0b3403 |
diff --git a/tests/build/test_build_response.py b/tests/build/test_build_response.py
|
|
|
f0b3403 |
index 778e79c..23a3a23 100644
|
|
|
f0b3403 |
--- a/tests/build/test_build_response.py
|
|
|
f0b3403 |
+++ b/tests/build/test_build_response.py
|
|
|
f0b3403 |
@@ -40,6 +40,23 @@ class TestBuildResponse(object):
|
|
|
f0b3403 |
})
|
|
|
f0b3403 |
assert build_response.get_koji_build_id() == koji_build_id
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def test_build_cancel(self):
|
|
|
f0b3403 |
+ build_response = BuildResponse({
|
|
|
f0b3403 |
+ 'status': {
|
|
|
f0b3403 |
+ 'phase': 'Running'
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ })
|
|
|
f0b3403 |
+ assert not build_response.cancelled
|
|
|
f0b3403 |
+ build_response.cancelled = True
|
|
|
f0b3403 |
+ assert build_response.cancelled
|
|
|
f0b3403 |
+ assert 'cancelled' in build_response.json['status']
|
|
|
f0b3403 |
+ assert build_response.json['status']['cancelled']
|
|
|
f0b3403 |
+ build_response.cancelled = False
|
|
|
f0b3403 |
+ assert not build_response.cancelled
|
|
|
f0b3403 |
+ assert 'cancelled' in build_response.json['status']
|
|
|
f0b3403 |
+ assert not build_response.json['status'].get('cancelled')
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
@pytest.mark.parametrize(('plugin', 'message', 'expected_error_message'), [
|
|
|
f0b3403 |
('dockerbuild', None, 'Error in plugin dockerbuild'),
|
|
|
f0b3403 |
('foo', 'bar', 'Error in plugin foo: bar'),
|
|
|
f0b3403 |
diff --git a/tests/constants.py b/tests/constants.py
|
|
|
f0b3403 |
index 616d469..818c278 100644
|
|
|
f0b3403 |
--- a/tests/constants.py
|
|
|
f0b3403 |
+++ b/tests/constants.py
|
|
|
f0b3403 |
@@ -13,6 +13,7 @@ HERE = os.path.dirname(__file__)
|
|
|
f0b3403 |
INPUTS_PATH = os.path.join(HERE, '..', 'inputs')
|
|
|
f0b3403 |
|
|
|
f0b3403 |
TEST_BUILD = "test-build-123"
|
|
|
f0b3403 |
+TEST_CANCELLED_BUILD = "test-build-cancel-123"
|
|
|
f0b3403 |
TEST_BUILD_CONFIG = "path-master"
|
|
|
f0b3403 |
TEST_GIT_URI = "git://hostname/path"
|
|
|
f0b3403 |
TEST_GIT_URI_HUMAN_NAME = "path"
|
|
|
f0b3403 |
diff --git a/tests/fake_api.py b/tests/fake_api.py
|
|
|
f0b3403 |
index d07aa1b..5d1e9b9 100644
|
|
|
f0b3403 |
--- a/tests/fake_api.py
|
|
|
f0b3403 |
+++ b/tests/fake_api.py
|
|
|
f0b3403 |
@@ -16,7 +16,7 @@ from osbs.core import Openshift
|
|
|
f0b3403 |
from osbs.http import HttpResponse
|
|
|
f0b3403 |
from osbs.conf import Configuration
|
|
|
f0b3403 |
from osbs.api import OSBS
|
|
|
f0b3403 |
-from tests.constants import (TEST_BUILD, TEST_COMPONENT, TEST_GIT_REF,
|
|
|
f0b3403 |
+from tests.constants import (TEST_BUILD, TEST_CANCELLED_BUILD, TEST_COMPONENT, TEST_GIT_REF,
|
|
|
f0b3403 |
TEST_GIT_BRANCH, TEST_BUILD_CONFIG,
|
|
|
f0b3403 |
TEST_GIT_URI_HUMAN_NAME, TEST_KOJI_TASK_ID)
|
|
|
f0b3403 |
from tempfile import NamedTemporaryFile
|
|
|
f0b3403 |
@@ -105,6 +105,20 @@ class Connection(object):
|
|
|
f0b3403 |
}
|
|
|
f0b3403 |
},
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ # Simulate build cancellation
|
|
|
f0b3403 |
+ (OAPI_PREFIX + "namespaces/default/builds/%s" % TEST_CANCELLED_BUILD,
|
|
|
f0b3403 |
+ OAPI_PREFIX + "namespaces/default/builds/%s/" % TEST_CANCELLED_BUILD): {
|
|
|
f0b3403 |
+ "get": {
|
|
|
f0b3403 |
+ # Contains a single build in Completed phase
|
|
|
f0b3403 |
+ # named test-build-123
|
|
|
f0b3403 |
+ "file": "build_test-build-cancel-123_get.json",
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "put": {
|
|
|
f0b3403 |
+ "file": "build_test-build-cancel-123_put.json",
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
(OAPI_PREFIX + "namespaces/default/builds/%s/log/" % TEST_BUILD,
|
|
|
f0b3403 |
OAPI_PREFIX + "namespaces/default/builds/%s/log/?follow=0" % TEST_BUILD,
|
|
|
f0b3403 |
OAPI_PREFIX + "namespaces/default/builds/%s/log/?follow=1" % TEST_BUILD): {
|
|
|
f0b3403 |
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
|
|
|
f0b3403 |
new file mode 100644
|
|
|
f0b3403 |
index 0000000..1798408
|
|
|
f0b3403 |
--- /dev/null
|
|
|
f0b3403 |
+++ b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_get.json
|
|
|
f0b3403 |
@@ -0,0 +1,71 @@
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "apiVersion": "v1",
|
|
|
f0b3403 |
+ "kind": "Build",
|
|
|
f0b3403 |
+ "metadata": {
|
|
|
f0b3403 |
+ "annotations": {
|
|
|
f0b3403 |
+ "artefacts": "",
|
|
|
f0b3403 |
+ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11",
|
|
|
f0b3403 |
+ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n",
|
|
|
f0b3403 |
+ "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",
|
|
|
f0b3403 |
+ "repositories": "{\"unique\": [], \"primary\": []}",
|
|
|
f0b3403 |
+ "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"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "creationTimestamp": "2015-08-21T10:12:40Z",
|
|
|
f0b3403 |
+ "labels": {
|
|
|
f0b3403 |
+ "buildconfig": "build-20150821111239",
|
|
|
f0b3403 |
+ "is_autorebuild": "false"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "name": "test-build-123",
|
|
|
f0b3403 |
+ "namespace": "default",
|
|
|
f0b3403 |
+ "resourceVersion": "696",
|
|
|
f0b3403 |
+ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-123",
|
|
|
f0b3403 |
+ "uid": "27ccd290-47ed-11e5-969c-52540080e6f8"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "spec": {
|
|
|
f0b3403 |
+ "output": {
|
|
|
f0b3403 |
+ "to": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "localhost:5000/twaugh/component:20150821111239"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "resources": {},
|
|
|
f0b3403 |
+ "source": {
|
|
|
f0b3403 |
+ "git": {
|
|
|
f0b3403 |
+ "ref": "master",
|
|
|
f0b3403 |
+ "uri": "https://github.com/TomasTomecek/docker-hello-world.git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "strategy": {
|
|
|
f0b3403 |
+ "customStrategy": {
|
|
|
f0b3403 |
+ "env": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "ATOMIC_REACTOR_PLUGINS",
|
|
|
f0b3403 |
+ "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\"}]}"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE",
|
|
|
f0b3403 |
+ "value": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+ "exposeDockerSocket": true,
|
|
|
f0b3403 |
+ "from": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Custom"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "status": {
|
|
|
f0b3403 |
+ "completionTimestamp": "2015-08-21T10:13:00Z",
|
|
|
f0b3403 |
+ "config": {
|
|
|
f0b3403 |
+ "kind": "BuildConfig",
|
|
|
f0b3403 |
+ "name": "build-20150821111239",
|
|
|
f0b3403 |
+ "namespace": "default"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "duration": 19000000000,
|
|
|
f0b3403 |
+ "phase": "Running",
|
|
|
f0b3403 |
+ "startTimestamp": "2015-08-21T10:12:41Z"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
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
|
|
|
f0b3403 |
new file mode 100644
|
|
|
f0b3403 |
index 0000000..87e9a3d
|
|
|
f0b3403 |
--- /dev/null
|
|
|
f0b3403 |
+++ b/tests/mock_jsons/0.5.4/build_test-build-cancel-123_put.json
|
|
|
f0b3403 |
@@ -0,0 +1,71 @@
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "apiVersion": "v1",
|
|
|
f0b3403 |
+ "kind": "Build",
|
|
|
f0b3403 |
+ "metadata": {
|
|
|
f0b3403 |
+ "annotations": {
|
|
|
f0b3403 |
+ "artefacts": "",
|
|
|
f0b3403 |
+ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11",
|
|
|
f0b3403 |
+ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n",
|
|
|
f0b3403 |
+ "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",
|
|
|
f0b3403 |
+ "repositories": "{\"unique\": [], \"primary\": []}",
|
|
|
f0b3403 |
+ "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"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "creationTimestamp": "2015-08-21T10:12:40Z",
|
|
|
f0b3403 |
+ "labels": {
|
|
|
f0b3403 |
+ "buildconfig": "build-20150821111239",
|
|
|
f0b3403 |
+ "is_autorebuild": "false"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "name": "test-build-cancel-123",
|
|
|
f0b3403 |
+ "namespace": "default",
|
|
|
f0b3403 |
+ "resourceVersion": "696",
|
|
|
f0b3403 |
+ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123",
|
|
|
f0b3403 |
+ "uid": "27ccd290-47ed-11e5-969c-52540080e6f8"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "spec": {
|
|
|
f0b3403 |
+ "output": {
|
|
|
f0b3403 |
+ "to": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "localhost:5000/twaugh/component:20150821111239"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "resources": {},
|
|
|
f0b3403 |
+ "source": {
|
|
|
f0b3403 |
+ "git": {
|
|
|
f0b3403 |
+ "ref": "master",
|
|
|
f0b3403 |
+ "uri": "https://github.com/TomasTomecek/docker-hello-world.git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "strategy": {
|
|
|
f0b3403 |
+ "customStrategy": {
|
|
|
f0b3403 |
+ "env": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "ATOMIC_REACTOR_PLUGINS",
|
|
|
f0b3403 |
+ "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\"}]}"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE",
|
|
|
f0b3403 |
+ "value": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+ "exposeDockerSocket": true,
|
|
|
f0b3403 |
+ "from": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Custom"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "status": {
|
|
|
f0b3403 |
+ "completionTimestamp": "2015-08-21T10:13:00Z",
|
|
|
f0b3403 |
+ "config": {
|
|
|
f0b3403 |
+ "kind": "BuildConfig",
|
|
|
f0b3403 |
+ "name": "build-20150821111239",
|
|
|
f0b3403 |
+ "namespace": "default"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "duration": 19000000000,
|
|
|
f0b3403 |
+ "phase": "Cancelled",
|
|
|
f0b3403 |
+ "startTimestamp": "2015-08-21T10:12:41Z"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
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
|
|
|
f0b3403 |
new file mode 100644
|
|
|
f0b3403 |
index 0000000..6911da8
|
|
|
f0b3403 |
--- /dev/null
|
|
|
f0b3403 |
+++ b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_get.json
|
|
|
f0b3403 |
@@ -0,0 +1,72 @@
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "apiVersion": "v1",
|
|
|
f0b3403 |
+ "kind": "Build",
|
|
|
f0b3403 |
+ "metadata": {
|
|
|
f0b3403 |
+ "annotations": {
|
|
|
f0b3403 |
+ "artefacts": "",
|
|
|
f0b3403 |
+ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11",
|
|
|
f0b3403 |
+ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n",
|
|
|
f0b3403 |
+ "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",
|
|
|
f0b3403 |
+ "repositories": "{\"unique\": [], \"primary\": []}",
|
|
|
f0b3403 |
+ "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"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "creationTimestamp": "2015-08-20T16:41:05Z",
|
|
|
f0b3403 |
+ "labels": {
|
|
|
f0b3403 |
+ "buildconfig": "build-20150820174104",
|
|
|
f0b3403 |
+ "is_autorebuild": "false"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "name": "test-build-cancel-123",
|
|
|
f0b3403 |
+ "namespace": "default",
|
|
|
f0b3403 |
+ "resourceVersion": "2958",
|
|
|
f0b3403 |
+ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123",
|
|
|
f0b3403 |
+ "uid": "3ff4b700-475a-11e5-acf2-52540080e6f8"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "spec": {
|
|
|
f0b3403 |
+ "output": {
|
|
|
f0b3403 |
+ "to": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "localhost:5000/twaugh/component:20150820174104"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "resources": {},
|
|
|
f0b3403 |
+ "serviceAccount": "builder",
|
|
|
f0b3403 |
+ "source": {
|
|
|
f0b3403 |
+ "git": {
|
|
|
f0b3403 |
+ "ref": "master",
|
|
|
f0b3403 |
+ "uri": "https://github.com/TomasTomecek/docker-hello-world.git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "strategy": {
|
|
|
f0b3403 |
+ "customStrategy": {
|
|
|
f0b3403 |
+ "env": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "ATOMIC_REACTOR_PLUGINS",
|
|
|
f0b3403 |
+ "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\"}]}"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE",
|
|
|
f0b3403 |
+ "value": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+ "exposeDockerSocket": true,
|
|
|
f0b3403 |
+ "from": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Custom"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "status": {
|
|
|
f0b3403 |
+ "completionTimestamp": "2015-08-20T16:41:45Z",
|
|
|
f0b3403 |
+ "config": {
|
|
|
f0b3403 |
+ "kind": "BuildConfig",
|
|
|
f0b3403 |
+ "name": "test-build-cancel-123",
|
|
|
f0b3403 |
+ "namespace": "default"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "duration": 39000000000,
|
|
|
f0b3403 |
+ "phase": "Running",
|
|
|
f0b3403 |
+ "startTimestamp": "2015-08-20T16:41:06Z"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
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
|
|
|
f0b3403 |
new file mode 100644
|
|
|
f0b3403 |
index 0000000..53db8c0
|
|
|
f0b3403 |
--- /dev/null
|
|
|
f0b3403 |
+++ b/tests/mock_jsons/1.0.4/build_test-build-cancel-123_put.json
|
|
|
f0b3403 |
@@ -0,0 +1,72 @@
|
|
|
f0b3403 |
+{
|
|
|
f0b3403 |
+ "apiVersion": "v1",
|
|
|
f0b3403 |
+ "kind": "Build",
|
|
|
f0b3403 |
+ "metadata": {
|
|
|
f0b3403 |
+ "annotations": {
|
|
|
f0b3403 |
+ "artefacts": "",
|
|
|
f0b3403 |
+ "commit_id": "1a595e502afba8942fe30caa09df7d442089db11",
|
|
|
f0b3403 |
+ "dockerfile": "FROM ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4\nRUN uname -a && env\n",
|
|
|
f0b3403 |
+ "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",
|
|
|
f0b3403 |
+ "repositories": "{\"unique\": [], \"primary\": []}",
|
|
|
f0b3403 |
+ "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"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "creationTimestamp": "2015-08-20T16:41:05Z",
|
|
|
f0b3403 |
+ "labels": {
|
|
|
f0b3403 |
+ "buildconfig": "build-20150820174104",
|
|
|
f0b3403 |
+ "is_autorebuild": "false"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "name": "test-build-cancel-123",
|
|
|
f0b3403 |
+ "namespace": "default",
|
|
|
f0b3403 |
+ "resourceVersion": "2958",
|
|
|
f0b3403 |
+ "selfLink": "/oapi/v1/namespaces/default/builds/test-build-cancel-123",
|
|
|
f0b3403 |
+ "uid": "3ff4b700-475a-11e5-acf2-52540080e6f8"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "spec": {
|
|
|
f0b3403 |
+ "output": {
|
|
|
f0b3403 |
+ "to": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "localhost:5000/twaugh/component:20150820174104"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "resources": {},
|
|
|
f0b3403 |
+ "serviceAccount": "builder",
|
|
|
f0b3403 |
+ "source": {
|
|
|
f0b3403 |
+ "git": {
|
|
|
f0b3403 |
+ "ref": "master",
|
|
|
f0b3403 |
+ "uri": "https://github.com/TomasTomecek/docker-hello-world.git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Git"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "strategy": {
|
|
|
f0b3403 |
+ "customStrategy": {
|
|
|
f0b3403 |
+ "env": [
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "ATOMIC_REACTOR_PLUGINS",
|
|
|
f0b3403 |
+ "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\"}]}"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ {
|
|
|
f0b3403 |
+ "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE",
|
|
|
f0b3403 |
+ "value": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ ],
|
|
|
f0b3403 |
+ "exposeDockerSocket": true,
|
|
|
f0b3403 |
+ "from": {
|
|
|
f0b3403 |
+ "kind": "DockerImage",
|
|
|
f0b3403 |
+ "name": "buildroot:latest"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "type": "Custom"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "status": {
|
|
|
f0b3403 |
+ "completionTimestamp": "2015-08-20T16:41:45Z",
|
|
|
f0b3403 |
+ "config": {
|
|
|
f0b3403 |
+ "kind": "BuildConfig",
|
|
|
f0b3403 |
+ "name": "test-build-cancel-123",
|
|
|
f0b3403 |
+ "namespace": "default"
|
|
|
f0b3403 |
+ },
|
|
|
f0b3403 |
+ "duration": 39000000000,
|
|
|
f0b3403 |
+ "phase": "Cancelled",
|
|
|
f0b3403 |
+ "startTimestamp": "2015-08-20T16:41:06Z"
|
|
|
f0b3403 |
+ }
|
|
|
f0b3403 |
+}
|
|
|
f0b3403 |
diff --git a/tests/test_api.py b/tests/test_api.py
|
|
|
f0b3403 |
index 0566971..42670a9 100644
|
|
|
f0b3403 |
--- a/tests/test_api.py
|
|
|
f0b3403 |
+++ b/tests/test_api.py
|
|
|
f0b3403 |
@@ -72,7 +72,7 @@ class TestOSBS(object):
|
|
|
f0b3403 |
|
|
|
f0b3403 |
def test_create_build_with_deprecated_params(self, osbs):
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -102,7 +102,7 @@ class TestOSBS(object):
|
|
|
f0b3403 |
def test_create_prod_build(self, osbs, name_label_name):
|
|
|
f0b3403 |
# TODO: test situation when a buildconfig already exists
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {name_label_name: 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {name_label_name: 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -116,7 +116,7 @@ class TestOSBS(object):
|
|
|
f0b3403 |
@pytest.mark.parametrize('unique_tag_only', [True, False, None])
|
|
|
f0b3403 |
def test_create_prod_build_unique_tag_only(self, osbs, unique_tag_only):
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -140,7 +140,6 @@ class TestOSBS(object):
|
|
|
f0b3403 |
TEST_COMPONENT, TEST_TARGET, TEST_ARCH)
|
|
|
f0b3403 |
assert isinstance(response, BuildResponse)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
-
|
|
|
f0b3403 |
def test_create_prod_build_missing_name_label(self, osbs):
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
labels = {}
|
|
|
f0b3403 |
@@ -154,9 +153,32 @@ class TestOSBS(object):
|
|
|
f0b3403 |
TEST_GIT_BRANCH, TEST_USER,
|
|
|
f0b3403 |
TEST_COMPONENT, TEST_TARGET, TEST_ARCH)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ @pytest.mark.parametrize('label_name', ['BZComponent', 'com.redhat.component', 'Name', 'name'])
|
|
|
f0b3403 |
+ def test_missing_component_and_name_labels(self, osbs, label_name):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ tests if raises exception if there is only component
|
|
|
f0b3403 |
+ or only name in labels
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ class MockParser(object):
|
|
|
f0b3403 |
+ labels = {label_name: 'something'}
|
|
|
f0b3403 |
+ baseimage = 'fedora23/python'
|
|
|
f0b3403 |
+ (flexmock(utils)
|
|
|
f0b3403 |
+ .should_receive('get_df_parser')
|
|
|
f0b3403 |
+ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH)
|
|
|
f0b3403 |
+ .and_return(MockParser()))
|
|
|
f0b3403 |
+ with pytest.raises(OsbsValidationException):
|
|
|
f0b3403 |
+ osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF,
|
|
|
f0b3403 |
+ TEST_GIT_BRANCH, TEST_USER,
|
|
|
f0b3403 |
+ TEST_COMPONENT, TEST_TARGET, TEST_ARCH)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def test_create_prod_build_missing_args(self, osbs):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ tests if setdefault for arguments works in create_build
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -169,7 +191,6 @@ class TestOSBS(object):
|
|
|
f0b3403 |
git_branch=None,
|
|
|
f0b3403 |
user=TEST_USER,
|
|
|
f0b3403 |
component=TEST_COMPONENT,
|
|
|
f0b3403 |
- target=None,
|
|
|
f0b3403 |
architecture=TEST_ARCH)
|
|
|
f0b3403 |
.once()
|
|
|
f0b3403 |
.and_return(None))
|
|
|
f0b3403 |
@@ -179,9 +200,42 @@ class TestOSBS(object):
|
|
|
f0b3403 |
component=TEST_COMPONENT,
|
|
|
f0b3403 |
architecture=TEST_ARCH)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ @pytest.mark.parametrize('component_label_name', ['com.redhat.component', 'BZComponent'])
|
|
|
f0b3403 |
+ def test_component_is_changed_from_label(self, osbs, component_label_name):
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+ tests if component is changed in create_prod_build
|
|
|
f0b3403 |
+ with value from component label
|
|
|
f0b3403 |
+ """
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ class MockParser(object):
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', component_label_name: TEST_COMPONENT}
|
|
|
f0b3403 |
+ baseimage = 'fedora23/python'
|
|
|
f0b3403 |
+ (flexmock(utils)
|
|
|
f0b3403 |
+ .should_receive('get_df_parser')
|
|
|
f0b3403 |
+ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH)
|
|
|
f0b3403 |
+ .and_return(MockParser()))
|
|
|
f0b3403 |
+ flexmock(OSBS, _create_build_config_and_build=request_as_response)
|
|
|
f0b3403 |
+ req = osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF,
|
|
|
f0b3403 |
+ TEST_GIT_BRANCH, TEST_USER,
|
|
|
f0b3403 |
+ TEST_COMPONENT, TEST_TARGET,
|
|
|
f0b3403 |
+ TEST_ARCH)
|
|
|
f0b3403 |
+ assert req.spec.component.value == TEST_COMPONENT
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ def test_missing_component_argument_doesnt_break_build(self, osbs):
|
|
|
f0b3403 |
+ class MockParser(object):
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
+ baseimage = 'fedora23/python'
|
|
|
f0b3403 |
+ (flexmock(utils)
|
|
|
f0b3403 |
+ .should_receive('get_df_parser')
|
|
|
f0b3403 |
+ .with_args(TEST_GIT_URI, TEST_GIT_REF, git_branch=TEST_GIT_BRANCH)
|
|
|
f0b3403 |
+ .and_return(MockParser()))
|
|
|
f0b3403 |
+ response = osbs.create_prod_build(TEST_GIT_URI, TEST_GIT_REF,
|
|
|
f0b3403 |
+ TEST_GIT_BRANCH, TEST_USER)
|
|
|
f0b3403 |
+ assert isinstance(response, BuildResponse)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def test_create_prod_build_set_required_version(self, osbs106):
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -199,7 +253,7 @@ class TestOSBS(object):
|
|
|
f0b3403 |
def test_create_prod_with_secret_build(self, osbs):
|
|
|
f0b3403 |
# TODO: test situation when a buildconfig already exists
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -214,7 +268,7 @@ class TestOSBS(object):
|
|
|
f0b3403 |
def test_create_prod_without_koji_build(self, osbs):
|
|
|
f0b3403 |
# TODO: test situation when a buildconfig already exists
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -429,7 +483,7 @@ build_image = {build_image}
|
|
|
f0b3403 |
assert config.get_build_image() == build_image
|
|
|
f0b3403 |
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
(flexmock(utils)
|
|
|
f0b3403 |
.should_receive('get_df_parser')
|
|
|
f0b3403 |
@@ -884,7 +938,7 @@ build_image = {build_image}
|
|
|
f0b3403 |
osbs = OSBS(config, config)
|
|
|
f0b3403 |
|
|
|
f0b3403 |
class MockParser(object):
|
|
|
f0b3403 |
- labels = {'Name': 'fedora23/something'}
|
|
|
f0b3403 |
+ labels = {'Name': 'fedora23/something', 'com.redhat.component': TEST_COMPONENT}
|
|
|
f0b3403 |
baseimage = 'fedora23/python'
|
|
|
f0b3403 |
|
|
|
f0b3403 |
kwargs = {
|
|
|
f0b3403 |
diff --git a/tests/test_conf.py b/tests/test_conf.py
|
|
|
f0b3403 |
index 81514d5..99bc0a2 100644
|
|
|
f0b3403 |
--- a/tests/test_conf.py
|
|
|
f0b3403 |
+++ b/tests/test_conf.py
|
|
|
f0b3403 |
@@ -244,3 +244,19 @@ class TestConfiguration(object):
|
|
|
f0b3403 |
|
|
|
f0b3403 |
for fn, value in expected.items():
|
|
|
f0b3403 |
assert getattr(conf, fn)() == value
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ @pytest.mark.parametrize(('config', 'expected'), [
|
|
|
f0b3403 |
+ ({
|
|
|
f0b3403 |
+ 'default': {'builder_build_json_dir': 'builder'},
|
|
|
f0b3403 |
+ 'general': {'build_json_dir': 'general'},
|
|
|
f0b3403 |
+ }, 'builder'),
|
|
|
f0b3403 |
+ ({
|
|
|
f0b3403 |
+ 'default': {},
|
|
|
f0b3403 |
+ 'general': {'build_json_dir': 'general'},
|
|
|
f0b3403 |
+ }, 'general'),
|
|
|
f0b3403 |
+ ])
|
|
|
f0b3403 |
+ def test_builder_build_json_dir(self, config, expected):
|
|
|
f0b3403 |
+ with self.config_file(config) as config_file:
|
|
|
f0b3403 |
+ conf = Configuration(conf_file=config_file)
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
+ assert conf.get_builder_build_json_store() == expected
|
|
|
f0b3403 |
diff --git a/tests/test_core.py b/tests/test_core.py
|
|
|
f0b3403 |
index 3c7f303..6684275 100644
|
|
|
f0b3403 |
--- a/tests/test_core.py
|
|
|
f0b3403 |
+++ b/tests/test_core.py
|
|
|
f0b3403 |
@@ -12,12 +12,14 @@ import time
|
|
|
f0b3403 |
import json
|
|
|
f0b3403 |
|
|
|
f0b3403 |
from osbs.http import HttpResponse
|
|
|
f0b3403 |
-from osbs.constants import BUILD_FINISHED_STATES
|
|
|
f0b3403 |
+from osbs.constants import (BUILD_FINISHED_STATES, BUILD_RUNNING_STATES,
|
|
|
f0b3403 |
+ BUILD_CANCELLED_STATE)
|
|
|
f0b3403 |
from osbs.exceptions import (OsbsResponseException, OsbsNetworkException,
|
|
|
f0b3403 |
OsbsException)
|
|
|
f0b3403 |
from osbs.core import check_response
|
|
|
f0b3403 |
|
|
|
f0b3403 |
-from tests.constants import TEST_BUILD, TEST_LABEL, TEST_LABEL_VALUE, TEST_BUILD_CONFIG
|
|
|
f0b3403 |
+from tests.constants import (TEST_BUILD, TEST_CANCELLED_BUILD, TEST_LABEL,
|
|
|
f0b3403 |
+ TEST_LABEL_VALUE, TEST_BUILD_CONFIG)
|
|
|
f0b3403 |
from tests.fake_api import openshift
|
|
|
f0b3403 |
import pytest
|
|
|
f0b3403 |
|
|
|
f0b3403 |
@@ -142,6 +144,12 @@ class TestOpenshift(object):
|
|
|
f0b3403 |
assert response.json()["metadata"]["name"] == TEST_BUILD
|
|
|
f0b3403 |
assert response.json()["status"]["phase"].lower() in BUILD_FINISHED_STATES
|
|
|
f0b3403 |
|
|
|
f0b3403 |
+ def test_cancel_build(self, openshift):
|
|
|
f0b3403 |
+ response = openshift.cancel_build(TEST_CANCELLED_BUILD)
|
|
|
f0b3403 |
+ assert response is not None
|
|
|
f0b3403 |
+ assert response.json()["metadata"]["name"] == TEST_CANCELLED_BUILD
|
|
|
f0b3403 |
+ assert response.json()["status"]["phase"].lower() in BUILD_CANCELLED_STATE
|
|
|
f0b3403 |
+
|
|
|
f0b3403 |
def test_get_build_config(self, openshift):
|
|
|
f0b3403 |
mock_response = {"spam": "maps"}
|
|
|
f0b3403 |
build_config_name = 'some-build-config-name'
|