Turn COMPOSE_ID version generator into DATE_RESPIN
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
388be481ea
commit
8181c5be48
@ -950,17 +950,17 @@ Version and release values for certain artifacts can be generated automatically
|
||||
based on release version, compose label, date, type and respin. This can be
|
||||
used to shorten the config and keep it the same for multiple uses.
|
||||
|
||||
+----------------------------+-------------------+--------------+------------------+
|
||||
| Compose ID | Label | Version | Release |
|
||||
+============================+===================+==============+==================+
|
||||
| ``F-Rawhide-20170406.n.0`` | ``-`` | ``Rawhide`` | ``20170406.n.0`` |
|
||||
+----------------------------+-------------------+--------------+------------------+
|
||||
| ``F-26-20170329.1`` | ``Alpha-1.6`` | ``26_Alpha`` | ``1.6`` |
|
||||
+----------------------------+-------------------+--------------+------------------+
|
||||
| ``F-Atomic-25-20170407.0`` | ``RC-20170407.0`` | ``25`` | ``20170407.0`` |
|
||||
+----------------------------+-------------------+--------------+------------------+
|
||||
| ``F-Atomic-25-20170407.0`` | ``-`` | ``25`` | ``20170407.0`` |
|
||||
+----------------------------+-------------------+--------------+------------------+
|
||||
+----------------------------+-------------------+--------------+--------------+--------+------------------+
|
||||
| Compose ID | Label | Version | Date | Respin | Release |
|
||||
+============================+===================+==============+==============+========+==================+
|
||||
| ``F-Rawhide-20170406.n.0`` | ``-`` | ``Rawhide`` | ``20170406`` | ``0`` | ``20170406.n.0`` |
|
||||
+----------------------------+-------------------+--------------+--------------+--------+------------------+
|
||||
| ``F-26-20170329.1`` | ``Alpha-1.6`` | ``26_Alpha`` | ``20170329`` | ``1`` | ``1.6`` |
|
||||
+----------------------------+-------------------+--------------+--------------+--------+------------------+
|
||||
| ``F-Atomic-25-20170407.0`` | ``RC-20170407.0`` | ``25`` | ``20170407`` | ``0`` | ``20170407.0`` |
|
||||
+----------------------------+-------------------+--------------+--------------+--------+------------------+
|
||||
| ``F-Atomic-25-20170407.0`` | ``-`` | ``25`` | ``20170407`` | ``0`` | ``20170407.0`` |
|
||||
+----------------------------+-------------------+--------------+--------------+--------+------------------+
|
||||
|
||||
All non-``RC`` milestones from label get appended to the version. For release
|
||||
either label is used or date, type and respin.
|
||||
@ -1230,6 +1230,8 @@ repository with a new commit.
|
||||
* ``version`` -- (*str*) Version string to be added as versioning metadata.
|
||||
If this option is set to ``!OSTREE_VERSION_FROM_LABEL_DATE_TYPE_RESPIN``,
|
||||
a value will be generated automatically as ``$VERSION.$RELEASE``.
|
||||
If this option is set to ``!VERSION_FROM_VERSION_DATE_RESPIN``,
|
||||
a value will be generated automatically as ``$VERSION.$DATE.$RESPIN``.
|
||||
:ref:`See how those values are created <auto-version>`.
|
||||
* ``tag_ref`` -- (*bool*, default ``True``) If set to ``False``, a git
|
||||
reference will not be created.
|
||||
|
@ -784,9 +784,10 @@ def version_generator(compose, gen):
|
||||
return '%s.%s' % (compose.image_version, compose.image_release)
|
||||
elif gen == '!RELEASE_FROM_LABEL_DATE_TYPE_RESPIN':
|
||||
return compose.image_release
|
||||
elif gen == '!RELEASE_FROM_VERSION_COMPOSE_ID':
|
||||
return '%s.%s' % (compose.ci_base.release.version,
|
||||
compose.ci_base.id)
|
||||
elif gen == '!VERSION_FROM_VERSION_DATE_RESPIN':
|
||||
return '%s.%s.%s' % (compose.ci_base.release.version,
|
||||
compose.ci_base.date,
|
||||
compose.compose_respin)
|
||||
elif gen and gen[0] == '!':
|
||||
raise RuntimeError("Unknown version generator '%s'" % gen)
|
||||
return gen
|
||||
|
@ -614,6 +614,7 @@ class TestVersionGenerator(unittest.TestCase):
|
||||
|
||||
self.compose = mock.MagicMock()
|
||||
self.compose.ci_base = ci
|
||||
self.compose.compose_respin = 0
|
||||
|
||||
def test_unknown_generator(self):
|
||||
compose = mock.Mock()
|
||||
@ -631,9 +632,9 @@ class TestVersionGenerator(unittest.TestCase):
|
||||
compose = mock.Mock()
|
||||
self.assertEqual(util.version_generator(compose, None), None)
|
||||
|
||||
def test_release_from_version_compose_id(self):
|
||||
self.assertEqual(util.version_generator(self.compose, '!RELEASE_FROM_VERSION_COMPOSE_ID'),
|
||||
'8.RHEL-8.0-20180101.0')
|
||||
def test_release_from_version_date_respin(self):
|
||||
self.assertEqual(util.version_generator(self.compose, '!VERSION_FROM_VERSION_DATE_RESPIN'),
|
||||
'8.20160101.0')
|
||||
|
||||
|
||||
class TestTZOffset(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user