Closed eXtrem0us closed 1 year ago
It seems in the changelog of Jenkins the reason for this issue is mentioned:
What's new in 2.379 (2022-11-22)
Jenkins no longer bundles a patched version of the deprecated Commons HttpClient 3.x library for use by plugins.
Plugins should be migrated to the native Java 11 HTTP client or updated to depend on the legacy Commons HttpClient 3.x API plugin.
@butchyyyy do you have time to investigate this?
In any case, pull requests are welcome.
Thanks for reporting and apologies for the inconvenience. I'll try to come up with a quick fix this week (adding the commons HttpClient dependency).
FWIW I tried switch to java.net.http
client which requires upgrading to java 11+. I had problems with the tests: powermock, mokito, … are not compatible.
If you want, I can share my work as WIP.
Quick fix is to add pom dependency for plugin commons-httpclient3-api (https://plugins.jenkins.io/commons-httpclient3-api/)
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-httpclient3-api</artifactId>
<version>3.1-3</version>
</dependency>
I tried add а dependency for plugin commons-httpclient3-api to pom. I builded .hpi
and tested it in my jenkins server(v. 2.386) and it worked successful, BUT unit-tests were failed. I am going to try fix a problem with tests.
This release of Jenkins just hide the wider apt repositories in Ubuntu, so I hit this bug today when I upgraded.
Is there a quick way to fix this locally? I can still in the Commons HttpClient 3.x API Plugin, but that alone doesn't appear sufficient.
@jamesvl You can pull my fork and execute mvn hpi:hpi
for build a hpi file. After you can manually install it. See https://www.jenkins.io/doc/book/managing/plugins/ for more details.
@EvgenyKuzavlev: I used your fork and build it with last maven without problems. After copying the zulip.hpi to plugins/zulip.jpi, the plugin is correctly loaded, but the global configuration and post-build step are not showing up. Any clue?
Note: Maven home: /opt/apache-maven-3.9.1 Java version: 11.0.18, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "5.15.104-1-pve", arch: "amd64", family: "unix"
@EvgenyKuzavlev
I also used your fork and build it with:
$ mvn --version Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8) Maven home: /opt/apache-maven-3.9.1 Java version: 11.0.18, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1160.88.1.el7.x86_64", arch: "amd64", family: "unix"
I got the same results as @epaul13
Plugin does not report any error in start up, gets listed as installed plugin, but it does not show in global config or in build definitions.
Tested with the latest Jenkins LTS release 2.387.3 (RedHat 7 RPM installation) and openjdk version "11.0.19" 2023-04-18 LTS
@EvgenyKuzavlev Have you managed to the get the plugin working with the latest LTS Jenkins?
@butchyyyy you mentioned that you would be looking at this. Any chance to get this fixed?
@ipikiiskinen @epaul13 I didn't try to use my fork with latest Jenkins, maybe it doesn't work. I am going to update Jenkins and test it later.
My env: centos-release-7-9.2009.1.el7.centos.x86_64 openjdk 11.0.17 2022-10-18 LTS jenkins 2.386
Any news? I can try to make a correction, but my java is rusted, and I don't know maven nor Jenkins dev env... Might not be the most efficient move :)
I have started working on a new major version, it will:
I have bulk of the work done. I just need to adjust the unit tests and give this a proper test flight before shipping the new version. Will keep you posted.
^^ The PR is up, all unit and integration tests are passing.
There are more or less no functional changes besides the http client migration. The rest is mostly formatting stuff and test migration away from Powermock.
I still need to run some manual testing against Jenkins + Zulip before I release this. If anyone has time to also give the branch a quick test and report any issues, it will be much appreciated.
Of course feel free to leave comments on the PR as well, it's first Java code I did in ~4 years 🙈
@butchyyyy
I checked out your PR and tested it. I have now access to global configuration and project post-build actions. Great work!
At first, I was unable to get any messages, with an error in Jenkins logs:
011SEVERE#011jenkins.plugins.zulip.Zulip#post: Error sending Zulip message:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I had to add my zulip server chain certificate to make it work. On Ubuntu 22.04, it means:
sudo cp zulip.combined-chain.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
sudo systemctl restart jenkins
Now I get my jenkins post messages from Jenkins! Thank you again!
So this work on Jenkins 2.387.3 on java 11.0.18 on Ubuntu 22.04
To build, for maven/jenkins devenv noobs like me:
git clone https://github.com/jenkinsci/zulip-plugin.git
cd zulip-plugin/
git checkout origin/version2
mvn package
# uninstall previous zulip plugin
sudo -u jenkins cp target/zulip.hpi /var/lib/jenkins/plugins/
sudo systemctl restart jenkins
with:
mvn --version
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /opt/apache-maven-3.9.1
Java version: 11.0.18, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.104-1-pve", arch: "amd64", family: "unix"
Thanks a lot for testing it @epaul13! The certificate chain validation is correct and afaik it was performed also with the Apache http client. Let me know if you think this is behaving differently than before.
I was also testing on my end today and verified several scenarios including proxy being setup in Jenkins both with and without authentication.
I think we are good to go, will most probably do the release tomorrow.
Resolved in version 2.0.0
Thanks a lot for testing it @epaul13! The certificate chain validation is correct and afaik it was performed also with the Apache http client. Let me know if you think this is behaving differently than before.
I was also testing on my end today and verified several scenarios including proxy being setup in Jenkins both with and without authentication.
I think we are good to go, will most probably do the release tomorrow.
Good news. For the certificate validation, my bad. I tested on a brand-new container, and my old jenkins is probably ten years old. I just checked and I have the same chain on the old server. So everything' good!
Thank You @butchyyyy ! :heart:
Jenkins and plugins versions report
Environment
```text 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 toVersion 2.383
, it breaks. It has been tested on bothJDK 11
andJDK 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'
Anything else?
No response