question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CasC is unable to reapply GlobalJobDslSecurityConfiguration after Jenkins restart

See original GitHub issue

I firstly observed that behavior when killing our Jenkins pod in K8s and it didn’t get back up. CasC 0.7-alpha was unable to reapply following part of the configuration. It also happened with earlier versions.

security:
  GlobalJobDslSecurityConfiguration:
    useScriptSecurity: false

The exception thrown is:

Caused by: org.jenkinsci.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.model.GlobalConfigurationCategory$Security : GlobalJobDslSecurityConfiguration

I traced it back to following line not resolving to true after restart for the GlobalJobDslSecurityConfiguration: https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/src/main/java/org/jenkinsci/plugins/casc/GlobalConfigurationCategoryConfigurator.java#L61

The culprit is

descriptor.getCategory() == category

resolving to false after restart.

See PR #255 for failing testcase.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
ndeloofcommented, Sep 28, 2018

got it:

serialized xml for GlobalJobDslSecurityConfiguration includes an unexpected line:

<category class="jenkins.model.GlobalConfigurationCategory$Security"/>

This is caused by groovy style property used to override getCategory

final GlobalConfigurationCategory category = GlobalConfigurationCategory.get(GlobalConfigurationCategory.Security)

doing so, XStream do consider a filed to be serialized, not just a method override. As a result, on load, XStream do create a fresh new jenkins.model.GlobalConfigurationCategory$Security instance, which is != from the singleton it is supposed to be.

4reactions
yogeekcommented, Feb 6, 2019

@ndeloof @ewelinawilkosz I think this issue can be closed :

  • job-dsl PR has finally been merged and is present in the job-dsl-1.71 release of January
  • I just applied the following configuration and the error did not occur anymore :
security:
  globaljobdslsecurityconfiguration:
    useScriptSecurity: true
Read more comments on GitHub >

github_iconTop Results From Across the Web

JCasC warning log for GlobalJobDslSecurityConfiguration ...
During Jenkins startup I get: WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class javaposse.jobdsl.plugin.
Read more >
Jenkins Home config.xml reset upon restart
So when jenkins is restarted, the configuration-as-code plugin uses the CASC/jenkins.yaml file to configure jenkins which DOES NOT have the ...
Read more >
A wrong configuration of CasC yaml kill Jenkins startup
While testing the CasC plugin I've found that if the yaml is wrong, Jenkins stop restarting, leaving you with an unoperational instance.
Read more >
Got IllegalStateException while restart Jenkins
When I restart jenkins using /restart command or after plugin installation I got the following error at Jenkins restart page: Stack tracejava.lang.
Read more >
Pipeline fails to resume after master restart/plugin upgrade
During a recent Jenkins plugin upgrade and master restart, it seems that Jenkins failed to resume at least two Pipeline jobs. The pipeline...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found