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

Endless Loop when "provisoning config files..." when run from a build promotion

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      My symptom is when I click promote I get the following output:

      Started by user XXX@mydomain.com
      Building on master in workspace /var/lib/jenkins/jobs/Package for Release /workspace
      Promoting JOB BEING PROMOTED
      provisoning config files...

      And it sits there...

      A snapshot of the stack trace is:

      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:82)
      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:103)
      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:114)
      at org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFileUtil.provisionConfigFiles(ManagedFileUtil.java:81)
      at org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep.perform(ConfigFileBuildStep.java:61)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:405)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:347)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      at hudson.model.Run.execute(Run.java:1729)
      at hudson.model.Run.run(Run.java:1688)
      at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)

      This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:

          public static <T extends Config> T getByIdOrNull(@Nullable ItemGroup itemGroup, @NonNull String configId) {
      
              while (itemGroup != null) {
                  if (folderPluginInstalled() && itemGroup instanceof AbstractFolder) {
                      final AbstractFolder<?> folder = AbstractFolder.class.cast(itemGroup);
                      ConfigFileStore store = folder.getProperties().get(FolderConfigFileProperty.class);
                      if (store != null) {
                          Config config = store.getById(configId);
                          if (config != null) {
                              return (T) config;
                          }
                      }
                  }
                  if (itemGroup instanceof Item) {
                      itemGroup = Item.class.cast(itemGroup).getParent();
                  }
                  if (itemGroup instanceof Jenkins) {
                      // we are on top scope...
                      return (T) GlobalConfigFiles.get().getById(configId);
                  } else {
                      continue;
                  }
              }
      
              return null;
          }
      

      After attaching the debugger I've found that the reason I'm getting this behaviour is because this method does not return.

      It just loops around and around.

      The real type of the passed in itemGroup is hudson.plugins.promoted_builds.JobPropertyImpl

      1. Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
      2. JobPropertyImpl is not an instance of Item
      3. JobPropertyImpl is not an instance of Jenkins either.

      So this method will never return.

      What is more is the configId that is passed in is valid as if I call GlobalConfigFiles.get().getById(configId); I get back what I expect.

      I suspect that 3rd condition probably needs to be relaxed a little...

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Dominik Bartholdi
            Path:
            src/main/java/org/jenkinsci/plugins/configfiles/ConfigContextResolver.java
            src/main/java/org/jenkinsci/plugins/configfiles/ConfigFiles.java
            src/test/java/org/jenkinsci/plugins/configfiles/ConfigFilesTest.java
            http://jenkins-ci.org/commit/config-file-provider-plugin/e76cff0a590bb4083cb2e120304f55d8e2d75267
            Log:
            Merge pull request #49 from Greybird/master

            JENKINS-40803 allow plugins to specify the config file resolution context

            Compare: https://github.com/jenkinsci/config-file-provider-plugin/compare/b5b4d0dcdf57...e76cff0a590b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Dominik Bartholdi Path: src/main/java/org/jenkinsci/plugins/configfiles/ConfigContextResolver.java src/main/java/org/jenkinsci/plugins/configfiles/ConfigFiles.java src/test/java/org/jenkinsci/plugins/configfiles/ConfigFilesTest.java http://jenkins-ci.org/commit/config-file-provider-plugin/e76cff0a590bb4083cb2e120304f55d8e2d75267 Log: Merge pull request #49 from Greybird/master JENKINS-40803 allow plugins to specify the config file resolution context Compare: https://github.com/jenkinsci/config-file-provider-plugin/compare/b5b4d0dcdf57...e76cff0a590b
            Hide
            imod Dominik Bartholdi added a comment -

            released with 1.8

            Show
            imod Dominik Bartholdi added a comment - released with 1.8
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Arnaud
            Path:
            pom.xml
            src/main/java/hudson/plugins/promoted_builds/JobPropertyImplConfigContextResolver.java
            src/test/java/hudson/plugins/promoted_builds/PromotionConfigFilesTest.java
            http://jenkins-ci.org/commit/promoted-builds-plugin/d61798e40933d8bacadb9c37820bf6ce0e67f072
            Log:
            JENKINS-40803 provide a config file resolution context for promotions

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Arnaud Path: pom.xml src/main/java/hudson/plugins/promoted_builds/JobPropertyImplConfigContextResolver.java src/test/java/hudson/plugins/promoted_builds/PromotionConfigFilesTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/d61798e40933d8bacadb9c37820bf6ce0e67f072 Log: JENKINS-40803 provide a config file resolution context for promotions
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Devin Nusbaum
            Path:
            pom.xml
            src/main/java/hudson/plugins/promoted_builds/JobPropertyImplConfigContextResolver.java
            src/test/java/hudson/plugins/promoted_builds/PromotionConfigFilesTest.java
            http://jenkins-ci.org/commit/promoted-builds-plugin/9d0530121fa48d1a581cdd61472a98519d58463e
            Log:
            Merge pull request #113 from Greybird/master

            JENKINS-40803 provide a config file resolution context for promotions

            Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/03852505496a...9d0530121fa4

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Devin Nusbaum Path: pom.xml src/main/java/hudson/plugins/promoted_builds/JobPropertyImplConfigContextResolver.java src/test/java/hudson/plugins/promoted_builds/PromotionConfigFilesTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/9d0530121fa48d1a581cdd61472a98519d58463e Log: Merge pull request #113 from Greybird/master JENKINS-40803 provide a config file resolution context for promotions Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/03852505496a...9d0530121fa4
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Fixed in config-file-provider:2.18 and promoted-builds:3.1. Thanks Arnaud TAMAILLON for fixing this!

            Show
            dnusbaum Devin Nusbaum added a comment - Fixed in config-file-provider:2.18 and promoted-builds:3.1 . Thanks Arnaud TAMAILLON for fixing this!

              People

              • Assignee:
                farmgeek4life Bryson Gibbons
                Reporter:
                michaelwiles Michael Wiles
              • Votes:
                3 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: