Configuration-as-code-plugin: Exported Unclassified Elements are Invalid

Created on 20 Feb 2020  路  3Comments  路  Source: jenkinsci/configuration-as-code-plugin

Your checklist for this issue

馃毃 Please review the guidelines for contributing to this repository.

  • [x] Jenkins version 2.204.2
  • [x] Plugin version 1.35
  • [x] OS Alpine Linux v3.9

Description

After doing an download configuration, I get elements, e.g. timestamperConfig, buildStepOperation, extendedEmailPublisher, that cause an exception to be raised stating that these elements are invalid.

Steps

The downloaded configuration gave output for unclassified with the following:

unclassified:
  bitbucketEndpointConfiguration:
    endpoints:
    - bitbucketCloudEndpoint:
        enableCache: false
        manageHooks: false
        repositoriesCacheDuration: 0
        teamCacheDuration: 0
  buildStepOperation:
    enabled: false
  defaultFolderConfiguration:
    healthMetrics:
    - worstChildHealthMetric:
        recursive: true
  extendedEmailPublisher:
    adminRequiredForTemplateTesting: false
    allowUnregisteredEnabled: false
    charset: "UTF-8"
    debugMode: false
    defaultBody: |-
      $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:

      Check console output at $BUILD_URL to view the results.
    defaultSubject: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
    maxAttachmentSize: -1
    maxAttachmentSizeMb: 0
    precedenceBulk: false
    useSsl: false
    watchingEnabled: false
  gitHubConfiguration:
    apiRateLimitChecker: ThrottleForNormalize
  gitHubPluginConfig:
    hookUrl: "http://localhost:8080/github-webhook/"
  gitSCM:
    createAccountBasedOnEmail: false
    showEntireCommitSummaryInChanges: false
    useExistingAccountWithSameEmail: false
  location:
    adminAddress: "address not configured yet <nobody@nowhere>"
    url: "http://localhost:8080/"
  mailer:
    charset: "UTF-8"
    useSsl: false
  pollSCM:
    pollingThreadCount: 10
  timestamperConfig:
    allPipelines: false
    elapsedTimeFormat: "'<b>'HH:mm:ss.S'</b> '"
    systemTimeFormat: "'<b>'HH:mm:ss'</b> '"

Expected Results

Elements in Unclassified global area that were exported from CasC would be supported in their usage with CasC.

Actual Results

However when I try to reuse this configuration, I get the following:

io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.model.GlobalConfigurationCategory$Unclassified : timestamperConfig,buildStepOperation,extendedEmailPublisher.
Available attributes : administrativeMonitorsConfiguration, artifactManager, bitbucketEndpointConfiguration, casCGlobalConfig, cloud, defaultFolderConfiguration, defaultView, gitHubConfiguration, gitHubPluginConfig, gitSCM, globalDefaultFlowDurabilityLevel, globalLibraries, jiraGlobalConfiguration, location, mailer, masterBuild, myView, nodeProperties, pipeline-model-docker, plugin, pollSCM, projectNamingStrategy, quietPeriod, resourceRoot, scmRetryCount, shell, usageStatistics, viewsTabBar
    at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:377)
    at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:366)
    at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287)
    at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$7(ConfigurationAsCode.java:746)
    at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:696)
Caused: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator
    at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:702)
    at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:746)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:731)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:611)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:292)
    at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:284)
Caused: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
Caused: java.lang.Error
    at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
    at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
    at jenkins.model.Jenkins$5.runTask(Jenkins.java:1121)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Notes

When I purged the invalid configuration elements that were exported from the Download, I did not get a raised exception.

bug

Most helpful comment

timestamper was renamed, I've sent them a PR to make both names work: https://github.com/jenkinsci/timestamper-plugin/pull/68 feel free to vote or nudge over there if it's a pain for you.

All 3 comments

Sounds like missing plugins

@darkn3rd looks like now the right name for this element is: timestamper not timestamperConfig.

timestamper was renamed, I've sent them a PR to make both names work: https://github.com/jenkinsci/timestamper-plugin/pull/68 feel free to vote or nudge over there if it's a pain for you.

Was this page helpful?
0 / 5 - 0 ratings