jenkinsci / jenkinsfile-runner

A command line tool to run Jenkinsfile as a function
MIT License
1.14k stars 296 forks source link

[Discussion] Update to Jetty version 11 #699

Open romanisb opened 1 year ago

romanisb commented 1 year ago

What feature do you want to see added?

This is rather a follow up on a discussion from #696.

Copied from https://github.com/jenkinsci/jenkinsfile-runner/pull/696#issuecomment-1637603013

Everything looks good, thanks you! I would likely go straight to Jetty 11 but it is a separate topic @oleg-nenashev

I've looked into updating to Jetty 11 and straight away the compilation will fail because auf the namespace change from javax.* to jakarta.*:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/JenkinsLauncher.java:[20,20] error: package javax.servlet does not exist
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/JenkinsLauncher.java:[21,20] error: package javax.servlet does not exist
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/JenkinsEmbedder.java:[77,20] error: package javax.servlet does not exist
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/JenkinsLauncher.java:[80,14] error: cannot find symbol
  symbol:   class ServletContext
  location: class JenkinsLauncher<T>
  where T is a type-variable:
    T extends JenkinsLauncherCommand declared in class JenkinsLauncher
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/JenkinsEmbedder.java:[375,23] error: cannot find symbol
  symbol:   class ServletContext
  location: class JenkinsEmbedder
[ERROR] /mnt/c/Users/dev/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/PluginManagerImpl.java:[14,29] error: cannot find symbol
  symbol:   class ServletContext
  location: class PluginManagerImpl
[ERROR] /mnt/c/Users/dev/com/romanisb/jenkinsfile-runner/setup/src/main/java/io/jenkins/jenkinsfile/runner/NoListenerConfiguration.java:[8,20] error: package javax.servlet does not exist
[INFO] 7 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Jenkinsfile Runner 1.0-beta-32-SNAPSHOT:
[INFO]
[INFO] Jenkinsfile Runner ................................. SUCCESS [  1.422 s]
[INFO] bootstrap .......................................... SUCCESS [  7.175 s]
[INFO] setup .............................................. FAILURE [  7.503 s]
[INFO] Jenkinsfile Runner: Plugin dependencies ............ SKIPPED
[INFO] payload ............................................ SKIPPED
[INFO] jenkinsfile-runner ................................. SKIPPED
[INFO] packaging-parent-pom-resources ..................... SKIPPED
[INFO] packaging-parent-pom ............................... SKIPPED
[INFO] packaging-parent-pom-slim .......................... SKIPPED
[INFO] vanilla-package .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  30.009 s
[INFO] Finished at: 2023-07-17T10:26:19+02:00
[INFO] ------------------------------------------------------------------------

Also I'm not sure if Jetty 11 will somehow work with Jenkins core in the future, but I do not have that much in-depth knowledge in this: https://www.jenkins.io/doc/administration/requirements/servlet-containers/

Tested with https://github.com/romanisb/jenkinsfile-runner/compare/update-jenkins-core-2.375...romanisb:jenkinsfile-runner:jenkins-core-2.387-jetty-11

Upstream changes

https://github.com/romanisb/jenkinsfile-runner/compare/update-jenkins-core-2.375...romanisb:jenkinsfile-runner:jenkins-core-2.387-jetty-11

lhupfeldt commented 1 year ago

Would that update fix #686 ?

romanisb commented 1 year ago

I think the underlying issue in #686 and #656 could be fixed with #696. So with a new release of the current state of the main branch and a new docker image version you should be good to go.

oleg-nenashev commented 1 year ago

Yes, let's definitely update to Jetty 11

oleg-nenashev commented 1 year ago

I looked into building in the Jetty 10 => 11 polyfill we have in another project, but it does not run well. Jetty is too strictly tied to Jenkins internals. I think the best strategy would be to wait for https://github.com/jenkinsci/winstone/pull/341 from @olamy , and then update straight to Jetty 12

olamy commented 1 year ago

I don't think upgrading to Jetty 11 is possible now. Because Jetty 11 is ee9 (jakarta. namespace) whereas Jetty 10 is ee8 (javax. namespace) This namespace will require some significant changes in Jenkins core itself. (stapler etc...) Jetty 12 with ee8 is a better candidate.