Giter Site home page Giter Site logo

zulip-plugin's Introduction

Zulip notifier plugin for Jenkins

This plugin sends messages and notifications of build statuses to Zulip.

It began its life as a fork of the Jenkins Campfire plugin.

Table of contents

  1. Global Configuration
  2. Zulip Notification
  3. Zulip Send
  4. Job DSL
  5. Troubleshooting

Global configuration

The Zulip server is configured globally for the whole Jenkins instance.

Minimal configuration is:

  • Zulip Url = The Url of your Zulip installation visible from Jenkins instance.
  • Zulip User Email = E-mail of Zulip bot that will be used to send messages to streams.
  • Zulip API key = The API key of bot that will be used to send messages to streams.

Other attributes are optional:

  • Default Stream Name = The stream messages will be sent to by default. You can override this setting per project, but be sure not to leave it blank in both places or your messages will fail to send. You can use build variables in default stream name.

  • Default Topic Name = The topic messages will be sent to by default. You can override this setting per project. If you leave it blank at both places, Jenkins job name will be used as a topic instead. You can use build variables in default topic name.

  • Enable Smart Notification = If enabled, successful build notification will be sent out only if one of following criteria is met:

    • There was no previous build
    • The current build failed
    • The current build is unstable (failed tests)
    • Previous build failed

    In another words, the notifications will not be sent for continuously successful builds.

  • Use full job path in default topic name = Determines how the topic name is constructed when Default topic name is blank:

    • When disabled, only the build run direct parent name is used.
    • When enabled, all parent names (e.g. folders) are used.

    It is recommended to have this option on, especially if you use projects with multiple layers (e.g. multi-branch pipeline).

  • Use full job path in notification message = Determines how the build notification message is constructed.

    • When disabled, only the build run direct parent name is used.
    • When enabled, all parent names (e.g. folders) are used.

    It is recommended to have this option on, especially if you use projects with multiple layers (e.g. multi-branch pipeline).

  • Jenkins URL = ⚠️ This parameter is kept just for the sake of backward compatibility.⚠️ Instead of setting this, configure Jenkins URL in "Manage Jenkins" > "Configure System" > "Jenkins Location" > "Jenkins URL"

Global Settings

Zulip Notification

Zulip notification is a post build action step, that posts notification about build statuses to Zulip Streams. The step allows you to configure two optional parameters:

  • Stream = The stream messages will be sent to for this job. Will override default stream from global settings. Be sure not to leave it blank in both places. You can use build variables in stream name.
  • Topic = The topic messages will be sent to for this job. Will override default topic from global settings. If blank in both places, job name will be used as topic. You can use build variables in topic name.
  • Smart Notification = Allows you override global smart notification setting and enable / disabled smart notification for this job. The job uses global smart notification setting by default.

Freestyle project

For freestyle project, simply select a post build action from the dropdown and optionally configure destination stream and topic.

Zulip Notification

Scripted Pipeline

Scripted pipeline have no concept of post build actions, but you can still use the zulipNotification step in the try/catch or preferably using the catchError step.

node {
    catchError {
        // ... Your build stages ...
    }
    zulipNotification stream: 'coolproject', topic: 'jenkins', smartNotification: 'enabled'
}

Declarative Pipeline

In declarative pipeline, simply use the zulipNotification step inside your post actions.

pipeline {
    agent any
    stages {
        // ... Your build stages ...
    }
    post {
        always {
            zulipNotification()
        }
    }
}

Zulip Send

Zulip send is a build step, that allows you to post arbitrary messages to Zulip stream throughout the build process. You can use this e.g. to notify Zulip that build has started or about various phases the build goes through. The step allows you to configure:

  • Stream = Optional stream the message will be sent to for this job. Will override default stream from global settings. Be sure not to leave it blank in both places. You can use build variables in the stream name.
  • Topic = Optional topic the message will be sent to for this job. Will override default topic from global settings. If blank in both places, job name will be used as topic. You can use build variables in the topic name.
  • Message = The message that will sent out. You can use build variables inside the message.

Freestyle project

For freestyle project, simply select a build action from the dropdown and fill in desired message. Optionally configure destination stream and topic.

Zulip Send

Scripted Pipeline

In scripted pipeline, simply use the zulipSend step in any stage of the build.

node {
    stage('Prepare') {
        zulipSend message: 'Started build #${BUILD_NUMBER} of project ${JOB_NAME}...'
        // ... Perhaps SCM checkout here ...
    }
    // ... Other build stages ...
}

Declarative Pipeline

In declarative pipeline, simply use the zulipSend step in any stage of the build.

pipeline {
    agent any
    stages {
        stage('Prepare') {
            steps {
                zulipSend message: 'Started build #${BUILD_NUMBER} of project ${JOB_NAME}...'
                // ... Perhaps SCM checkout here ...
            }
        }
        // ... Other build stages ...
    }
}

Job DSL

There is no explicit support for the Job DSL Plugin, but Zulip Send step and Zulip Notification can be configured via dynamically generated DSLs.

Example DSL creating a freestyle job using both Zulip Send and Zulip Notification:


job('DSL-Freestyle') {
  steps {
    zulipSend {
      message('Hello via job DSL!')
      stream('dslproject')
      topic('jenkins')
    }
  }
  publishers {
    zulipNotification {
      stream('dslproject')
      topic('jenkins')
    }
  }
}

Troubleshooting

No such DSL method

If you're using 1.x version of Jenkins and 1.x version of workflow job plugin (previous name for the pipeline jobs) you will encounter exceptions like java.lang.NoSuchMethodError: No such DSL method zulipSend found among [...].

In that case, you will have to use the meta-step instead. Simply replace:

zulipSend message: 'Test'

with

step([$class: 'ZulipSendStep', message: 'Test'])

and

zulipNotification()

with

step([$class: 'ZulipNotifier'])

zulip-plugin's People

Contributors

bgreenlee avatar brianhempel avatar butchyyyy avatar daniel-beck-bot avatar dbriones avatar dependabot[bot] avatar henrypoydar avatar jesstess avatar jkrall avatar jsl avatar kohsuke avatar m2ger avatar mdelapenya avatar milankonir avatar ndeloof avatar olamy avatar orrc avatar pvdb avatar stigkj avatar wdaher avatar yrodiere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zulip-plugin's Issues

Support per-job stream selection

Currently the plugin only supports notifying one global stream.

We use "jenkins," but this gets messy as everyone looks to the one central stream.

It'd be nicer if we could have different Jenkins jobs routing their updates to different Humbug streams, like with the GitHub hook.

Enable Smart Notification is always selected

Version 1.0.1
function "Enable Smart Notification" is always selected automatically and I don't get a notification if the build fails or if the build is okay.
I have entered a stream and a topic in the post-build configuration.
postbuild config

In the Zulip notification settings I have entered the zulip URL, Zulip User Email and the Zulip API Key.
zulip notification settings

Add ability to NOT fail the build if Zulip is down

My zulip server is on a non UPS protected machine, so every now and again the zulip instance goes down. I want to be able to "ignore" failure to post to zulip - i.e. write some warning in the console output of the log but not actually fail the build

Environment variables are not resolved

Hello,

currently, it seems that the plugin only allows using a fixed value for the stream/topic name (I'm using the "Zulip notification" post-build action, if that matters).

It would be really nice to be able to use environment variables (e.g. $BRANCH_NAME in order to dynamically change where the zulip notification is being posted to.

Thanks!

Project name is not very clear in notifications for multi-branch pipeline projects

When I use the ZulipNotifier in a multi-branch pipeline project, I get notifications that look like this:

Project: production : Build: #1: SUCCESS

Project: staging : Build: #3: SUCCESS

The "project name" in these examples is in fact the branch name. That's because, for multi-branch pipeline projects, one sub-project is created for each branch, and this sub-project has the same name as the branch.

This notification message is not very clear, since it doesn't allow to identify the failing Jenkins job.

Ideally we should make the message clearer?

Version report

Jenkins and plugins versions report:

Jenkins: 2.289.2
OS: Linux - 4.18.0-305.7.1.el8_4.x86_64
---
jaxb:2.3.0.1
pipeline-milestone-step:1.3.2
cloudbees-folder:6.15
branch-api:2.6.5
jdk-tool:1.5
script-security:1.77
docker-commons:1.17
structs:1.23
momentjs:1.1.1
workflow-step-api:2.24
scm-api:2.6.4
docker-workflow:1.26
workflow-api:2.46
junit:1.51
command-launcher:1.6
pipeline-stage-view:2.19
bouncycastle-api:2.20
gradle:1.37.1
antisamy-markup-formatter:2.1
token-macro:2.15
build-timeout:1.20
credentials:2.5
pipeline-build-step:2.13
plain-credentials:1.7
ssh-credentials:1.19
pipeline-model-api:1.8.5
credentials-binding:1.27
workflow-support:3.8
durable-task:1.38
workflow-durable-task-step:2.39
matrix-project:1.19
jsch:0.1.55.2
resource-disposer:0.16
github-api:1.123
ws-cleanup:0.39
ace-editor:1.1
jquery-detached:1.2.1
git-client:3.8.0
workflow-scm-step:2.13
git:4.7.2
workflow-cps:2.93
workflow-job:2.41
github:1.33.1
apache-httpcomponents-client-4-api:4.5.13-1.0
display-url-api:2.3.5
mailer:1.34
git-server:1.10
workflow-basic-steps:2.23
jackson2-api:2.12.3
workflow-cps-global-lib:2.21
pipeline-input-step:2.12
pipeline-stage-step:2.5
pipeline-graph-analysis:1.11
pipeline-rest-api:2.19
handlebars:3.0.8
pipeline-model-extensions:1.8.5
blueocean-git-pipeline:1.24.7
workflow-multibranch:2.26
blueocean-jwt:1.24.7
authentication-tokens:1.4
h2-api:1.4.199
pipeline-stage-tags-metadata:1.8.5
favorite:2.3.3
pipeline-model-definition:1.8.5
lockable-resources:2.11
workflow-aggregator:2.6
github-branch-source:2.11.1
pipeline-github-lib:1.0
matrix-auth:2.6.7
sse-gateway:1.24
email-ext:2.83
embeddable-build-status:2.0.3
blueocean-config:1.24.7
config-file-provider:3.8.1
throttle-concurrents:2.3
blueocean-events:1.24.7
github-oauth:0.33
windows-slaves:1.8
ant:1.11
ghprb:1.42.2
jquery:1.12.4-1
javadoc:1.6
pam-auth:1.6
ldap:2.7
external-monitor-job:1.7
pubsub-light:1.16
blueocean-pipeline-scm-api:1.24.7
htmlpublisher:1.25
node-iterator-api:1.5.0
variant:1.4
zulip:1.2.1
aws-java-sdk:1.11.995
blueocean-dashboard:1.24.7
aws-credentials:1.29
doclinks:0.6.1
ec2:1.62
blueocean-jira:1.24.7
authorize-project:1.4.0
ssh-agent:1.23
maven-plugin:3.12
envinject-api:1.7
audit-trail:3.8
jobConfigHistory:2.28.1
jira:3.5
simple-theme-plugin:0.7
PrioritySorter:4.0.0
blueocean-rest-impl:1.24.7
jenkins-design-language:1.24.7
blueocean-display-url:2.4.1
blueocean-core-js:1.24.7
blueocean-commons:1.24.7
blueocean-rest:1.24.7
blueocean-web:1.24.7
ssh-slaves:1.32.0
postbuildscript:3.0.0
conditional-buildstep:1.4.1
parameterized-trigger:2.41
database-mysql:1.4
run-condition:1.5
blueocean-autofavorite:1.2.4
database:1.9
trilead-api:1.0.13
pipeline-github:2.7
pipeline-utility-steps:2.8.0
notification:1.15
pipeline-maven:3.10.0
snakeyaml-api:1.29.1
greenballs:1.15.1
blueocean-pipeline-api-impl:1.24.7
blueocean-github-pipeline:1.24.7
blueocean-personalization:1.24.7
blueocean-i18n:1.24.7
envinject:2.4.0
mysql-api:8.0.16
openshift-client:1.0.35
plugin-util-api:2.4.0
jmh-report:0.9.0
toolenv:1.2
warnings-ng:9.4.0
caffeine-api:2.9.1-23.v51c4e2c879c8
bootstrap5-api:5.0.2-1
jquery3-api:3.6.0-2
analysis-model-api:10.2.5
font-awesome-api:5.15.3-4
popper2-api:2.5.4-3
data-tables-api:1.10.25-2
popper-api:1.16.1-2
sshd:3.0.4
jjwt-api:0.11.2-9.c8b45b8bb173
echarts-api:5.1.2-3
checks-api:1.7.2
okhttp-api:3.14.9
forensics-api:1.2.1
bootstrap4-api:4.6.0-3
  • What Operating System are you using (both controller, and any agents involved in the problem)?
RHEL 8 on controller, Fedora 34 on agents.

Reproduction steps

  • Create a multi-branch pipeline project
  • Set up Zulip notifications in that project
  • Trigger a build and check out the notification

Results

Expected result:

The notification should include the project name and branch, e.g.:

Project: hibernate.org » production : Build: #1: SUCCESS

Actual result:

The notification does not include the project name, only the branch name, e.g.:

Project: production : Build: #1: SUCCESS

Plugin Version 1.0.1 does not sent any notifications to Zulip

Hello,
the plugin version 1.0.1 does not send any notifications to Zulip.
We are using a self-hosted installation and have configured a freestyle job in Jenkins. The exceptions for the proxy are also configured.
When starting the freestyle job the plugin does not react and there is no console output.
Stream, topic, Bot E-Mail, Bot API are 100% correct.

Any ideas?

Zulip Notification Settings
Zulip post Build

In a multi-configuration project with an agent axis, the default topic is the name of the agent, not the name of the project/job.

Jenkins and plugins versions report

Environment
Jenkins: 2.387.3
OS: Linux - 5.15.104-1-pve
Java: 11.0.18 - Ubuntu (OpenJDK 64-Bit Server VM)
---
ansicolor:1.0.2
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
bootstrap5-api:5.3.0-1
bouncycastle-api:2.28
build-timeout:1.31
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
categorized-view:1.12
checks-api:2.0.0
claim:516.v36293563731d
command-launcher:100.v2f6722292ee8
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
configuration-as-code:1647.ve39ca_b_829b_42
credentials:1254.vb_96f366e7b_a_d
display-url-api:2.3.7
echarts-api:5.4.0-5
excludeMatrixParent:1.1
font-awesome-api:6.4.0-1
instance-identity:142.v04572ca_5b_265
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
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
jdk-tool:66.vd8fa_64ee91b_d
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1207.va_09d5100410f
ldap:682.v7b_544c9d1512
mailer:457.v3f72cb_e015e5
matrix-auth:3.1.8
matrix-project:789.v57a_725b_63c79
mercurial:1260.vdfb_723cdcc81
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
nodelabelparameter:1.12.0
plugin-util-api:3.3.0
role-strategy:633.v836e5b_3e80a_5
scm-api:672.v64378a_b_20c60
script-security:1251.vfe552ed55f8d
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
view-job-filters:364.v48a_33389553d
workflow-api:1213.v646def1087f9
workflow-job:1308.v58d48a_763b_31
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
zulip:2.0.0-SNAPSHOT (private-262aa562-epaul)

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

Ubuntu 22.04 for the controller. 4 agents on Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04 and RHEL8.

Reproduction steps

  1. create a multi-configuration project
  2. configure the zulip plugin
  3. Create a multi-configuration project with an agent axis
  4. build project

Expected Results

I expect a message with the topic containing the projet/job name.

Actual Results

I get the agent name in the message topic.

Anything else?

If I configure $JOB_NAME for the topic, I get job_name/Agent=agent_name, which is fine, but then I get a Project: agent_name link instead of Project: job_name. The link is correct but not the label.

Feature request: possibility to configure smart notifications per Jenkins job.

It would be nice to have the ability to configure the smart notification property per Jenkins Job.
There are two possibilities:

  • The system wide setting would be the default for new jobs.
  • the setting in systems would be gone and it needed to be enabled for every new job.
    The second possibility would be easier to implement but then it would be harder to enable for every project.
    What do you think of this? Maybe I will find some time in the future to look into a pull request for this.

Jenkins Pipepline syntax

How do I send a message to Zulip in a Jenkins Pipeline (Jenkinsfile) ? For example this is how I would do it with hipchat (https://github.com/jenkinsci/hipchat-plugin):

pipeline {
  agent any
  stages {
    stage('Notify Start') {
      steps {
        hipchatSend(color: 'GRAY', message: "<a href=\"${RUN_DISPLAY_URL}\">Web Job ${env.BUILD_NUMBER} on ${env.BRANCH_NAME} started</a>")
      }
    }
    stage('Automated Tests') {
      steps {
        sh '''# my tests
            '''
        junit 'tests/_output/run'
      }
      post {
        unstable {
          hipchatSend(color: 'RED', notify: true, message: "<a href=\"${RUN_DISPLAY_URL}\">Some tests in web job ${env.BUILD_NUMBER} on ${env.BRANCH_NAME} failed</a>")

        }
        success {
          hipchatSend(color: 'GREEN', notify: false, message: "<a href=\"${RUN_DISPLAY_URL}\">All tests in web job ${env.BUILD_NUMBER} on ${env.BRANCH_NAME} passed</a>")
        }
      }
    }
    stage('Build and Release') {
      when {
        tag 'release_*'
      }
      post {
        failure {
          hipchatSend(color: 'RED', notify: true, message: "<a href=\"${RUN_DISPLAY_URL}\">Build web job ${env.BUILD_NUMBER} on ${env.BRANCH_NAME} failed</a>")

        }

      }
      steps {
        sh "# build"
      } 
    }
    stage('Notify Deployment') {
      when {
        tag 'release_*'
      }
      steps {
        hipchatSend(color: 'GREEN', notify: false, message: "Web Job ${env.BRANCH_NAME} deployed")
      }
    }
  }
}

I also noticed that the Zulip plugin is not showing as an option in the blueocean pipeline editor so maybe this is not supported?

Zulip notifications in one job are blocked by the other job

If there are 2 jobs and one of them finishes earlier then Zulip notifications block until the other job finishes too. Exactly the same issue was fixed in the Slack plugin. Fix for Zulip plugin is exactly the same. getRequiredMonitorService should return BuildStepMonitor.NONE. I tested it on my Jenkins.

build of zulip-plugin fails because of deprecated method getTestResultAction

A build of zulip-plugin failed with error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project humbug: Compilation failure
[ERROR] /var/lib/jenkins/zulip-plugin/src/main/java/hudson/plugins/humbug/HumbugNotifier.java:[104,38] cannot find symbol
[ERROR] symbol: method getTestResultAction()
[ERROR] location: variable build of type hudson.model.Run

According to https://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html the method is deprecated:
@deprecated
public Action getTestResultAction()
Deprecated. Use Actionable.getAction(Class) on AbstractTestResultAction.

To fix this I've added the following to pom.xml:

org.jenkins-ci.plugins
junit
1.7

and changed src/main/java/hudson/plugins/humbug/HumbugNotifier.java by adding the import
import hudson.tasks.test.AbstractTestResultAction;
and changing
int failCount = build.getTestResultAction().getFailCount();
to
int failCount = build.getAction(AbstractTestResultAction.class).getFailCount();

Does not work with Jenkins 2.387.1

Jenkins and plugins versions report

Jenkins 2.387.1 Zulip Plugin 1.3.0

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

Linux - Ubuntu 20.04

Reproduction steps

When trying to send any message with the plugin we'll get the error

Error when executing failure post condition: java.lang.ClassNotFoundException: org.apache.commons.httpclient.Credentials at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) Caused: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Credentials at jenkins.plugins.zulip.ZulipSendStep.perform(ZulipSendStep.java:44) at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 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)

Expected Results

This should work, the message should be sent

Actual Results

The exception is thrown

Anything else?

Probably related to this issue: #36

No credentials provided - after upgrading to version 2

Jenkins and plugins versions report

Environment
Jenkins: 2.412
OS: Linux - 5.4.0-153-generic
Java: 17.0.7 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
ace-editor:1.1
ansicolor:1.0.2
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
authentication-tokens:1.53.v1c90fd9191a_b_
bootstrap4-api:4.6.0-6
bootstrap5-api:5.3.0-1
bouncycastle-api:2.28
branch-api:2.1122.v09cb_8ea_8a_724
build-timeout:1.31
build-user-vars-plugin:1.9
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
checks-api:2.0.0
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_
credentials:1254.vb_96f366e7b_a_d
credentials-binding:604.vb_64480b_c56ca_
dark-theme:336.v02165cd8c2ee
data-tables-api:1.13.4-3
display-url-api:2.3.7
docker-commons:422.v9d1a_89cede51
docker-workflow:563.vd5d2e5c4007f
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-5
email-ext:2.99
envinject:2.901.v0038b_6471582
envinject-api:1.199.v3ce31253ed13
external-monitor-job:206.v9a_94ff0b_4a_10
font-awesome-api:6.4.0-1
git:5.1.0
git-client:4.4.0
git-server:99.va_0826a_b_cdfa_d
github:1.37.1
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1728.v859147241f49
gitlab-plugin:1.7.14
global-slack-notifier:1.5
google-oauth-plugin:1.0.9
gradle:2.8.1
handlebars:3.0.8
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
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
jersey2-api:2.40-1
jjwt-api:0.11.5-77.v646c772fddb_0
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1214.va_2f9db_3e6de0
kubernetes:3952.v88e3b_0cf300b_
kubernetes-cli:1.12.0
kubernetes-client-api:6.4.1-215.v2ed17097a_8e9
kubernetes-credentials:0.10.0
kubernetes-pipeline-devops-steps:1.6
ldap:682.v7b_544c9d1512
lockable-resources:1172.v4b_8fc8eed570
mailer:457.v3f72cb_e015e5
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.1.8
matrix-project:789.v57a_725b_63c79
metrics:4.2.18-439.v86a_20b_a_8318b_
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
momentjs:1.1.1
oauth-credentials:0.645.ve666a_c332668
okhttp-api:4.11.0-145.vcb_8de402ef81
pam-auth:1.10
pipeline-build-step:496.v2449a_9a_221f2
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.2141.v5402e818a_779
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:2.2141.v5402e818a_779
pipeline-model-extensions:2.2141.v5402e818a_779
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2141.v5402e818a_779
pipeline-stage-view:2.33
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
popper-api:1.16.1-3
popper2-api:2.11.6-2
postbuild-task:1.9
resource-disposer:0.22
saml:4.418.vdfa_7489a_b_a_2d
scm-api:676.v886669a_199a_a_
script-security:1251.vfe552ed55f8d
simple-theme-plugin:160.vb_76454b_67900
slack:664.vc9a_90f8b_c24a_
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sonar:2.15
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.303.vefc7119b_ec23
structs:324.va_f5d6774f3a_d
subversion:2.17.2
theme-manager:193.vcef22f6c5f2b_
timestamper:1.25
token-macro:359.vb_cde11682e0c
tool-labels-plugin:3.0
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
windows-slaves:1.8.1
workflow-aggregator:596.v8c21c963d92d
workflow-api:1219.v05cd837ea_249
workflow-basic-steps:1017.vb_45b_302f0cea_
workflow-cps:3697.vb_470e454c232
workflow-cps-global-lib:609.vd95673f149b_b
workflow-durable-task-step:1247.v7f9dfea_b_4fd0
workflow-job:1316.vd2290d3341a_f
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.45
zulip:2.0.0

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

Docker image jenkins/jenkins:latest-jdk17. Here's the container base image info:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Reproduction steps

  1. having a Jenkins with the old / working Zulip plugin installed. Jenkins already has this issue #35. So, I postponed upgrading Jenkins, until the issue rectified.
  2. upgrading all plugins (Zulip Plugin is not upgraded in this phase, because it is no compatible to the older Jenkins version)
  3. upgrading Jenkins (docker pull jenkins/jenkins:latest-jdk17)
  4. starting the new version of Jenkins, with old plugins.
  5. upgrading all plugins (in this phase, Zulip Plugin is upgraded to version 2)

Expected Results

Jenkins send messages by using zulipSend message or zulipNotification commands.

Actual Results

The message isn't sent. No any exceptions are raised during pipeline execution. This is the console output of Jenkins:

2023-07-02 19:25:54.251+0000 [id=310]      SEVERE  jenkins.plugins.zulip.Zulip#post: Error sending Zulip message: 
java.io.IOException: No credentials provided
   at java.net.http/jdk.internal.net.http.AuthenticationFilter.response(AuthenticationFilter.java:312)
   at java.net.http/jdk.internal.net.http.MultiExchange.responseFilters(MultiExchange.java:248)
   at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$6(MultiExchange.java:413)
   at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
   at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
   at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614)
   at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:653)
   at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
   at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:157)
   at java.base/java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572)
   at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
   at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
   at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
   at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.handle(Http1Response.java:695)
   at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.handle(Http1Response.java:621)
   at java.net.http/jdk.internal.net.http.Http1Response$Receiver.accept(Http1Response.java:612)
   at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.tryAsyncReceive(Http1Response.java:668)
   at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:233)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
   at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:157)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:305)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:274)
   at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.asyncReceive(Http1AsyncReceiver.java:464)
   at java.net.http/jdk.internal.net.http.Http1AsyncReceiver$Http1TubeSubscriber.onNext(Http1AsyncReceiver.java:584)
   at java.net.http/jdk.internal.net.http.Http1AsyncReceiver$Http1TubeSubscriber.onNext(Http1AsyncReceiver.java:541)
   at java.net.http/jdk.internal.net.http.common.SSLTube$DelegateWrapper.onNext(SSLTube.java:210)
   at java.net.http/jdk.internal.net.http.common.SSLTube$SSLSubscriberWrapper.onNext(SSLTube.java:492)
   at java.net.http/jdk.internal.net.http.common.SSLTube$SSLSubscriberWrapper.onNext(SSLTube.java:295)
   at java.net.http/jdk.internal.net.http.common.SubscriberWrapper$DownstreamPusher.run1(SubscriberWrapper.java:316)
   at java.net.http/jdk.internal.net.http.common.SubscriberWrapper$DownstreamPusher.run(SubscriberWrapper.java:259)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:303)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:256)
   at java.net.http/jdk.internal.net.http.common.SubscriberWrapper.outgoing(SubscriberWrapper.java:232)
   at java.net.http/jdk.internal.net.http.common.SubscriberWrapper.outgoing(SubscriberWrapper.java:198)
   at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader.processData(SSLFlowDelegate.java:444)
   at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher.run(SSLFlowDelegate.java:268)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
   at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
Caused: java.io.IOException: No credentials provided
   at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:586)
   at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:123)
   at jenkins.plugins.zulip.Zulip.post(Zulip.java:155)
   at jenkins.plugins.zulip.Zulip.sendStreamMessage(Zulip.java:180)
   at jenkins.plugins.zulip.ZulipSendStep.perform(ZulipSendStep.java:50)
   at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
   at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
   at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
   at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   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:833)

Anything else?

I checked out the Zulip API Key in Manage Jenkins > System > Zulip Notification Settings.
I inspected the Concealed Password, which returns the encoded API Key... and then I decoded it. It was correct. I changed the API key again. Unfortunately, nothing changed in result.

update

I setup a new Jenkins environment from scratch and installed Zulip Plugin in it. It worked in the new environment. However, I compared jenkins_home/jenkins.plugins.zulip.ZulipNotifier.xml in both environments. There were no differences, except <api key> tag, which were probably encoded with their own Jenkins master keys.

java.lang.NoClassDefFoundError:

Hello,

when we use the zulip notification plugin but on the end of a build we always get the following error message:
java.lang.ClassNotFoundException: org.apache.commons.httpclient.Credentials
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:594)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
Caused: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Credentials
at jenkins.plugins.zulip.ZulipNotifier.publish(ZulipNotifier.java:133)
at jenkins.plugins.zulip.ZulipNotifier.perform(ZulipNotifier.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:767)
at hudson.model.Build$BuildExecution.post2(Build.java:179)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:711)
at hudson.model.Run.execute(Run.java:1925)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)

I have already checked if the bot has sufficient permissions to send to a stream and verified it via curl, which works.
Our configuration is that the build-job, which atm. is just a job which tries to send a messages to a stream, is being executed on a jenkins node.
The node has the following java versions installed:
javac -version
javac 11.0.19

java -version
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)

I already tried different bots in different streams etc. but every job runs into the same error as stated above. In the documentation i couldnr find any hints about how to troubleshoot this error.

Maybe anyone here can help.

Regards

After upgrading Jenkins, the plugin dosen't work anymore

Jenkins and plugins versions report

Environment
Paste the output here

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

Jenkins Docker Image.
In Version 2.378, everything's fine. But after upgrading to Version 2.383, it breaks.
It has been tested on both JDK 11 and JDK 17.

Reproduction steps

Upgrade Jenkins to the latest version.

Expected Results

The message successfully send to Zulip.

Actual Results

The output of Jenkins pipeline, after running zulipSend message: 'some messages here'

java.lang.ClassNotFoundException: org.apache.commons.httpclient.Credentials
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
	at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Caused: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Credentials
	at jenkins.plugins.zulip.ZulipSendStep.perform(ZulipSendStep.java:44)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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)
[Pipeline] // catchError
[Pipeline] stage
[Pipeline] { (Notify)
[Pipeline] zulipNotification
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.ClassNotFoundException: org.apache.commons.httpclient.Credentials
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
	at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Caused: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Credentials
	at jenkins.plugins.zulip.ZulipNotifier.publish(ZulipNotifier.java:133)
	at jenkins.plugins.zulip.ZulipNotifier.perform(ZulipNotifier.java:86)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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)
Finished: FAILURE

Anything else?

No response

Failed builds should use :cross_mark: rather than :x:

With Zulip's "Google modern" emoji theme (which I think is the default), in Zulip 3.1, the :x: displays as a cross in a green box (seems to match Android 10: https://emojipedia.org/google/android-10.0/cross-mark-button/, Android 9 and Android 11 had/have a red cross in a black-bordered white box, looking like what was displayed in Zulip 2.x)

I'd suggest using :cross_mark: instead, which is more consistently displayed in red: https://emojipedia.org/cross-mark/

Moreover, a successful build uses :check_mark:, which is not in a box: https://emojipedia.org/check-mark/ so it would be more consistent.

Add send test message button into plugin configuration

What feature do you want to see added?

Introduce a Send test message button into the global Zulip plugin configuration to make the setup verification more convenient (no need to run a build etc.).

Upstream changes

No response

Blank project topic will override topic from global configuration

A bug in the posting to fixed topic functionality introduced in #8 PR
When topic is configured in the global configuration, but left blank in project configuration, the global configuration is ignored and messages are posted to the project name topic.
The bug affects only the publisher, not the send step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.