Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for separators broke existing CasC configuration #159

Open
KalleOlaviNiemitalo opened this issue Oct 30, 2024 · 4 comments
Open

Comments

@KalleOlaviNiemitalo
Copy link

Jenkins and plugins versions report

Environment
Jenkins: 2.462.3
OS: Windows Server 2012 R2 - 6.3
Java: 17.0.10 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
Office-365-Connector:5.0.0
analysis-model-api:12.9.0
ansicolor:1.0.5
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.4-124.v31e2987e48f4
asm-api:9.7.1-97.v4cc844130d97
atlassian-bitbucket-server-integration:4.1.1
authentication-tokens:1.119.v50285141b_7e1
authorize-project:1.8.1
azure-ad:531.v13107da_f2635
azure-sdk:174.va_89c1df897d2
basic-branch-build-strategies:81.v05e333931c7d
bitbucket-server-checks:1.0-SNAPSHOT (private-49d94041-kalle)
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1197.vfa_d0c47c267d
buildtriggerbadge:251.vdf6ef853f3f5
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.2.1
cloudbees-bitbucket-branch-source:895.v15dc41668f03
cloudbees-disk-usage-simple:205.v47f4ee8803d1
cloudbees-folder:6.955.v81e2a_35c08d3
command-launcher:115.vd8b_301cc15d0
commons-compress-api:1.26.1-2
commons-httpclient3-api:3.1-3
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.12.0-129.v99a_50df237f7
compress-artifacts:109.v98a_db_d3cb_72c
configuration-as-code:1873.vea_5814ca_9c93
copyartifact:757.v05365583a_455
coverage:1.16.1
credentials:1384.vf0a_2ed06f9c6
credentials-binding:681.vf91669a_32e45
customizable-header:141.vdd3dcb_cfcf66
data-tables-api:2.1.8-1
display-url-api:2.204.vf6fddd8a_8b_e9
dtkit-api:3.0.2
durable-task:577.v2a_8a_4b_7c0247
echarts-api:5.5.1-4
eddsa-api:0.3.0-4.v84c6f0f4969e
extended-read-permission:53.v6499940139e5
fast-track:1.0.0
flatpickr-api:4.6.13-5.v534d8025a_a_59
font-awesome-api:6.6.0-2
forensics-api:2.6.0
git:5.5.2
git-client:5.0.0
git-forensics:2.2.1
gson-api:2.11.0-85.v1f4e87273c33
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
hudson-wsclean-plugin:1.0.8
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:80.v8a_dee33ed6f0
jersey2-api:2.44-151.v6df377fff741
jira:3.13
job-restrictions:0.8
joda-time-api:2.13.0-93.v9934da_29b_a_e9
jquery3-api:3.7.1-2
json-api:20240303-101.v7a_8666713110
json-path-api:2.9.0-118.v7f23ed82a_8b_8
junit:1307.vdd5b_2646279e
lockable-resources:1325.v8cf9c299484a_
mailer:488.v0c9639c1a_eb_3
manage-permission:1.0.1
matrix-auth:3.2.3
matrix-project:839.vff91cd7e3a_b_2
metrics:4.2.21-458.vcf496cb_839e4
mina-sshd-api-common:2.14.0-133.vcc091215a_358
mina-sshd-api-core:2.14.0-133.vcc091215a_358
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-graph-view:340.v28cecee8b_25f
pipeline-groovy-lib:744.v5b_556ee7c253
pipeline-input-step:495.ve9c153f6067b_
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-definition:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-extensions:2.2214.vb_b_34b_2ea_9b_83
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2214.vb_b_34b_2ea_9b_83
pipeline-stage-view:2.34
pipeline-utility-steps:2.18.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-util-api:5.1.0
prism-api:1.29.0-17
resource-disposer:0.24
scm-api:696.v778d637b_a_762
script-security:1367.vdf2fc45f229c
sidebar-link:2.4.1
simple-queue:1.4.4
snakeyaml-api:2.3-123.v13484c65210a_
ssh-credentials:343.v884f71d78167
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.147.vb_73cc728a_32e
variant:60.v7290fc0eb_b_cd
warnings-ng:11.10.0
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1336.vee415d95c521
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:3990.vd281dd77a_388
workflow-durable-task-step:1371.vb_7cec8f3b_95e
workflow-job:1436.vfa_244484591f
workflow-multibranch:795.ve0cb_1f45ca_9a_
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:678.v3ee58b_469476
workflow-support:930.vf51d22b_ce488
ws-cleanup:0.47
xunit:3.1.5

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows

Reproduction steps

I had configured the customizable header in jenkins.yaml with this kind of structure:

appearance:
  customHeader:
    cssResource: "userContent/customizable-header/header.css"
    enabled: true
    header: "logo"
    headerColor:
      backgroundColor: "#0c376c"
      color: "white"
      hoverColor: "grey"
    links:
    - label: "Jira"
      logo:
        image:
          logoUrl: "userContent/sidebar/64jira.png"
      url: "https://jira.example.com/secure/MyJiraHome.jspa"
    logo:
      symbol:
        symbol: "symbol-jenkins"
    logoText: "Jenkins"
    thinHeader: false
    title: "<img src='/jenkins/userContent/customizable-header/company-logo.png' alt='Company'>"

and then upgraded customizable-header-plugin from 140.v8e771d054075 to 141.vdd3dcb_cfcf66.

Expected Results

Jenkins should start OK with the existing jenkins.yaml, or alternatively, the customizable-header 141.vdd3dcb_cfcf66 release notes should warn that it is not compatible.

Actual Results

Jenkins did not start:

java.lang.IllegalArgumentException: Single entry map expected to configure a io.jenkins.plugins.customizable_header.AbstractLink
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configureMapping(HeteroDescribableConfigurator.java:303)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.preConfigure(HeteroDescribableConfigurator.java:285)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:85)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:94)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.check(HeteroDescribableConfigurator.java:57)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:355)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:293)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:360)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:293)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$9(ConfigurationAsCode.java:834)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:777)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:834)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:820)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:699)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:356)
	at PluginClassLoader for configuration-as-code//io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:345)
Caused: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:109)
Caused: java.lang.Error
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:115)
	at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:185)
	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1175)
	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused: org.jvnet.hudson.reactor.ReactorException
	at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:290)
	at jenkins.InitReactorRunner.run(InitReactorRunner.java:49)
	at jenkins.model.Jenkins.executeReactor(Jenkins.java:1210)
	at jenkins.model.Jenkins.<init>(Jenkins.java:997)
	at hudson.model.Hudson.<init>(Hudson.java:86)
	at hudson.model.Hudson.<init>(Hudson.java:82)
	at hudson.WebAppMain$3.run(WebAppMain.java:248)
Caused: hudson.util.HudsonFailedToLoad
	at hudson.WebAppMain$3.run(WebAppMain.java:273)

Anything else?

Presumably caused by #158.

Looks like jenkins.yaml has to be restructured like this in 141.vdd3dcb_cfcf66:

appearance:
  customHeader:
    cssResource: "userContent/customizable-header/header.css"
    enabled: true
    header: "logo"
    headerColor:
      backgroundColor: "#0c376c"
      color: "white"
      hoverColor: "grey"
    links:
    - appNavLink:
        label: "Jira"
        logo:
          image:
            logoUrl: "userContent/sidebar/64jira.png"
        url: "https://jira.example.com/secure/MyJiraHome.jspa"
    logo:
      symbol:
        symbol: "symbol-jenkins"
    logoText: "Jenkins"
    thinHeader: false
    title: "<img src='/jenkins/userContent/customizable-header/company-logo.png' alt='Company'>"

Are you interested in contributing a fix?

No response

@KalleOlaviNiemitalo KalleOlaviNiemitalo changed the title #158 broke existing CasC configuration Support for separators broke existing CasC configuration Oct 30, 2024
@mawinter69
Copy link
Contributor

I need unit tests
wondering if can write some converter from the old to the new format, but CasC is not straight forward in that aspect.
Might take a while until I can provide a fix

@mawinter69
Copy link
Contributor

Marked the release as breaking CasC for now

@KalleOlaviNiemitalo
Copy link
Author

KalleOlaviNiemitalo commented Oct 30, 2024

I see the warning at https://github.com/jenkinsci/customizable-header-plugin/releases/tag/141.vdd3dcb_cfcf66 but not yet at https://plugins.jenkins.io/customizable-header/releases/#version_141.vdd3dcb_cfcf66. I wonder how soon it will propagate there.

13:03 UTC: The warning has propagated.

@jonesbusy
Copy link

Same issue here after upgrade. I will apply the JCasC change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants