jenkinsci / azure-keyvault-plugin

Jenkins plugin for Azure Keyvault
https://plugins.jenkins.io/azure-keyvault/
MIT License
14 stars 21 forks source link

Error loading job after upgrading plugin - AzureKeyVaultBuildWrapper to BuildWrapper cast error #189

Closed starafdar1 closed 10 months ago

starafdar1 commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.387.3 OS: Windows Server 2019 - 10.0 Java: 11.0.18 - Microsoft (OpenJDK 64-Bit Server VM) --- ant:487.vd79d090d4ea_e antisamy-markup-formatter:159.v25b_c67cd35fb_ apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5 audit-trail:333.vb_e1b_b_0f1238c authentication-tokens:1.53.v1c90fd9191a_b_ azure-ad:349.vc02b_a_0b_142a_8 azure-credentials:254.v64da_8176c83a azure-keyvault:154.v5b_0f56b_a_4078 azure-sdk:132.v62b_48eb_6f32f block-queued-job:0.2.0 blueocean:1.27.4 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.4 blueocean-commons:1.27.4 blueocean-config:1.27.4 blueocean-core-js:1.27.4 blueocean-dashboard:1.27.4 blueocean-display-url:2.4.2 blueocean-events:1.27.4 blueocean-git-pipeline:1.27.4 blueocean-github-pipeline:1.27.4 blueocean-i18n:1.27.4 blueocean-jwt:1.27.4 blueocean-personalization:1.27.4 blueocean-pipeline-api-impl:1.27.4 blueocean-pipeline-editor:1.27.4 blueocean-pipeline-scm-api:1.27.4 blueocean-rest:1.27.4 blueocean-rest-impl:1.27.4 blueocean-web:1.27.4 bootstrap4-api:4.6.0-5 bootstrap5-api:5.2.2-3 bouncycastle-api:2.27 branch-api:2.1092.vda_3c2a_a_f0c11 build-name-setter:2.2.0 build-timeout:1.30 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:2.0.0 cloudbees-bitbucket-branch-source:800.va_b_b_9a_a_5035c1 cloudbees-folder:6.815.v0dd5a_cb_40e0e command-launcher:100.v2f6722292ee8 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ conditional-buildstep:1.4.2 config-file-provider:938.ve2b_8a_591c596 copyartifact:698.v393f578eb_ddc credentials:1254.vb_96f366e7b_a_d credentials-binding:604.vb_64480b_c56ca_ data-tables-api:1.13.3-3 display-url-api:2.3.7 dtkit-api:3.0.2 durable-task:507.v050055d0cb_dd echarts-api:5.4.0-3 envinject:2.901.v0038b_6471582 envinject-api:1.199.v3ce31253ed13 external-monitor-job:203.v683c09d993b_9 favorite:2.4.1 font-awesome-api:6.3.0-2 generic-webhook-trigger:1.86.3 ghprb:1.42.2 git:5.0.2 git-client:4.2.0 git-server:99.va_0826a_b_cdfa_d github:1.37.0 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1703.vd5a_2b_29c6cdc github-pullrequest:0.5.0 golang:1.4 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.31 instance-identity:142.v04572ca_5b_265 ionicons-api:45.vf54fca_5d2154 jackson2-api:2.15.0-334.v317a_165f9b_7c jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:233.vdc1a_ec702cff javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:66.vd8fa_64ee91b_d jenkins-design-language:1.27.4 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.16-2 jobConfigHistory:1207.vd28a_54732f92 jquery3-api:3.6.4-1 jsch:0.2.8-65.v052c39de79b_2 junit:1202.v79a_986785076 ldap:676.vfa_64cf6b_b_002 lockable-resources:1156.v5e9f897ece02 mailer:448.v5b_97805e3767 matrix-auth:3.1.7 matrix-project:789.v57a_725b_63c79 maven-plugin:3.22 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ msbuild:1.30 nant:248.vcc8a_3eec8db_a nodejs:1.6.0 nunit:380.va_067eddf00da_ okhttp-api:4.10.0-132.v7a_7b_91cef39c pam-auth:1.10 parameterized-trigger:2.45 pipeline-build-step:491.v1fec530da_858 pipeline-github:2.8-147.3206e8179b1c pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2131.vb_9788088fdb_5 pipeline-model-definition:2.2131.vb_9788088fdb_5 pipeline-model-extensions:2.2131.vb_9788088fdb_5 pipeline-rest-api:2.32 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2131.vb_9788088fdb_5 pipeline-stage-view:2.32 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.2.1 popper-api:1.16.1-3 popper2-api:2.11.6-2 powershell:2.0 promoted-builds:892.vd6219fc0a_efb pubsub-light:1.17 rake:1.8.0 rebuild:320.v5a_0933a_e7d61 resource-disposer:0.22 run-condition:1.5 scm-api:667.v8b_6e07cdc7f2 script-security:1244.ve463715a_f89c slack:664.vc9a_90f8b_c24a_ snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 sse-gateway:1.26 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec sshd:3.275.v9e17c10f2571 structs:324.va_f5d6774f3a_d thinBackup:1.17 timestamper:1.25 token-macro:359.vb_cde11682e0c trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb windows-azure-storage:386.v673495b0a5de workflow-aggregator:596.v8c21c963d92d workflow-api:1213.v646def1087f9 workflow-basic-steps:1017.vb_45b_302f0cea_ workflow-cps:3659.v582dc37621d8 workflow-durable-task-step:1246.v5524618ea_097 workflow-job:1295.v395eb_7400005 workflow-multibranch:746.v05814d19c001 workflow-scm-step:408.v7d5b_135a_b_d49 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:839.v35e2736cfd5c ws-cleanup:0.45 xunit:3.1.2 ```

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

Windows Server 2019 - 10.0

Reproduction steps

  1. Install the Azure Key Vault plugin Version154.v5b_0f56b_a_4078
  2. Create a Jenkins job that uses the Azure Key Vault Plugin.
  3. The job loads correctly and is shown in the Jenkins UI.
  4. Upgrade the plugin to a version above 154.v5b_0f56b_a_4078 (for example, 193.vdc33a_680fef6).

Expected Results

The job should load correctly and be shown in the Jenkins UI.

Actual Results

The job fails to load and does not appear on the Jenkins site. The following error appears in the Jenkins log.

Failed Loading item <Job_Name>
java.lang.ClassCastException: class org.jenkinsci.plugins.azurekeyvaultplugin.AzureKeyVaultBuildWrapper cannot be cast to class hudson.tasks.BuildWrapper (org.jenkinsci.plugins.azurekeyvaultplugin.AzureKeyVaultBuildWrapper is in unnamed module of loader jenkins.util.URLClassLoader2 @2a288bbf; hudson.tasks.BuildWrapper is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @60bd273d)
    at hudson.model.Project.createTransientActions(Project.java:255)
    at hudson.model.AbstractProject.updateTransientActions(AbstractProject.java:731)
    at hudson.model.AbstractProject.onLoad(AbstractProject.java:322)
    at hudson.model.Project.onLoad(Project.java:96)
    at hudson.model.Items.load(Items.java:376)
    at jenkins.model.Jenkins$13.run(Jenkins.java:3445)
    at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
    at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
    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:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Anything else?

Other versions earlier than 193.vdc33a_680fef6, but later than 154.v5b_0f56b_a_4078 are also resulting in the same error.

timja commented 1 year ago

Duplicate of #183

starafdar1 commented 1 year ago

The comment in issue https://github.com/jenkinsci/azure-keyvault-plugin/issues/189#issuecomment-1552637624 suggests using the correct script syntax. Our jog was created using the Jenkins UI and not through a pipeline script. This appears to be a different issue.

timja commented 1 year ago

How had you configured it? As far as I can tell freestyle project support was removed 4 years ago.

starafdar1 commented 1 year ago

We have configured it through Manage Jenkins -> Configure System -> Azure Key Vault Plugin. We followed the steps mentioned under System Configuration -> Via UI at https://github.com/jenkinsci/azure-keyvault-plugin

timja commented 1 year ago

But how is it configured in the Job?

starafdar1 commented 1 year ago

The job is configured through: Configure Job -> Azure Key Vault Build wrapper -> Add a Key Vault Secret

image

timja commented 1 year ago

Interesting I did not know this worked =/.

timja commented 10 months ago

Given the low number of requests, I'm going to close this out.