Stop setting release in OSBS phase
Atomic Reactor does not honor this option. In the future we might need to reintroduce this feature, but given that it does not work in the current form it is better removed. Fixes: #348 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
664c5e54a3
commit
7d0ee41f23
@ -1164,11 +1164,7 @@ they are not scratch builds).
|
||||
* ``target`` -- (*str*) A Koji target to build the image for.
|
||||
|
||||
The configuration will pass other attributes directly to the Koji task.
|
||||
This includes ``name``, ``version``, ``release``, ``scratch`` and
|
||||
``priority``.
|
||||
|
||||
If ``release`` is set explicitly to ``None``, the value will be retrieved
|
||||
from Koji. If this feature is used, a ``name`` key must be set as well..
|
||||
This includes ``name``, ``version``, ``scratch`` and ``priority``.
|
||||
|
||||
A value for ``yum_repourls`` will be created automatically and point at a
|
||||
repository in the current compose.
|
||||
@ -1184,7 +1180,6 @@ Example config
|
||||
"name": "fedora-docker-base",
|
||||
"target": "f24-docker-candidate",
|
||||
"version": "24",
|
||||
"release": None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,6 @@ class OSBSThread(WorkerThread):
|
||||
try:
|
||||
source = util.resolve_git_url(config.pop('url'))
|
||||
target = config.pop('target')
|
||||
|
||||
# Set release dynamically
|
||||
if 'release' in config and config['release'] is None:
|
||||
config['release'] = self._get_release(koji, target, config['name'])
|
||||
except KeyError as exc:
|
||||
raise RuntimeError('OSBS: missing config key %s for %s'
|
||||
% (exc, variant.uid))
|
||||
@ -133,14 +129,3 @@ class OSBSThread(WorkerThread):
|
||||
f.write('gpgcheck=0\n')
|
||||
|
||||
return translate_path(compose, repo_file)
|
||||
|
||||
def _get_release(self, koji, target, name):
|
||||
"""
|
||||
Get next release value based on last build. If no build has been done
|
||||
yet (in given target), use 1 as initial value.
|
||||
"""
|
||||
latest_builds = koji.koji_proxy.getLatestBuilds(target, package=name)
|
||||
try:
|
||||
return koji.koji_proxy.getNextRelease(latest_builds[0])
|
||||
except IndexError:
|
||||
return 1
|
||||
|
@ -275,63 +275,6 @@ class OSBSThreadTest(helpers.PungiTestCase):
|
||||
|
||||
self.assertIn("missing config key 'target' for Server", str(ctx.exception))
|
||||
|
||||
@mock.patch('pungi.util.resolve_git_url')
|
||||
@mock.patch('pungi.phases.osbs.kojiwrapper.KojiWrapper')
|
||||
def test_set_release_dynamically(self, KojiWrapper, resolve_git_url):
|
||||
cfg = {
|
||||
'url': 'git://example.com/repo?#HEAD',
|
||||
'target': 'f24-docker-candidate',
|
||||
'release': None,
|
||||
'name': 'fedora-server-docker',
|
||||
}
|
||||
self._setupMock(KojiWrapper, resolve_git_url)
|
||||
last_build = mock.Mock()
|
||||
self.wrapper.koji_proxy.getLatestBuilds.return_value = [last_build, mock.Mock()]
|
||||
self.wrapper.koji_proxy.getNextRelease.return_value = 3
|
||||
|
||||
self.t.process((self.compose, self.compose.variants['Server'], cfg), 1)
|
||||
|
||||
self._assertCorrectCalls(
|
||||
{'release': 3, 'name': 'fedora-server-docker'},
|
||||
[mock.call.koji_proxy.getLatestBuilds(
|
||||
'f24-docker-candidate', package='fedora-server-docker'),
|
||||
mock.call.koji_proxy.getNextRelease(last_build)])
|
||||
|
||||
@mock.patch('pungi.util.resolve_git_url')
|
||||
@mock.patch('pungi.phases.osbs.kojiwrapper.KojiWrapper')
|
||||
def test_set_release_dynamically_no_previous_build(self, KojiWrapper, resolve_git_url):
|
||||
cfg = {
|
||||
'url': 'git://example.com/repo?#HEAD',
|
||||
'target': 'f24-docker-candidate',
|
||||
'release': None,
|
||||
'name': 'fedora-server-docker',
|
||||
}
|
||||
self._setupMock(KojiWrapper, resolve_git_url)
|
||||
self.wrapper.koji_proxy.getLatestBuilds.return_value = []
|
||||
|
||||
self.t.process((self.compose, self.compose.variants['Server'], cfg), 1)
|
||||
|
||||
self._assertCorrectCalls(
|
||||
{'release': 1, 'name': 'fedora-server-docker'},
|
||||
[mock.call.koji_proxy.getLatestBuilds(
|
||||
'f24-docker-candidate', package='fedora-server-docker')])
|
||||
|
||||
@mock.patch('pungi.util.resolve_git_url')
|
||||
@mock.patch('pungi.phases.osbs.kojiwrapper.KojiWrapper')
|
||||
def test_set_release_dynamically_missing_name(self, KojiWrapper, resolve_git_url):
|
||||
cfg = {
|
||||
'url': 'git://example.com/repo?#HEAD',
|
||||
'target': 'fedora-24-docker-candidate',
|
||||
'release': None,
|
||||
}
|
||||
self._setupMock(KojiWrapper, resolve_git_url)
|
||||
self.wrapper.koji_proxy.getLatestBuilds.return_value = []
|
||||
|
||||
with self.assertRaises(RuntimeError) as ctx:
|
||||
self.t.process((self.compose, self.compose.variants['Server'], cfg), 1)
|
||||
|
||||
self.assertIn("missing config key 'name' for Server", str(ctx.exception))
|
||||
|
||||
@mock.patch('pungi.util.resolve_git_url')
|
||||
@mock.patch('pungi.phases.osbs.kojiwrapper.KojiWrapper')
|
||||
def test_failing_task(self, KojiWrapper, resolve_git_url):
|
||||
|
Loading…
Reference in New Issue
Block a user