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

Variables inside FILE content are not replaced

    XMLWordPrintable

Details

    Description

      I would like to use ${FILE:mypath/xxx.html} to create the same rich content for all my jobs. Using this will allow me to have a unique place when i can change the content and will be apply to all the job

      The problem is that i want also to have variable interpolation

      Like JENKINS-21333, i believe the problem can be solved at the same place

      RichTextPublisher.java (line 165)

      Matcher matcher = FILE_VAR_PATTERN.matcher(text);
      int start = 0;
      while (matcher.find(start)) {
      String fileName = matcher.group(2); <- HERE for 213333 fileName = replaceVars(matcher.group(2), vars);

      FilePath filePath = new FilePath(build.getWorkspace(), fileName);
      if (filePath.exists()) {
      String value = filePath.readToString();
      if (matcher.group(1).length() != 4)

      { // Group is file_sl value = value.replace("\n", "").replace("\r", ""); }

      vars.put(String.format("%s:%s", matcher.group(1), fileName), value); <-- HERE instead of value => replaceVars(value, vars)
      }
      start = matcher.end();
      }

      Is it possible to have those 2 bugs fixed?

      Thanks in advance

      Xtof

      Attachments

        Activity

          xtof christophe dehaudt created issue -
          xtof christophe dehaudt made changes -
          Field Original Value New Value
          Description "I really like the idea of this plugin, that you can customize the message of the build, but I miss you can any other lightweight markup language like AsciiDoc. You can use: https://github.com/asciidoctor/asciidoctor-java-integration for Java integration." I would like to use ${FILE:mypath/xxx.html} to create the same rich content for all my jobs. Using this will allow me to have a unique place when i can change the content and will be apply to all the job

          The problem is that i want also to have variable interpolation

          Like JENKINS-21333, i believe the problem can be solved at the same place


          RichTextPublisher.java (line 165)

          Matcher matcher = FILE_VAR_PATTERN.matcher(text);
          int start = 0;
          while (matcher.find(start)) {
          String fileName = matcher.group(2); <- HERE for 213333 = replaceVars(matcher.group(2), vars);

          FilePath filePath = new FilePath(build.getWorkspace(), fileName);
          if (filePath.exists()) {
          String value = filePath.readToString();
          if (matcher.group(1).length() != 4) { // Group is file_sl value = value.replace("\n", "").replace("\r", ""); }
          vars.put(String.format("%s:%s", matcher.group(1), fileName), value);
          }
          start = matcher.end();
          }

          can we do something like






          xtof christophe dehaudt made changes -
          Description I would like to use ${FILE:mypath/xxx.html} to create the same rich content for all my jobs. Using this will allow me to have a unique place when i can change the content and will be apply to all the job

          The problem is that i want also to have variable interpolation

          Like JENKINS-21333, i believe the problem can be solved at the same place


          RichTextPublisher.java (line 165)

          Matcher matcher = FILE_VAR_PATTERN.matcher(text);
          int start = 0;
          while (matcher.find(start)) {
          String fileName = matcher.group(2); <- HERE for 213333 = replaceVars(matcher.group(2), vars);

          FilePath filePath = new FilePath(build.getWorkspace(), fileName);
          if (filePath.exists()) {
          String value = filePath.readToString();
          if (matcher.group(1).length() != 4) { // Group is file_sl value = value.replace("\n", "").replace("\r", ""); }
          vars.put(String.format("%s:%s", matcher.group(1), fileName), value);
          }
          start = matcher.end();
          }

          can we do something like






          I would like to use ${FILE:mypath/xxx.html} to create the same rich content for all my jobs. Using this will allow me to have a unique place when i can change the content and will be apply to all the job

          The problem is that i want also to have variable interpolation

          Like JENKINS-21333, i believe the problem can be solved at the same place


          RichTextPublisher.java (line 165)

          Matcher matcher = FILE_VAR_PATTERN.matcher(text);
          int start = 0;
          while (matcher.find(start)) {
          String fileName = matcher.group(2); <- HERE for 213333 fileName = replaceVars(matcher.group(2), vars);

          FilePath filePath = new FilePath(build.getWorkspace(), fileName);
          if (filePath.exists()) {
          String value = filePath.readToString();
          if (matcher.group(1).length() != 4) { // Group is file_sl value = value.replace("\n", "").replace("\r", ""); }
          vars.put(String.format("%s:%s", matcher.group(1), fileName), value); <-- HERE instead of value => replaceVars(value, vars)
          }
          start = matcher.end();
          }

          Is it possible to have those 2 bugs fixed?

          Thanks in advance

          Xtof





          xtof christophe dehaudt made changes -
          Issue Type New Feature [ 2 ] Bug [ 1 ]
          masterhard Dmitry Korotkov made changes -
          Resolution Duplicate [ 3 ]
          Status Open [ 1 ] Resolved [ 5 ]
          masterhard Dmitry Korotkov made changes -
          Resolution Duplicate [ 3 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 154599 ] JNJira + In-Review [ 186197 ]

          People

            masterhard Dmitry Korotkov
            xtof christophe dehaudt
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: