Skip to content

Commit

Permalink
Merge pull request #430 from projectatomic/koji-build-str
Browse files Browse the repository at this point in the history
koji_task_id label must be a string
  • Loading branch information
vrutkovs committed May 31, 2016
2 parents 9cde49a + 5f95110 commit 86f6fa6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion osbs/build/build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def render(self, validate=True):
koji_task_id = self.spec.koji_task_id.value
if koji_task_id is not None:
self.template['metadata'].setdefault('labels', {})
self.template['metadata']['labels']['koji-task-id'] = koji_task_id
self.template['metadata']['labels']['koji-task-id'] = str(koji_task_id)

use_auth = self.spec.use_auth.value
self.render_add_filesystem()
Expand Down
2 changes: 1 addition & 1 deletion osbs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def list_builds(self, build_config_id=None, koji_task_id=None,
label['buildconfig'] = build_config_id

if koji_task_id is not None:
label['koji-task-id'] = koji_task_id
label['koji-task-id'] = str(koji_task_id)

if label:
query['labelSelector'] = ','.join([selector.format(key=key,
Expand Down
4 changes: 2 additions & 2 deletions tests/build/test_build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def test_render_prod_request_with_repo(self, architecture, build_image, build_im
build_json = build_request.render()

assert build_json["metadata"]["name"] == TEST_BUILD_CONFIG
assert build_json["metadata"]["labels"]["koji-task-id"] == koji_task_id
assert build_json["metadata"]["labels"]["koji-task-id"] == str(koji_task_id)
assert "triggers" not in build_json["spec"]
assert build_json["spec"]["source"]["git"]["uri"] == TEST_GIT_URI
assert build_json["spec"]["source"]["git"]["ref"] == TEST_GIT_REF
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def test_render_prod_request_with_koji_secret(self, tmpdir):
build_request.set_params(**kwargs)
build_json = build_request.render()

assert build_json["metadata"]["labels"]["koji-task-id"] == koji_task_id
assert build_json["metadata"]["labels"]["koji-task-id"] == str(koji_task_id)

plugins = get_plugins_from_build_json(build_json)
assert get_plugin(plugins, "exit_plugins", "koji_promote")
Expand Down

0 comments on commit 86f6fa6

Please sign in to comment.