class SimpleBuild(CommonBuild): """ Simple build type for scratch builds - gets sources from git, builds image according to Dockerfile, pushes it to a registry. """ key = SIMPLE_BUILD_TYPE def __init__(self, build_json_store, **kwargs): super(SimpleBuild, self).__init__(build_json_store, **kwargs) self.spec = SimpleSpec() def set_params(self, **kwargs): """ set parameters according to specification """ logger.debug("setting params '%s' for %s", kwargs, self.spec) self.spec.set_params(**kwargs) def render(self, validate=True): if validate: self.spec.validate() super(SimpleBuild, self).render() try: self.dj.dock_json_set_arg('exit_plugins', "store_metadata_in_osv3", "url", self.spec.openshift_uri.value) except RuntimeError: # For compatibility with older osbs.conf files self.dj.dock_json_set_arg('postbuild_plugins', "store_metadata_in_osv3", "url", self.spec.openshift_uri.value) self.dj.write_dock_json() self.build_json = self.template logger.debug(self.build_json) return self.build_json
class SimpleBuild(CommonBuild): """ Simple build type for scratch builds - gets sources from git, builds image according to Dockerfile, pushes it to a registry. """ key = SIMPLE_BUILD_TYPE def __init__(self, build_json_store, **kwargs): super(SimpleBuild, self).__init__(build_json_store, **kwargs) self.spec = SimpleSpec() def set_params(self, **kwargs): """ set parameters according to specification """ logger.debug("setting params '%s' for %s", kwargs, self.spec) self.spec.set_params(**kwargs) def render(self, validate=True): if validate: self.spec.validate() super(SimpleBuild, self).render() dj = DockJsonManipulator(self.template, self.inner_template) self.template['parameters']['output']['imageTag'] = self.spec.image_tag.value dj.dock_json_set_arg('prebuild_plugins', "change_source_registry", "registry_uri", self.spec.registry_uri.value) dj.dock_json_set_arg('postbuild_plugins', "store_metadata_in_osv3", "url", self.spec.openshift_uri.value) dj.write_dock_json() self.build_json = self.template logger.debug(self.build_json) return self.build_json
class SimpleBuild(CommonBuild): """ Simple build type for scratch builds - gets sources from git, builds image according to Dockerfile, pushes it to a registry. """ key = SIMPLE_BUILD_TYPE def __init__(self, build_json_store, **kwargs): super(SimpleBuild, self).__init__(build_json_store, **kwargs) self.spec = SimpleSpec() def set_params(self, **kwargs): """ set parameters according to specification """ logger.debug("setting params '%s' for %s", kwargs, self.spec) self.spec.set_params(**kwargs) def render(self, validate=True): if validate: self.spec.validate() super(SimpleBuild, self).render() try: self.dj.dock_json_set_arg('exit_plugins', "store_metadata_in_osv3", "url", self.spec.builder_openshift_url.value) except RuntimeError: # For compatibility with older osbs.conf files self.dj.dock_json_set_arg('postbuild_plugins', "store_metadata_in_osv3", "url", self.spec.builder_openshift_url.value) # Remove 'version' from tag_and_push plugin config as it's no # longer needed if self.dj.dock_json_has_plugin_conf('postbuild_plugins', 'tag_and_push'): push_conf = self.dj.dock_json_get_plugin_conf( 'postbuild_plugins', 'tag_and_push') try: registries = push_conf['args']['registries'] except KeyError: pass else: for regdict in registries.values(): if 'version' in regdict: del regdict['version'] self.dj.write_dock_json() self.build_json = self.template logger.debug(self.build_json) return self.build_json
class SimpleBuild(CommonBuild): """ Simple build type for scratch builds - gets sources from git, builds image according to Dockerfile, pushes it to a registry. """ key = SIMPLE_BUILD_TYPE def __init__(self, build_json_store, **kwargs): super(SimpleBuild, self).__init__(build_json_store, **kwargs) self.spec = SimpleSpec() def set_params(self, **kwargs): """ set parameters according to specification """ logger.debug("setting params '%s' for %s", kwargs, self.spec) self.spec.set_params(**kwargs) def render(self, validate=True): if validate: self.spec.validate() super(SimpleBuild, self).render() try: self.dj.dock_json_set_arg('exit_plugins', "store_metadata_in_osv3", "url", self.spec.builder_openshift_url.value) except RuntimeError: # For compatibility with older osbs.conf files self.dj.dock_json_set_arg('postbuild_plugins', "store_metadata_in_osv3", "url", self.spec.builder_openshift_url.value) # Remove 'version' from tag_and_push plugin config as it's no # longer needed if self.dj.dock_json_has_plugin_conf('postbuild_plugins', 'tag_and_push'): push_conf = self.dj.dock_json_get_plugin_conf('postbuild_plugins', 'tag_and_push') try: registries = push_conf['args']['registries'] except KeyError: pass else: for regdict in registries.values(): if 'version' in regdict: del regdict['version'] self.dj.write_dock_json() self.build_json = self.template logger.debug(self.build_json) return self.build_json
def __init__(self, build_json_store, **kwargs): super(SimpleBuild, self).__init__(build_json_store, **kwargs) self.spec = SimpleSpec()