diff --git a/cekit/builder.py b/cekit/builder.py
index 7b2b163..c03bf46 100644
--- a/cekit/builder.py
+++ b/cekit/builder.py
@@ -29,10 +29,15 @@ class Command(object):
     def prepare(self):
         pass
 
+    def before_run(self):
+        pass
+
     def run(self):
         raise CekitError(
             "Command.run() method is not implemented for '{}' command and '{}' type. Please report it!".format(self._command, self._type))
 
+    def after_run(self):
+        pass
 
 class Builder(Command):
     """
@@ -57,8 +62,16 @@ class Builder(Command):
             LOGGER.info("The --dry-run parameter was specified, build will not be executed")
             return
 
+        self.before_run()
+
         self.run()
 
+        self.after_run()
+
+    def before_run(self):
+        LOGGER.debug("Checking CEKit build dependencies...")
+        self.dependency_handler.handle(self)
+
     def prepare(self):
         if self.build_engine == 'docker' or self.build_engine == 'buildah' or self.build_engine == "podman":
             from cekit.generator.docker import DockerGenerator as generator_impl
@@ -87,6 +100,3 @@ class Builder(Command):
 
         self.generator.init()
         self.generator.generate(self.build_engine)
-
-        LOGGER.debug("Checking CEKit build dependencies...")
-        self.dependency_handler.handle(self)
diff --git a/cekit/builders/osbs.py b/cekit/builders/osbs.py
index 8d01362..bd70bd9 100644
--- a/cekit/builders/osbs.py
+++ b/cekit/builders/osbs.py
@@ -80,10 +80,10 @@ class OSBSBuilder(Builder):
 
         return deps
 
-    def prepare(self):
+    def before_run(self):
         """Prepares dist-git repository for OSBS build."""
 
-        super(OSBSBuilder, self).prepare()
+        super(OSBSBuilder, self).before_run()
 
         self.prepare_dist_git()
         self.copy_to_dist_git()

When OSBS builder is exeuted with --dry-run we should not clone dist-git repository
**Describe the solution you'd like**
Currently the dist-git repository is cloned even if we specify `--dry-run`. We should refrain from doing it. It should be cloned only when a regular run is executed.

**Additional context**
None.

diff --git a/tests/test_builder.py b/tests/test_builder.py
index 74334f5..20707e3 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -444,6 +444,7 @@ def test_osbs_copy_artifacts_to_dist_git(mocker, tmpdir, artifact, src, target):
 
     with mocker.patch('cekit.tools.get_brew_url', side_effect=subprocess.CalledProcessError(1, 'command')):
         builder.prepare()
+        builder.before_run()
 
     dist_git_class.assert_called_once_with(os.path.join(
         str(tmpdir), 'osbs', 'repo'), str(tmpdir), 'repo', 'branch')
@@ -460,6 +461,68 @@ def test_docker_builder_defaults():
     assert builder.params.tags == ['foo', 'bar']
 
 
+def test_osbs_dist_git_sync_called(mocker, tmpdir):
+    mocker.patch('cekit.tools.DependencyHandler.handle')
+
+    image_descriptor = {
+        'schema_version': 1,
+        'from': 'centos:latest',
+        'name': 'test/image',
+        'version': '1.0',
+        'labels': [{'name': 'foo', 'value': 'bar'}, {'name': 'labela', 'value': 'a'}],
+        'osbs': {
+            'repository': {
+                'name': 'repo',
+                'branch': 'branch'
+            }
+        }
+    }
+
+    builder = create_builder_object(
+        mocker, 'osbs', {}, {'descriptor': yaml.dump(image_descriptor), 'target': str(tmpdir)})
+
+    prepare_dist_git = mocker.patch.object(builder, 'prepare_dist_git')
+    copy_to_dist_git = mocker.patch.object(builder, 'copy_to_dist_git')
+    run = mocker.patch.object(builder, 'run')
+
+    builder.execute()
+
+    prepare_dist_git.assert_called_once_with()
+    copy_to_dist_git.assert_called_once_with()
+    run.assert_called_once_with()
+
+
+def test_osbs_dist_git_sync_NOT_called_when_dry_run_set(mocker, tmpdir):
+    mocker.patch('cekit.tools.DependencyHandler.handle')
+
+    image_descriptor = {
+        'schema_version': 1,
+        'from': 'centos:latest',
+        'name': 'test/image',
+        'version': '1.0',
+        'labels': [{'name': 'foo', 'value': 'bar'}, {'name': 'labela', 'value': 'a'}],
+        'osbs': {
+            'repository': {
+                'name': 'repo',
+                'branch': 'branch'
+            }
+        }
+    }
+
+    builder = create_builder_object(
+        mocker, 'osbs', {'dry_run': True}, {'descriptor': yaml.dump(image_descriptor), 'target': str(tmpdir)})
+
+    prepare_dist_git = mocker.patch.object(builder, 'prepare_dist_git')
+    copy_to_dist_git = mocker.patch.object(builder, 'copy_to_dist_git')
+    run = mocker.patch.object(builder, 'run')
+
+    builder.execute()
+
+    prepare_dist_git.assert_not_called()
+    copy_to_dist_git.assert_not_called()
+    run.assert_not_called()
+
+
 def test_docker_build_default_tags(mocker):
     builder = DockerBuilder(Map({'target': 'something'}), Map())
 

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/cekit/cekit.git@95f20e5d4307a361152589c0a22e6d1b1611b02c#egg=cekit
click==8.1.8
colorlog==6.9.0
coverage==7.8.0
docopt==0.6.2
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
PyYAML==6.0.2
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
typing_extensions==4.13.0

name: cekit
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - click==8.1.8
      - colorlog==6.9.0
      - coverage==7.8.0
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - iniconfig==2.1.0
      - jinja2==3.1.6
      - markupsafe==3.0.2
      - packaging==24.2
      - pluggy==1.5.0
      - pykwalify==1.8.0
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.9.0.post0
      - pyyaml==6.0.2
      - ruamel-yaml==0.18.10
      - ruamel-yaml-clib==0.2.12
      - six==1.17.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/cekit

tests/test_builder.py::test_osbs_copy_artifacts_to_dist_git[artifact0-image/some-path.jar-osbs/repo/some-path.jar] tests/test_builder.py::test_osbs_copy_artifacts_to_dist_git[artifact1-image/some-name-osbs/repo/some-name] tests/test_builder.py::test_osbs_copy_artifacts_to_dist_git[artifact2-image/some-target.jar-osbs/repo/some-target.jar] tests/test_builder.py::test_osbs_copy_artifacts_to_dist_git[artifact3-image/some-name-osbs/repo/some-name] tests/test_builder.py::test_osbs_copy_artifacts_to_dist_git[artifact4-image/some-target.jar-osbs/repo/some-target.jar] tests/test_builder.py::test_osbs_dist_git_sync_NOT_called_when_dry_run_set
tests/test_builder.py::test_docker_build_default_tags tests/test_builder.py::test_docker_squashing_enabled tests/test_builder.py::test_docker_squashing_disabled tests/test_builder.py::test_docker_squashing_parameters
tests/test_builder.py::test_osbs_builder_defaults tests/test_builder.py::test_osbs_builder_redhat tests/test_builder.py::test_osbs_builder_use_rhpkg_stage tests/test_builder.py::test_osbs_builder_custom_commit_msg tests/test_builder.py::test_osbs_builder_nowait tests/test_builder.py::test_osbs_builder_user tests/test_builder.py::test_merge_container_yaml_no_limit_arch tests/test_builder.py::test_merge_container_yaml_limit_arch tests/test_builder.py::test_osbs_builder_run_brew_stage tests/test_builder.py::test_osbs_builder_run_brew tests/test_builder.py::test_osbs_builder_run_koji tests/test_builder.py::test_osbs_builder_run_brew_nowait tests/test_builder.py::test_osbs_builder_run_brew_user tests/test_builder.py::test_osbs_builder_run_brew_target tests/test_builder.py::test_osbs_wait_for_osbs_task_finished_successfully tests/test_builder.py::test_osbs_wait_for_osbs_task_in_progress tests/test_builder.py::test_osbs_wait_for_osbs_task_failed tests/test_builder.py::test_docker_builder_defaults tests/test_builder.py::test_osbs_dist_git_sync_called tests/test_builder.py::test_buildah_builder_run tests/test_builder.py::test_buildah_builder_run_pull tests/test_builder.py::test_podman_builder_run tests/test_builder.py::test_podman_builder_run_pull tests/test_builder.py::test_podman_builder_run_with_generator tests/test_builder.py::test_buildah_builder_run_with_generator
cekit/builder.py cekit/builders/osbs.py
cekit/builder.py cekit/builders/osbs.py