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

System scope Maven global settings.xml doesn't provide serverIds when using multibranch pipeline

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Jenkins ver. 2.150.1

      Problem reproduce steps:

      1. Credentials > System > Add Domain A, just has name specified.
      2. In domain A, add a credential C, username: maven repo username, password: maven repo password.
      3.  Manage Jenkins > Managed files, create a maven global settings.xml M, add Server Credentials using credential C.
      4. Create a Multibranch pipeline, in Pipeline Maven Configuration section, using config M.
      5. Run pipeline.

      Build log:

      [withMaven] using Maven global settings.xml '876cdf5c-802b-4252-a062-4b9d8602dd06' 
         with NO Maven servers credentials provided by Jenkins
      

      If I create credential C and maven global settings.xml M inside Multibranch pipeline, everything goes fine:

      [withMaven] using Maven global settings.xml 'f657ec5c-cc63-4730-a133-7e58c3ea433a' with Maven servers credentials 
         provided by Jenkins (replaceAll: true): 
         [mavenServerId: 'supwisdom-snapshots', jenkinsCredentials: '250947bb-2ce2-4cf5-b62f-bba7e2af7df0', username: 'deployment', type: 'UsernamePasswordCredentialsImpl'], 
         [mavenServerId: 'supwisdom-releases', jenkinsCredentials: '250947bb-2ce2-4cf5-b62f-bba7e2af7df0', username: 'deployment', type: 'UsernamePasswordCredentialsImpl']
      

       

          [JENKINS-55325] System scope Maven global settings.xml doesn't provide serverIds when using multibranch pipeline

          Daniel Qian added a comment - - edited

          cleclerc  That's weird, please take a look at screenshot i uploaded. Credentials are listed when define global maven settings.

           

          BTW, everything goes fine on Jenkins ver. 2.138.3

           

          — update —

           

          I followed your suggestion not using generated ids for credentials and maven settings. Problem solved.

          Daniel Qian added a comment - - edited cleclerc   That's weird, please take a look at screenshot i uploaded. Credentials are listed when define global maven settings.   BTW, everything goes fine on Jenkins ver. 2.138.3   — update —   I followed your suggestion not using generated ids for credentials and maven settings. Problem solved.

          Cyrille Le Clerc added a comment - - edited

          chanjarster I have just cut 3.6.6-beta-1 to help you troubleshoot. Could you please test it?

          Warning message will look like

          [withMaven]  Global Maven settings - Failure to resolve credentials: [mavenServerId: github, jenkinsCredentials: github-credentials]
          

          https://github.com/jenkinsci/pipeline-maven-plugin/releases/tag/pipeline-maven-3.6.6-beta-1

          Cyrille Le Clerc added a comment - - edited chanjarster I have just cut 3.6.6-beta-1 to help you troubleshoot. Could you please test it? Warning message will look like [withMaven] Global Maven settings - Failure to resolve credentials: [mavenServerId: github, jenkinsCredentials: github-credentials] https://github.com/jenkinsci/pipeline-maven-plugin/releases/tag/pipeline-maven-3.6.6-beta-1

          Daniel Qian added a comment -

          cleclerc got this error:

          [withMaven] Options: []
          [withMaven] Available options: 
          [withMaven] using JDK installation JDK8
           > git rev-list --no-walk 53afc20dcedbead4067598f6a390fbe456242274 # timeout=10
           > git rev-parse --verify HEAD # timeout=10
          Resetting working tree
           > git reset --hard # timeout=10
           > git clean -fdx # timeout=10
          [Pipeline] // withMaven
          Error when executing cleanup post condition:
          java.lang.IllegalStateException: Exception injecting Maven settings.xml 7924a30a-1d73-49ec-8e45-519e868b76e7 during the build: institute-spring-boot-tracing/develop #30: null
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:960)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupSettingFile(WithMavenStepExecution2.java:743)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupMaven(WithMavenStepExecution2.java:334)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.doStart(WithMavenStepExecution2.java:214)
          	at org.jenkinsci.plugins.pipeline.maven.fix.jenkins49337.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:85)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          	at java.lang.Thread.run(Thread.java:748)
          Caused by: java.lang.NullPointerException
          	at java.util.TreeMap.getEntry(TreeMap.java:347)
          	at java.util.TreeMap.containsKey(TreeMap.java:232)
          	at java.util.TreeMap$KeySet.contains(TreeMap.java:1137)
          	at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.removeMavenServerDefinitions(CredentialsHelper.java:260)
          	at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.fillAuthentication(CredentialsHelper.java:130)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:949)
          	... 9 more
          
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // timeout
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          java.lang.NullPointerException
          	at java.util.TreeMap.getEntry(TreeMap.java:347)
          	at java.util.TreeMap.containsKey(TreeMap.java:232)
          	at java.util.TreeMap$KeySet.contains(TreeMap.java:1137)
          	at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.removeMavenServerDefinitions(CredentialsHelper.java:260)
          	at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.fillAuthentication(CredentialsHelper.java:130)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:949)
          Caused: java.lang.IllegalStateException: Exception injecting Maven settings.xml 7924a30a-1d73-49ec-8e45-519e868b76e7 during the build: institute-spring-boot-tracing/develop #30: null
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:960)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupSettingFile(WithMavenStepExecution2.java:743)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupMaven(WithMavenStepExecution2.java:334)
          	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.doStart(WithMavenStepExecution2.java:214)
          	at org.jenkinsci.plugins.pipeline.maven.fix.jenkins49337.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:85)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          	at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          

          Daniel Qian added a comment - cleclerc got this error: [withMaven] Options: [] [withMaven] Available options: [withMaven] using JDK installation JDK8 > git rev-list --no-walk 53afc20dcedbead4067598f6a390fbe456242274 # timeout=10 > git rev-parse --verify HEAD # timeout=10 Resetting working tree > git reset --hard # timeout=10 > git clean -fdx # timeout=10 [Pipeline] // withMaven Error when executing cleanup post condition: java.lang.IllegalStateException: Exception injecting Maven settings.xml 7924a30a-1d73-49ec-8e45-519e868b76e7 during the build: institute-spring-boot-tracing/develop #30: null at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:960) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupSettingFile(WithMavenStepExecution2.java:743) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupMaven(WithMavenStepExecution2.java:334) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.doStart(WithMavenStepExecution2.java:214) at org.jenkinsci.plugins.pipeline.maven.fix.jenkins49337.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:85) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) Caused by: java.lang.NullPointerException at java.util.TreeMap.getEntry(TreeMap.java:347) at java.util.TreeMap.containsKey(TreeMap.java:232) at java.util.TreeMap$KeySet.contains(TreeMap.java:1137) at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.removeMavenServerDefinitions(CredentialsHelper.java:260) at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.fillAuthentication(CredentialsHelper.java:130) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:949) ... 9 more [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // timeout [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.lang.NullPointerException at java.util.TreeMap.getEntry(TreeMap.java:347) at java.util.TreeMap.containsKey(TreeMap.java:232) at java.util.TreeMap$KeySet.contains(TreeMap.java:1137) at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.removeMavenServerDefinitions(CredentialsHelper.java:260) at org.jenkinsci.plugins.configfiles.maven.security.CredentialsHelper.fillAuthentication(CredentialsHelper.java:130) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:949) Caused: java.lang.IllegalStateException: Exception injecting Maven settings.xml 7924a30a-1d73-49ec-8e45-519e868b76e7 during the build: institute-spring-boot-tracing/develop #30: null at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.settingsFromConfig(WithMavenStepExecution2.java:960) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupSettingFile(WithMavenStepExecution2.java:743) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.setupMaven(WithMavenStepExecution2.java:334) at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2.doStart(WithMavenStepExecution2.java:214) at org.jenkinsci.plugins.pipeline.maven.fix.jenkins49337.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:85) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) Finished: FAILURE

          chanjarster could one of the "<server>" of your Maven settings xml "7924a30a-1d73-49ec-8e45-519e868b76e7" miss an "<id>" element?

          Cyrille Le Clerc added a comment - chanjarster could one of the " <server> " of your Maven settings xml " 7924a30a-1d73-49ec-8e45-519e868b76e7 " miss an " <id> " element?

          Daniel Qian added a comment - - edited

          cleclerc I don't know, but I keep the content part untouched. See figure below:

          BTW, I downgrade plugin to v3.6.5 no error shows up

          Daniel Qian added a comment - - edited cleclerc I don't know, but I keep the content part untouched. See figure below: BTW, I downgrade plugin to v3.6.5 no error shows up

          Reproduced. Troubleshooting in progress

          Cyrille Le Clerc added a comment - Reproduced. Troubleshooting in progress

          A regression on 3.6.6-beta-1 with maven settings containing comments in the <servers> element.

          Cyrille Le Clerc added a comment - A regression on 3.6.6-beta-1 with maven settings containing comments in the <servers> element.

          Cyrille Le Clerc added a comment - Fix of the regressions available in https://github.com/jenkinsci/pipeline-maven-plugin/releases/tag/pipeline-maven-3.6.6-beta-2

          Delivered in 3.6.6

          Cyrille Le Clerc added a comment - Delivered in 3.6.6

          red der added a comment - - edited

          this issue is back. Im on version 3.8.1,

          hard coding server setting in the settings file works but using a username and password to replace does not work

          https://stackoverflow.com/questions/58139761/pipeline-maven-plugin-not-replacing-servers-in-global-settings-xml-from-jenkin

           

          red der added a comment - - edited this issue is back. Im on version  3.8.1, hard coding server setting in the settings file works but using a username and password to replace does not work https://stackoverflow.com/questions/58139761/pipeline-maven-plugin-not-replacing-servers-in-global-settings-xml-from-jenkin  

            cleclerc Cyrille Le Clerc
            chanjarster Daniel Qian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: