How to use the cekit.generator.docker.DockerGenerator function in cekit

To help you get started, we’ve selected a few cekit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cekit / cekit / tests / test_unit_generator_docker.py View on Github external
def docker_generator(tmpdir, overrides=None):
    if overrides is None:
        overrides = {}

    image_dir = str(tmpdir)
    target_dir = os.path.join(image_dir, 'target')
    yield DockerGenerator(image_dir, target_dir, overrides)
github cekit / cekit / tests / test_builder.py View on Github external
def test_buildah_builder_run_with_generator(mocker):
    params = Map({'tags': []})
    check_call = mocker.patch.object(subprocess, 'check_call')
    builder = create_builder_object(mocker, 'buildah', params)
    builder.generator = DockerGenerator("", "", {})
    builder.generator.image = Image(yaml.safe_load("""
    name: foo
    version: 1.9
    labels:
      - name: test
        value: val1
      - name: label2
        value: val2
    envs:
      - name: env1
        value: env1val
    """), 'foo')
    builder.run()

    check_call.assert_called_once_with(['/usr/bin/buildah',
                                        'build-using-dockerfile',
github cekit / cekit / cekit / generator / docker.py View on Github external
def __init__(self, descriptor_path, target, overrides):
        super(DockerGenerator, self).__init__(descriptor_path, target, overrides)
        self._fetch_repos = True
github cekit / cekit / cekit / builder.py View on Github external
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
            LOGGER.info('Generating files for {} engine'.format(self.build_engine))
        elif self.build_engine == 'osbs':
            from cekit.generator.osbs import OSBSGenerator as generator_impl
            LOGGER.info('Generating files for OSBS engine')
        else:
            raise CekitError("Unsupported generator type: '{}'".format(self.build_engine))

        self.generator = generator_impl(self.params.descriptor,
                                        self.params.target,
                                        self.params.overrides)

        if self.params.get('koji_target', False):
            LOGGER.warning("The '--koji-target' switch is deprecated, please use overrides " +
                           "(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()