Repository: cekit/cekit

Issue:
Remove --tech-preview OSBS builder switch
**Describe the solution you'd like**
It was deprecated in 3.4 and scheduled to be removed in 3.5. It's time to do it.


Discussion:

Patch:
diff --git a/cekit/builder.py b/cekit/builder.py
index 51e0610..39f0c5f 100644
--- a/cekit/builder.py
+++ b/cekit/builder.py
@@ -85,10 +85,6 @@ class Builder(Command):
                            "(http://docs.cekit.io/en/latest/handbook/overrides.html) to adjust the koji " +
                            "target, '--koji-target' will be removed in version 3.6")
 
-        # These should always come last
-        if self.params.get('tech_preview', False):
-            # Modify the image name, after all other overrides have been processed
-            self.generator.add_tech_preview_overrides()
         if CONFIG.get('common', 'redhat'):
             # Add the redhat specific stuff after everything else
             self.generator.add_redhat_overrides()
diff --git a/cekit/cli.py b/cekit/cli.py
index ae795fc..ec62129 100644
--- a/cekit/cli.py
+++ b/cekit/cli.py
@@ -141,8 +141,6 @@ def build_podman(ctx, pull, no_squash, tags):  # pylint: disable=unused-argument
 
 @build.command(name="osbs", short_help="Build using OSBS engine")
 @click.option('--release', help="Execute a release build.", is_flag=True)
-# TODO: Remove in 3.5
-@click.option('--tech-preview', help="Execute a tech preview build.", is_flag=True)
 @click.option('--user', metavar="USER", help="User used to kick the build as.")
 @click.option('--nowait', help="Do not wait for the task to finish.", is_flag=True)
 @click.option('--stage', help="Use stage environmen.", is_flag=True)
@@ -152,7 +150,7 @@ def build_podman(ctx, pull, no_squash, tags):  # pylint: disable=unused-argument
 @click.option('--commit-message', metavar="MESSAGE", help="Custom dist-git commit message.")
 @click.option('--assume-yes', '-y', help="Execute build in non-interactive mode.", is_flag=True)
 @click.pass_context
-def build_osbs(ctx, release, tech_preview, user, nowait, stage, koji_target, sync_only, commit_message, assume_yes):  # pylint: disable=unused-argument
+def build_osbs(ctx, release, user, nowait, stage, koji_target, sync_only, commit_message, assume_yes):  # pylint: disable=unused-argument
     """
     DESCRIPTION
 
diff --git a/cekit/generator/base.py b/cekit/generator/base.py
index 6438de7..85ed250 100644
--- a/cekit/generator/base.py
+++ b/cekit/generator/base.py
@@ -129,11 +129,6 @@ class Generator(object):
         self.render_dockerfile()
         self.render_help()
 
-    # TODO: Remove in 3.5
-    def add_tech_preview_overrides(self):
-        LOGGER.warning("The '--tech-preview' switch is deprecated, please use overrides (http://docs.cekit.io/en/latest/handbook/overrides.html) to adjust the image name, '--tech-preview' will be removed in version 3.5")
-        self._overrides.append(self.get_tech_preview_overrides())
-
     def add_redhat_overrides(self):
         self._overrides.append(self.get_redhat_overrides())
 
@@ -255,24 +250,6 @@ class Generator(object):
             # write out the module with any overrides
             module.write(os.path.join(dest, "module.yaml"))
 
-    def get_tech_preview_overrides(self):
-        class TechPreviewOverrides(Overrides):
-            def __init__(self, generator):
-                super(TechPreviewOverrides, self).__init__({}, None)
-                self._generator = generator
-
-            @property
-            def name(self):
-                new_name = self._generator.image.name
-                if '/' in new_name:
-                    family, new_name = new_name.split('/')
-                    new_name = "%s-tech-preview/%s" % (family, new_name)
-                else:
-                    new_name = "%s-tech-preview" % new_name
-                return new_name
-
-        return TechPreviewOverrides(self)
-
     def get_redhat_overrides(self):
         class RedHatOverrides(Overrides):
             def __init__(self, generator):
diff --git a/docs/descriptor/includes/from.rst b/docs/descriptor/includes/from.rst
index 7bdb459..8f4bb5d 100644
--- a/docs/descriptor/includes/from.rst
+++ b/docs/descriptor/includes/from.rst
@@ -10,5 +10,5 @@ Base image of your image.
 
 .. code-block:: yaml
 
-    from: "jboss-eap-7-tech-preview/eap70:1.2"
+    from: "jboss-eap-7/eap70:1.2"
 
diff --git a/docs/handbook/building/builder-engines.rst b/docs/handbook/building/builder-engines.rst
index a4990d5..ad8c615 100644
--- a/docs/handbook/building/builder-engines.rst
+++ b/docs/handbook/building/builder-engines.rst
@@ -127,9 +127,6 @@ Input format
 Parameters
     ``--release``
         Perform an OSBS release build
-    ``--tech-preview``
-        Build tech preview image, see
-        :ref:`below for more information <handbook/building/builder-engines:Tech preview images>`
     ``--user``
         Alternative user passed to build task
     ``--nowait``
@@ -165,32 +162,6 @@ Example
 
         $ cekit build osbs --release
 
-Tech preview images
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. deprecated:: 3.3
-    Use the :ref:`overrides feature <handbook/overrides:Overrides>` instead:
-
-    .. code-block:: bash
-
-        $ cekit build --overrides '{"name": "custom-family-tech-preview/project-8-centos7"}' osbs
-
-The OSBS builder has support for building a tech preview image without modifying the image source.
-The only difference between a regular image and the tech preview image is the resulting
-name of the image. Tech preview images contain the ``-tech-preview`` suffix in the image family
-of the name.
-
-.. code-block:: bash
-
-    $ cekit build osbs --tech-preview
-
-.. note::
-    You can combine the ``--tech-preview`` preview switch with ``--release`` switch.
-
-Example
-    The ``custom-family/project-8-centos7`` image built with the ``--tech-preview`` switch will become
-    ``custom-family-tech-preview/project-8-centos7``.
-
 Buildah builder
 ---------------------------
 


Test patch:
diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py
index b648d55..13e510f 100644
--- a/tests/test_dockerfile.py
+++ b/tests/test_dockerfile.py
@@ -74,30 +74,6 @@ def test_dockerfile_rendering(tmpdir, mocker, name, desc_part, exp_regex):
     regex_dockerfile(target, exp_regex)
 
 
-@pytest.mark.parametrize('desc_part, exp_regex',
-                         [
-                             (
-                                 {'osbs': {'repository': {'name': 'repo_name', 'branch': 'branch_name'}}},
-                                 r'JBOSS_IMAGE_NAME=\"testimage-tech-preview\"'
-                             ),
-                             (
-                                 {'name': 'testimage/test',
-                                     'osbs': {'repository': {'name': 'repo_name', 'branch': 'branch_name'}}},
-                                 r'JBOSS_IMAGE_NAME=\"testimage-tech-preview/test\"'
-                             )
-                         ],
-                         ids=print_test_name)
-def test_dockerfile_rendering_tech_preview(tmpdir, mocker, desc_part, exp_regex):
-    mocker.patch('cekit.builders.osbs.OSBSBuilder._prepare_dist_git')
-    mocker.patch('cekit.builders.osbs.OSBSBuilder._copy_to_dist_git')
-    mocker.patch('cekit.builders.osbs.OSBSBuilder._sync_with_dist_git')
-    mocker.patch('cekit.builders.osbs.OSBSBuilder.dependencies')
-    target = str(tmpdir.mkdir('target'))
-
-    generate(target, ['--redhat', 'build', '--dry-run', 'osbs', '--tech-preview'], desc_part)
-    regex_dockerfile(target, exp_regex)
-
-
 def test_dockerfile_docker_odcs_pulp(tmpdir, mocker):
     mocker.patch('odcs.client.odcs.ODCS.new_compose', return_value={'id': 12})
     mocker.patch('odcs.client.odcs.ODCS.wait_for_compose', return_value={
diff --git a/tests/test_unit_args.py b/tests/test_unit_args.py
index b5bcb5f..0d9878b 100644
--- a/tests/test_unit_args.py
+++ b/tests/test_unit_args.py
@@ -83,7 +83,7 @@ def _get_class_by_name(clazz):
         {
             'descriptor': 'image.yaml', 'verbose': False, 'work_dir': '~/.cekit', 'config': '~/.cekit/config',
             'redhat': False, 'target': 'target', 'validate': False, 'dry_run': False, 'overrides': (), 'nowait': False,
-            'release': False, 'tech_preview': False, 'user': None, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
+            'release': False, 'user': None, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
         }
     ),
     # Test setting user for OSBS
@@ -93,7 +93,7 @@ def _get_class_by_name(clazz):
         {
             'descriptor': 'image.yaml', 'verbose': False, 'work_dir': '~/.cekit', 'config': '~/.cekit/config',
             'redhat': False, 'target': 'target', 'validate': False, 'dry_run': False, 'overrides': (), 'nowait': False,
-            'release': False, 'tech_preview': False, 'user': 'SOMEUSER', 'stage': False, 'koji_target': None, 'sync_only': False,
+            'release': False, 'user': 'SOMEUSER', 'stage': False, 'koji_target': None, 'sync_only': False,
             'commit_message': None, 'assume_yes': False
         }
     ),
@@ -104,7 +104,7 @@ def _get_class_by_name(clazz):
         {
             'descriptor': 'image.yaml', 'verbose': False, 'work_dir': '~/.cekit', 'config': '~/.cekit/config',
             'redhat': False, 'target': 'target', 'validate': False, 'dry_run': False, 'overrides': (), 'nowait': False,
-            'release': False, 'tech_preview': False, 'user': None, 'stage': True, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
+            'release': False, 'user': None, 'stage': True, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
         }
     ),
     # Test setting nowait for OSBS
@@ -114,7 +114,7 @@ def _get_class_by_name(clazz):
         {
             'descriptor': 'image.yaml', 'verbose': False, 'work_dir': '~/.cekit', 'config': '~/.cekit/config',
             'redhat': False, 'target': 'target', 'validate': False, 'dry_run': False, 'overrides': (), 'nowait': True,
-            'release': False, 'tech_preview': False, 'user': None, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
+            'release': False, 'user': None, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
         }
     ),
     (
@@ -141,7 +141,7 @@ def _get_class_by_name(clazz):
         {
             'descriptor': 'image.yaml', 'verbose': False, 'work_dir': '~/.cekit', 'config': '~/.cekit/config',
             'redhat': False, 'target': 'target', 'validate': False, 'dry_run': False, 'overrides': (), 'release': False,
-            'tech_preview': False, 'user': None, 'nowait': False, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
+            'user': None, 'nowait': False, 'stage': False, 'koji_target': None, 'sync_only': False, 'commit_message': None, 'assume_yes': False
         }),
     (
         ['build', 'docker'],
diff --git a/tests/test_validate.py b/tests/test_validate.py
index 8b3dadf..3094f44 100644
--- a/tests/test_validate.py
+++ b/tests/test_validate.py
@@ -459,7 +459,8 @@ def test_override_add_module_and_packages_in_overrides(tmpdir):
     assert check_dockerfile(
         image_dir, 'RUN yum --setopt=tsflags=nodocs install -y package1 package2 \\')
     assert check_dockerfile(image_dir, 'RUN [ "bash", "-x", "/tmp/scripts/master/script_a" ]')
-    assert check_dockerfile_text(image_dir, '        COPY \\\n            test \\\n            /tmp/artifacts/')
+    assert check_dockerfile_text(
+        image_dir, '        COPY \\\n            test \\\n            /tmp/artifacts/')
 
 
 # Test work of workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1700341
@@ -1131,24 +1132,6 @@ def test_validation_of_image_and_module_descriptors_should_fail_on_invalid_descr
     assert "Cannot find required key 'name'" in caplog.text
 
 
-# https://github.com/cekit/cekit/issues/559
-def test_osbs_builder_tech_preview_deprecation(tmpdir, caplog):
-    image_dir = str(tmpdir.mkdir('source'))
-    copy_repos(image_dir)
-
-    with open(os.path.join(image_dir, 'image.yaml'), 'w') as fd:
-        yaml.dump(image_descriptor, fd, default_flow_style=False)
-
-    run_cekit(image_dir, ['-v',
-                          'build',
-                          '--dry-run',
-                          'osbs',
-                          '--tech-preview'
-                          ])
-
-    assert "The '--tech-preview' switch is deprecated, please use overrides (http://docs.cekit.io/en/latest/handbook/overrides.html) to adjust the image name, '--tech-preview' will be removed in version 3.5" in caplog.text
-
-
 def run_cekit(cwd,
               parameters=['build', '--dry-run', 'docker'],
               message=None):