Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69313

Injects environment variables at node don't work when running Agent on Java 17

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • envinject-plugin
    • None
    • Jenkins 2.363
      Envinject-plugin 521.v1a_a_dd2073b_2e
      Windows 2016

      Injecting environment variables on node level don't work when running Agent on Java 17.

      Works for Java 11 and earlier.

          [JENKINS-69313] Injects environment variables at node don't work when running Agent on Java 17

          Benny Bürger added a comment -

          I can confirm, that this issue still exists.

          The log file reports the following when loading:
          2023-10-10 09:39:59.459+0000 [id=26] WARNING jenkins.model.Jenkins#<init>: Exception in onOnline() for the computer listener class org.jenkinsci.plugins.envinject.EnvInjectComputerListener on the built-in node
          java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.lang.reflect.Field.modifiers accessible: module java.base does not "opens java.lang.reflect" to unnamed module @3965df8c
          at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
          at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
          at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
          at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
          at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:56)
          at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:19)
          at hudson.FilePath.act(FilePath.java:1286)
          at org.jenkinsci.plugins.envinject.EnvInjectComputerListener.onOnline(EnvInjectComputerListener.java:155)
          at jenkins.model.Jenkins.<init>(Jenkins.java:1031)
          at hudson.model.Hudson.<init>(Hudson.java:86)
          at hudson.model.Hudson.<init>(Hudson.java:82)
          at hudson.WebAppMain$3.run(WebAppMain.java:247)

          Benny Bürger added a comment - I can confirm, that this issue still exists. The log file reports the following when loading: 2023-10-10 09:39:59.459+0000 [id=26] WARNING jenkins.model.Jenkins#<init>: Exception in onOnline() for the computer listener class org.jenkinsci.plugins.envinject.EnvInjectComputerListener on the built-in node java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.lang.reflect.Field.modifiers accessible: module java.base does not "opens java.lang.reflect" to unnamed module @3965df8c at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:56) at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:19) at hudson.FilePath.act(FilePath.java:1286) at org.jenkinsci.plugins.envinject.EnvInjectComputerListener.onOnline(EnvInjectComputerListener.java:155) at jenkins.model.Jenkins.<init>(Jenkins.java:1031) at hudson.model.Hudson.<init>(Hudson.java:86) at hudson.model.Hudson.<init>(Hudson.java:82) at hudson.WebAppMain$3.run(WebAppMain.java:247)

          Brian M added a comment - - edited

          I can also confirm this same issue using Jenkins 2.440.2  We have a master server and several build nodes as well as other non-build remote agent nodes. When setting the properties through a file and configuring the node to use the properties files, it does not use the properties.  It won't use the properties file regardless of where the file is located (on master, on node, etc.).  This is a blocker for moving to using Java 17.

          Brian M added a comment - - edited I can also confirm this same issue using Jenkins 2.440.2  We have a master server and several build nodes as well as other non-build remote agent nodes. When setting the properties through a file and configuring the node to use the properties files, it does not use the properties.  It won't use the properties file regardless of where the file is located (on master, on node, etc.).  This is a blocker for moving to using Java 17.

          The envinject plugin is marked as up for adoption. I recommend you file a PR adopt the plugin and cut a release yourself, to address the issue.
          Plugins marked as up for adoption will likely not receive (maintenance) updates in the future.

          Alexander Brandes added a comment - The envinject plugin is marked as up for adoption. I recommend you file a PR adopt the plugin and cut a release yourself, to address the issue. Plugins marked as up for adoption will likely not receive (maintenance) updates in the future.

          Rafa added a comment - - edited

          This issue is marked as a blocker, but there doesn't seem to be any activity so far.

          Since the plugin is marked for adoption:

          • If it is a blocker and there is no fix, will moving to Java 17 be delayed?
          • If not, then it shouldn't be marked as a blocker.

          Is anyone working on a fix?

          Could you share any workarounds?

          Rafa added a comment - - edited This issue is marked as a blocker, but there doesn't seem to be any activity so far. Since the plugin is marked for adoption: If it is a blocker and there is no fix, will moving to Java 17 be delayed? If not, then it shouldn't be marked as a blocker. Is anyone working on a fix? Could you share any workarounds?

          Basil Crow added a comment -

          Duplicates JENKINS-60891.

          Basil Crow added a comment - Duplicates JENKINS-60891 .

            Unassigned Unassigned
            peterbj Peter Bjernfalk
            Votes:
            9 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: