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

Not sending after update to version 1.8+ #74

Closed siccous closed 8 months ago

siccous commented 8 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.426.3 OS: Linux - 6.1.0-11-amd64 Java: 17.0.9 - Debian (OpenJDK 64-Bit Server VM) --- ace-editor:1.1 analysis-model-api:11.15.0 ansicolor:1.0.4 ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.3.1-1.0 artifact-manager-s3:845.vb_0805c11eb_26 authentication-tokens:1.53.v1c90fd9191a_b_ aws-credentials:218.v1b_e9466ec5da_ aws-global-configuration:130.v35b_7b_96f53c3 aws-java-sdk:1.12.633-430.vf9a_e567a_244f aws-java-sdk-cloudformation:1.12.633-430.vf9a_e567a_244f aws-java-sdk-codebuild:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ec2:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ecr:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ecs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-efs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-elasticbeanstalk:1.12.633-430.vf9a_e567a_244f aws-java-sdk-iam:1.12.633-430.vf9a_e567a_244f aws-java-sdk-kinesis:1.12.633-430.vf9a_e567a_244f aws-java-sdk-logs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-minimal:1.12.633-430.vf9a_e567a_244f aws-java-sdk-secretsmanager:1.12.633-430.vf9a_e567a_244f aws-java-sdk-sns:1.12.633-430.vf9a_e567a_244f aws-java-sdk-sqs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ssm:1.12.633-430.vf9a_e567a_244f basic-branch-build-strategies:81.v05e333931c7d bootstrap4-api:4.6.0-6 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1144.v1425d1c3d5a_7 build-monitor-plugin:1.14-826.vb_a_c11536174d build-timeout:1.32 caffeine-api:3.1.8-133.v17b_1ff2e0599 change-assembly-version-plugin:1.10 checks-api:2.0.2 cloudbees-folder:6.858.v898218f3609d command-launcher:107.v773860566e2e commons-httpclient3-api:3.1-3 commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-95.v22a_d30ee5d36 compact-columns:1.185.vf3851b_4d31fe configurationslicing:548.ve92d48e66b_f8 copyartifact:722.v0662a_9b_e22a_c credentials:1319.v7eb_51b_3a_c97b_ credentials-binding:657.v2b_19db_7d6e6d custom-tools-plugin:0.8 customizable-header:69.v36de0f11b_d00 dark-theme:416.v535839b_c4e88 dashboard-view:2.495.v07e81500c3f2 data-tables-api:1.13.8-2 declarative-pipeline-migration-assistant:1.6.2 declarative-pipeline-migration-assistant-api:1.6.2 dependency-check-jenkins-plugin:5.4.3 dependency-track:4.3.1 display-url-api:2.200.vb_9327d658781 docker-build-step:2.11 docker-commons:439.va_3cb_0a_6a_fb_29 docker-java-api:3.3.4-86.v39b_a_5ede342c docker-workflow:572.v950f58993843 downstream-build-cache:1.7 durable-task:547.vd1ea_007d100c echarts-api:5.4.3-2 email-ext:2.104 embeddable-build-status:467.v4a_954796e45d envinject:2.908.v66a_774b_31d93 envinject-api:1.199.v3ce31253ed13 extended-choice-parameter:376.v2e02857547b_a_ extended-read-permission:53.v6499940139e5 external-monitor-job:215.v2e88e894db_f8 extra-columns:1.26 font-awesome-api:6.5.1-2 forensics-api:2.3.0 generic-webhook-trigger:2.0.0 ghprb:1.42.2 git:5.2.1 git-changelog:3.37 git-client:4.6.0 git-forensics:2.0.0 git-server:114.v068a_c7cc2574 gitea:1.4.7 gitea-additional-traits:1.0-BTL gitea-checks:449.v0672c320ee47-BTL gitea-scm-filter-aged-refs:0.2.0-BTL gitea-scm-trait-commit-skip:0.5.0-SNAPSHOT (private-03/15/2023 20:43-Sicco) github:1.37.3.1 github-additional-traits:1.0-BTL github-api:1.318-461.v7a_c09c9fa_d63 github-branch-source:1772.va_69eda_d018d4 github-checks:554.vb_ee03a_000f65-BTL github-scm-filter-aged-refs:0.2.0-BTL github-scm-trait-commit-skip:0.5.0-SNAPSHOT (private-03/15/2023 20:40-Sicco) gitlab-additional-traits:1.0-BTL gitlab-api:5.3.0-91.v1f9a_fda_d654f gitlab-branch-source:694.v1b_045877a_b_92 gitlab-plugin:1.8.0 gitlab-scm-filter-aged-refs:0.2.0-BTL gitlab-scm-trait-commit-skip:0.5.0-SNAPSHOT (private-03/15/2023 20:42-Sicco) golang:1.4 google-chat-notification:1.7.1 google-hangouts-chat-notifier:1.0 gradle:2.9 gson-api:2.10.1-15.v0d99f670e0a_7 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 hashicorp-vault-pipeline:1.4-BTL hashicorp-vault-plugin:364.vf5d54b_3dc313 http_request:1.18 ignore-committer-strategy:1.0.4 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.16.1-373.ve709c6871598 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 jersey2-api:2.41-133.va_03323b_a_1396 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.18-1 job-import-plugin:3.6 jobcacher:420.v16ee76f29824 joda-time-api:2.12.6-21.vca_fd74418fb_7 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.7.1-1 jsch:0.2.16-86.v42e010d9484b_ json-path-api:2.9.0-33.v2527142f2e1d junit:1259.v65ffcef24a_88 ldap:711.vb_d1a_491714dc leastload:3.0.0 locale:431.v3435fa_8f8445 lockable-resources:1232.v512d6c434eb_d log-file-filter:116.v881e1b_75ed59 mailer:463.vedf8358e006b_ mapdb-api:1.0.9-28.vf251ce40855d mask-passwords:173.v6a_077a_291eb_5 matrix-auth:3.2.1 matrix-project:822.824.v14451b_c0fd42 maven-plugin:3.23 metrics:4.2.21-449.v6960d7c54c69 mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ minio:1.3.3-SNAPSHOT (private-0b4f34cf-hruskat) momentjs:1.1.1 msbuild:1.30 multibranch-build-strategy-extension:48.v3dc306525d0c nomad:0.7.6-BTL nuget:1.2-BTL nunit:485.ve8a_85357320d oic-auth:2.6 okhttp-api:4.11.0-172.vda_da_1feeb_c6e pam-auth:1.10 parameter-separator:166.vd0120849b_386 pipeline-aws:1.43 pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:704.vc58b_8890a_384 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2175.v76a_fff0a_2618 pipeline-model-definition:2.2175.v76a_fff0a_2618 pipeline-model-extensions:2.2175.v76a_fff0a_2618 pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2175.v76a_fff0a_2618 pipeline-stage-view:2.34 pipeline-utility-steps:2.16.1 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.8.0 popper-api:1.16.1-3 popper2-api:2.11.6-4 powershell:2.1 prism-api:1.29.0-10 purge-build-queue-plugin:88.v23b_97b_f2c7a_d resource-disposer:0.23 scm-api:683.vb_16722fb_b_80b_ scmskip:45.vfdec6fb_05267 script-security:1313.v7a_6067dc7087 simple-theme-plugin:176.v39740c03a_a_f5 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.17.1 ssh-agent:346.vda_a_c4f2c8e50 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.948.vb_8050d697fec ssh-steps:2.0.68.va_d21a_12a_6476 sshd:3.322.v159e91f6a_550 structs:337.v1b_04ea_4df7c8 subversion:2.17.3 theme-manager:215.vc1ff18d67920 thinBackup:1.18 timestamper:1.26 token-macro:400.v35420b_922dcb_ trilead-api:2.133.vfb_8a_7b_9c5dd1 uno-choice:2.8.1 variant:60.v7290fc0eb_b_cd view-job-filters:369.ve0513a_a_f5524 warnings-ng:10.7.0 windows-slaves:1.8.1 workflow-aggregator:596.v8c21c963d92d workflow-api:1291.v51fd2a_625da_7 workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3853.vb_a_490d892963 workflow-cps-global-lib:612.v55f2f80781ef workflow-durable-task-step:1322.v63864b_7a_e384 workflow-job:1385.vb_58b_86ea_fff1 workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:415.v434365564324 workflow-step-api:657.v03b_e8115821b_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 yet-another-build-visualizer:1.16 ```

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

Debian 12

Reproduction steps

It does not work in combination with warnings-ng plugin (at least in my case).

not working: recordIssues failedTotalAll: 1, enabledForFailure: true, tool: hadoLint(pattern: "hadolint.json") googlechatnotification url: 'xxx', message: '${PROJECT_NAME} : Build #${BUILD_NUMBER} - ${BUILD_STATUS} - Issues: ${ANALYSIS_ISSUES_COUNT}\n\nCheck output at ${BUILD_URL}', notifyAborted: 'true', notifyFailure: 'true', notifyNotBuilt: 'true', notifySuccess: 'true', notifyUnstable: 'true', notifyBackToNormal: 'true', suppressInfoLoggers: 'true', sameThreadNotification: 'true'

working (only observation, does not make sense to use it like that): googlechatnotification url: 'xxx', message: '${PROJECT_NAME} : Build #${BUILD_NUMBER} - ${BUILD_STATUS} - Issues: ${ANALYSIS_ISSUES_COUNT}\n\nCheck output at ${BUILD_URL}', notifyAborted: 'true', notifyFailure: 'true', notifyNotBuilt: 'true', notifySuccess: 'true', notifyUnstable: 'true', notifyBackToNormal: 'true', suppressInfoLoggers: 'true', sameThreadNotification: 'true' recordIssues failedTotalAll: 1, enabledForFailure: true, tool: hadoLint(pattern: "hadolint.json")

Expected Results

Properly send notification even if used after recordIssues step from warnings-ng plugin.

Actual Results

Does not send any notification if used after recordIssues step.

Anything else?

Simply if I change the order then it works, also downgrading to 1.7.1 helps and I can use the non working version again.

Are you interested in contributing a fix?

No response

Ryudo302 commented 8 months ago

Hi @siccous!

I was unable to reproduce it in a fresh installation of Jenkins 2.375.4 (the current minimal version suppported by Google Chat Plugin) with google-chat-notification:1.8.3 and warnings-ng:9.23.1.

I will try to install the same Jenkins version as yours (2.426.3) and test it again.

In the meantime, would you please send the log of a build that has the problem you observed?

Ryudo302 commented 8 months ago

Testing with Jenkins 2.426.3 + google-chat-notification 1.8.3 + warnings-ng 10.7.0, could not reproduce it. 😞

[Pipeline] { (Declarative: Post Actions)
[Pipeline] recordIssues
[HadoLint] [-ERROR-] Errors during parsing
[HadoLint] [-ERROR-] No files found for pattern 'hadolint.json'. Configuration error?
[HadoLint] Searching for all files in '/home/xxx/.jenkins/workspace/google-chat-notification-simple-pipeline' that match the pattern 'hadolint.json'
[HadoLint] Traversing of symbolic links: enabled
[HadoLint] Skipping post processing
[HadoLint] No filter has been set, publishing all 0 issues
[HadoLint] Repository miner is not configured, skipping repository mining
[HadoLint] Searching for all files in '/home/xxx/.jenkins/workspace/google-chat-notification-simple-pipeline' that match the pattern 'hadolint.json'
[HadoLint] Traversing of symbolic links: enabled
[HadoLint] Skipping post processing
[HadoLint] No filter has been set, publishing all 0 issues
[HadoLint] Searching for all files in '/home/xxx/.jenkins/workspace/google-chat-notification-simple-pipeline' that match the pattern 'hadolint.json'
[HadoLint] Traversing of symbolic links: enabled
[HadoLint] Skipping post processing
[HadoLint] No filter has been set, publishing all 0 issues
[HadoLint] Repository miner is not configured, skipping repository mining
[HadoLint] Reference build recorder is not configured
[HadoLint] Obtaining reference build from same job (google-chat-notification-simple-pipeline)
[HadoLint] No valid reference build found that meets the criteria (NO_JOB_FAILURE - SUCCESSFUL_QUALITY_GATE)
[HadoLint] All reported issues will be considered outstanding
[HadoLint] Evaluating quality gates
[HadoLint] -> PASSED - Total (any severity): 0 - Quality Gate: 1
[HadoLint] -> All quality gates have been passed
[HadoLint] Health report is disabled - skipping
[HadoLint] Created analysis result for 0 issues (found 0 new issues, fixed 0 issues)
[HadoLint] Attaching ResultAction with ID 'hadolint' to build 'google-chat-notification-simple-pipeline #12'.
[Checks API] No suitable checks publisher found.
[Pipeline] googlechatnotification
[Google Chat Notification] Send Google Chat Notification condition is: true
[Google Chat Notification] Will send message to the thread: null. If it doesnt exist yet or is null, it will be created.
[Google Chat Notification] Final formatted text:
{"text":"google-chat-notification-simple-pipeline : Build #12 - Successful - Issues: 0\n\nCheck output at nulljob/google-chat-notification-simple-pipeline/12/"}
[Google Chat Notification] xxx
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
siccous commented 8 months ago

Hi @Ryudo302,

I've tried to create minimal reproduction pipeline:

pipeline {
    agent { label 'xxx-linux-agent' }
    stages {
        stage('Test') {
            steps {
                sh '''
                    echo '[{"code":"DL3059","column":1,"file":"Dockerfile","level":"info","line":47,"message":"Multiple consecutive `RUN` instructions. Consider consolidation."}]' > hadolint.json
                '''
            }
        }
    }
    post {
        always {
            recordIssues failedTotalAll: 1, enabledForFailure: true, tool: hadoLint(pattern: "hadolint.json")
            googlechatnotification url: 'xxx-url', message: '${PROJECT_NAME} : Build #${BUILD_NUMBER} - ${BUILD_STATUS} - Issues: ${ANALYSIS_ISSUES_COUNT}\n\nCheck output at ${BUILD_URL}', notifyAborted: 'true', notifyFailure: 'true', notifyNotBuilt: 'true', notifySuccess: 'true', notifyUnstable: 'true', notifyBackToNormal: 'true', suppressInfoLoggers: 'false', sameThreadNotification: 'true'
        }
    }
}

1.8.3 version: [Google Chat Notification] Send Google Chat Notification condition is: false 1.7.1 version: Send Google Chat Notification condition is : true

Ryudo302 commented 8 months ago

@siccous, now I was able to reproduce it, find the cause and fix it. Thanks for the help! 😄

The fix will be part of the next release.