jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 618 forks source link

Agent are busy, although a job has failed with "No credentials found" error #1495

Closed ergSey closed 1 year ago

ergSey commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.387.3 OS: Linux - 4.18.0-193.28.1.el8_2.x86_64 Java: 11.0.19 - Eclipse Adoptium (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 bootstrap5-api:5.2.2-6 bouncycastle-api:2.28 branch-api:2.1105.v472604208c55 build-timeout:1.31 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:2.0.0 cloudbees-folder:6.815.v0dd5a_cb_40e0e commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ credentials:1254.vb_96f366e7b_a_d credentials-binding:604.vb_64480b_c56ca_ display-url-api:2.3.7 durable-task:507.v050055d0cb_dd echarts-api:5.4.0-4 email-ext:2.97 font-awesome-api:6.3.0-2 git:5.0.2 git-client:4.3.0 github:1.37.1 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1703.vd5a_2b_29c6cdc gitlab-plugin:1.7.14 gradle:2.7 instance-identity:142.v04572ca_5b_265 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.1-344.v6eb_55303dc3e jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jersey2-api:2.39.1-1 jjwt-api:0.11.5-77.v646c772fddb_0 jquery3-api:3.7.0-1 junit:1207.va_09d5100410f ldap:682.v7b_544c9d1512 mailer:457.v3f72cb_e015e5 matrix-auth:3.1.8 matrix-project:789.v57a_725b_63c79 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ okhttp-api:4.10.0-132.v7a_7b_91cef39c pam-auth:1.10 pipeline-build-step:491.v1fec530da_858 pipeline-github-lib:42.v0739460cda_c4 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.2133.ve46a_6113dfc3 pipeline-model-definition:2.2133.ve46a_6113dfc3 pipeline-model-extensions:2.2133.ve46a_6113dfc3 pipeline-rest-api:2.32 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2133.ve46a_6113dfc3 pipeline-stage-view:2.32 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.2.1 resource-disposer:0.22 scm-api:672.v64378a_b_20c60 script-security:1244.ve463715a_f89c snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec sshd:3.303.vefc7119b_ec23 structs:324.va_f5d6774f3a_d timestamper:1.25 token-macro:359.vb_cde11682e0c trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb workflow-aggregator:596.v8c21c963d92d workflow-api:1213.v646def1087f9 workflow-basic-steps:1017.vb_45b_302f0cea_ workflow-cps:3673.v5b_dd74276262 workflow-durable-task-step:1247.v7f9dfea_b_4fd0 workflow-job:1301.v054d9cea_9593 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 ```

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

I run Jenkins from official docker image docker run -p 8080:8080 -p 50000:50000 --volume jenkins-data:/var/jenkins_home jenkins/jenkins:lts-jdk11 that's debian 11.6

Reproduction steps

  1. Run Jenkins: docker run -p 8080:8080 -p 50000:50000 --volume jenkins-data:/var/jenkins_home jenkins/jenkins:lts-jdk11
  2. Complete the initial configuration and install the default plugins.
  3. Install gitlab-plugin
  4. Set up the initial Gitlab settings in the Jenkins Global configuration (Dashboard --> Manage Jenkins --> Configure System --> Gitlab) without credentials specifying: image
  5. Create pipeline using gitlab plugin and specify jobCredentialId that does not exist or is not available.: image
  6. When starting the job, we expectedly get an error "No credentials found for credentialsId: any-non-existent-id" error image
  7. Although the job ended with an "failed" status, some build pipeline steps are still in the "running" state. image
  8. As a result, we get continuously busy agent, which will be released only after Jenkins restart image

Expected Results

Build has finished with "failed" and "No credentials found for credentialsId: any-non-existent-id" error, pipeline steps of this job is also stopped and agent isn't busy.

Actual Results

Although the job ended with an "failed" status, some build pipeline steps are still in the "running" state. Agent is permanently busy

Anything else?

I can't found method how to kill job to release an agent except Jenkins restart