jenkinsci / jenkinsfile-runner

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

"Docker Simple" demo is broken #690

Open akoerner1 opened 1 year ago

akoerner1 commented 1 year ago

The docker demo at: https://github.com/jenkinsci/jenkinsfile-runner/tree/main/demo/docker-simple is broken

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

Linux precision776 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux docker-simple(main) ✗ (0)> cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.1 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.1 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy

Docker context

docker-simple(main) ✗ (0)> docker --version                             
Docker version 20.10.21, build baeda1f

Reproduction steps

  1. clone the repo
  2. cd to demo dir:
    cd jenkinsfile-runner/demo/docker-simple
  3. build the docker context:
    docker build -t jfr-test .
  4. Run the sample jenkinsfile
    docker run --rm -v $(pwd):/workspace jfr-test

Expected Results

docker run --rm -v $(pwd):/workspace jfr-test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/usr/share/jenkins/WEB-INF/lib/guice-4.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Started
Resume disabled by user, switching to high-performance, low-durability mode.
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /tmp/jenkinsfileRunner.tmp/jfr15345197312171626702.run/workspace/job
[Pipeline] {
[Pipeline] echo
Hello World!
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Actual Results

docker-simple(main) ✗ (1)> docker run --rm -v $(pwd):/workspace jfr-test
java.lang.RuntimeException: Unhandled exception
        at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:69)
        at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.call(Bootstrap.java:71)
        at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.call(Bootstrap.java:21)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:46)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/security/LoginService
        at io.jenkins.jenkinsfile.runner.App.run(App.java:25)
        at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.runJenkinsfileRunnerApp(JenkinsLauncherCommand.java:226)
        at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:67)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.security.LoginService
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 13 more

Anything else?

No response

oleg-nenashev commented 1 year ago

Yes, it is documented in the demo header. I am looking how to improve it

oleg-nenashev commented 1 year ago

Some demos were updated in https://github.com/jenkinsci/jenkinsfile-runner/pull/676 , but this one still needs a patch

aaron-michaux commented 1 year ago

Any guidance on how to build your own docker container?