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

Jenkins creates lots of warning message for creating matrix project root directory

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • matrix-project-plugin
    • None
    • Jenkins 1.6.42.1
      Ubuntu 14.04
      JAVA 7

      Jenkins creates lots of warning message for matrix project. The size of log would just keep growing which makes it very hard to read.

      The log looks something like this:

      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      

      After some debugging, I think the problem is that it's calling File.mkdirs(), which would return false if the folder already exist.

          public File getRootDirFor(@Nonnull Combination combination) {
              File f = getConfigurationsDir();
              for (Entry<String, String> e : combination.entrySet())
                  f = new File(f,"axis-"+e.getKey()+'/'+Util.rawEncode(e.getValue()));
              if (!f.getParentFile().mkdirs()) {
                  LOGGER.log(Level.WARNING, "Cannot create directory {0} for the combination {1}", new Object[]{f, combination});
              }
              return f;
          }
      

      I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.

          [JENKINS-33230] Jenkins creates lots of warning message for creating matrix project root directory

          Kevin Yu created issue -
          Kevin Yu made changes -
          Description Original: Jenkins creates lots of warning message for matrix project. The size of log would just keep growing which makes it very hard to read.

          The log looks something like this:

          {code:java}
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/FortiAP-S/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/FAP_S313C for the combination BUILD_TYPE=release,MODEL_NAME=FAP_S313C
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/FortiAP-S/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/FAP_S313C for the combination BUILD_TYPE=release,MODEL_NAME=FAP_S313C
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          {code}

          After some debugging, I think the problem is that it's calling File.mkdirs(), which would return false if the folder already exist.


          {code:java}
              public File getRootDirFor(@Nonnull Combination combination) {
                  File f = getConfigurationsDir();
                  for (Entry<String, String> e : combination.entrySet())
                      f = new File(f,"axis-"+e.getKey()+'/'+Util.rawEncode(e.getValue()));
                  if (!f.getParentFile().mkdirs()) {
                      LOGGER.log(Level.WARNING, "Cannot create directory {0} for the combination {1}", new Object[]{f, combination});
                  }
                  return f;
              }
          {code}

          I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.
          New: Jenkins creates lots of warning message for matrix project. The size of log would just keep growing which makes it very hard to read.

          The log looks something like this:

          {code:java}
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          {code}

          After some debugging, I think the problem is that it's calling File.mkdirs(), which would return false if the folder already exist.


          {code:java}
              public File getRootDirFor(@Nonnull Combination combination) {
                  File f = getConfigurationsDir();
                  for (Entry<String, String> e : combination.entrySet())
                      f = new File(f,"axis-"+e.getKey()+'/'+Util.rawEncode(e.getValue()));
                  if (!f.getParentFile().mkdirs()) {
                      LOGGER.log(Level.WARNING, "Cannot create directory {0} for the combination {1}", new Object[]{f, combination});
                  }
                  return f;
              }
          {code}

          I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.
          Rick Liu made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 169115 ] New: JNJira + In-Review [ 183366 ]

            kohsuke Kohsuke Kawaguchi
            samsun387 Kevin Yu
            Votes:
            14 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: