Pipeline Template Catalogs disappear after ugrading CloudBees CI to version 2.440.2.1

1 minute readKnowledge base

Issue

  • After ugrading CloudBees CI to version 2.440.2.1, Pipeline Template Catalogs are not loaded anymore:

    WARNING hudson.model.Descriptor#load: Failed to load /jenkins-home/pipeline-template-catalogs.xml com.thoughtworks.xstream.mapper.CannotResolveClassException: globalTemplateCatalogManagement at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:81) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at hudson.util.XStream2$CompatibilityMapper.realClass(XStream2.java:452) at hudson.util.xstream.MapperDelegate.realClass(MapperDelegate.java:46) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47) at com.thoughtworks.xstream.core.util.HierarchicalStreams.readClassType(HierarchicalStreams.java:29) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:135) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1464) at hudson.util.XStream2.unmarshal(XStream2.java:230) at hudson.util.XStream2.unmarshal(XStream2.java:201) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1441) at hudson.XmlFile.unmarshal(XmlFile.java:196) Caused: java.io.IOException: Unable to read /jenkins-home/pipeline-template-catalogs.xml

BEE-47502: Pipeline Template Catalog cannot be loaded after upgrading to 2.440.2.1

Resolution

The issue will be fixed in the upcoming April 2024 release.

Workaround

As a workaround, run the following groovy script under Manage Jenkins > Script Console to fix the configuration file and reload the catalogs:

def xstream = new hudson.util.XStream2() xstream.addCompatibilityAlias("globalTemplateCatalogManagement", com.cloudbees.pipeline.governance.templates.GlobalTemplateCatalogManagement.class); xstream.addCompatibilityAlias("templateCatalog", com.cloudbees.pipeline.governance.templates.TemplateCatalog.class); def configFile = com.cloudbees.pipeline.governance.templates.GlobalTemplateCatalogManagement.get().getConfigFile() def temp = xstream.fromXML(configFile.getFile()); temp.save() com.cloudbees.pipeline.governance.templates.GlobalTemplateCatalogManagement.get().load()