jenkinsci / google-chat-notification-plugin

Google Chat Notification Jenkins Plugin to send build status
https://plugins.jenkins.io/google-chat-notification/
MIT License
39 stars 20 forks source link

Couldn't send message to Google space when the jenkins build has no result #69

Closed keirazhang closed 8 months ago

keirazhang commented 8 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.387.3 OS: Linux - 6.1.0-16-amd64 Java: 11.0.21 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- Parameterized-Remote-Trigger:3.1.3 ace-editor:1.1 ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 authentication-tokens:1.53.v1c90fd9191a_b_ bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1128.v717130d4f816 build-timeout:1.31 build-user-vars-plugin:1.8 build-with-parameters:76.v9382db_f78962 butler-cloud-plugin:2.9.5 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-folder:6.858.v898218f3609d command-launcher:107.v773860566e2e commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-94.v3e1f4a_926e49 conditional-buildstep:1.4.3 copyartifact:722.v0662a_9b_e22a_c credentials:1311.vcf0a_900b_37c2 credentials-binding:642.v737c34dea_6c2 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 durable-task:523.va_a_22cf15d5e0 echarts-api:5.4.0-7 email-ext:2.104 external-monitor-job:215.v2e88e894db_f8 font-awesome-api:6.5.1-1 git:5.2.1 git-client:4.6.0 git-server:99.va_0826a_b_cdfa_d github-api:1.318-461.v7a_c09c9fa_d63 global-variable-string-parameter:1.2 google-chat-notification:1.7.1 gradle:2.9 groovy:457.v99900cb_85593 handlebars:3.0.8 htmlpublisher:1.32 http_request:1.15 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.3-363.v82c51b_de9f60 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jdk-tool:73.vddf737284550 job-dsl:1.87 jquery3-api:3.7.1-1 jsch:0.2.16-86.v42e010d9484b_ junit:1252.vfc2e5efa_294f kubernetes:4007.v633279962016 kubernetes-client-api:6.4.1-215.v2ed17097a_8e9 kubernetes-credentials:0.10.0 ldap:711.vb_d1a_491714dc mailer:463.vedf8358e006b_ mask-passwords:173.v6a_077a_291eb_5 matrix-auth:3.1.5 matrix-project:818.v7eb_e657db_924 maven-plugin:3.23 metrics:4.2.18-442.v02e107157925 mina-sshd-api-common:2.11.0-86.v836f585d47fa_ mina-sshd-api-core:2.11.0-86.v836f585d47fa_ momentjs:1.1.1 nested-view:1.33 node-iterator-api:55.v3b_77d4032326 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 pam-auth:1.10 parameter-separator:87.va_1816d0b_39d1 parameterized-trigger:787.v665fcf2a_830b_ pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:689.veec561a_dee13 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2150.v4cfd8916915c pipeline-model-definition:2.2150.v4cfd8916915c pipeline-model-extensions:2.2150.v4cfd8916915c pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2150.v4cfd8916915c pipeline-stage-view:2.34 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.8.0 popper2-api:2.11.6-4 rebuild:330.v645b_7df10e2a_ resource-disposer:0.23 run-condition:1.7 saml:2.298.vc7a_2b_3958628 scm-api:676.v886669a_199a_a_ script-security:1305.v487433146192 show-build-parameters:1.0 simple-parameterized-builds-report:1.5 snakeyaml-api:2.2-111.vc6598e30cc65 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.947.v64ee6b_f87b_c1 ssh-steps:2.0.68.va_d21a_12a_6476 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 summary_report:1.15 timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 uno-choice:2.8.1 update-sites-manager:2.0.0 variant:60.v7290fc0eb_b_cd workflow-aggregator:596.v8c21c963d92d workflow-api:1283.v99c10937efcb_ workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3832.vc43e04d6d68c workflow-cps-global-lib:609.vd95673f149b_b workflow-durable-task-step:1313.vcb_970b_d2a_fb_3 workflow-job:1326.ve643e00e9220 workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 ```

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

Controller OS is Debian 12.1 64bit. Agent OS is CentOS 7

Reproduction steps

  1. With Google Chat Notification Plugin 1.8 or later, sending a message before jenkins job finish, it displays the notification condition is false. The message can only be sent after jenkins job's result is not null.
    [Pipeline] googlechatnotification
    [Google Chat Notification] Send Google Chat Notification condition is: false
  2. After downgrading the plugin to 1.7.1, the message can be sent successfully even though the job's result is null.

The plugin is used as below both with v1.7.1 and v1.8.

googlechatnotification(url:"$GOOGLE_CHAT_WEBHOOK", message: "[<$BUILD_URL|$JOB_NAME #$BUILD_ID>] $message")

Expected Results

The message can be sent no matter the job has result or not

Actual Results

The message can be sent only when the job has result.

Anything else?

No response

Are you interested in contributing a fix?

No response

keirazhang commented 8 months ago

Thank you, @Ryudo302, for fixing this issue.