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

Expose current input line in groovy script

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      In a custom parser, the current input line number should be available (i.e. the line that matched the regex).
      Otherwise you cannot add Warning annotations correctly to e.g. the console log, if a source file is not available for the warning.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/DynamicParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          http://jenkins-ci.org/commit/warnings-plugin/fb9924a16dead75cdf8a73b811c4824b413a0a6d
          Log:
          [FIXED JENKINS-21569] Expose current line in groovy.
          Added getCurrentLine() method for line based parsers.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/DynamicParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java http://jenkins-ci.org/commit/warnings-plugin/fb9924a16dead75cdf8a73b811c4824b413a0a6d Log: [FIXED JENKINS-21569] Expose current line in groovy. Added getCurrentLine() method for line based parsers.
          Hide
          drulli Ulli Hafner added a comment -

          Hmm, is not that easy...

          Show
          drulli Ulli Hafner added a comment - Hmm, is not that easy...
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/DynamicParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          src/test/java/hudson/plugins/warnings/parser/DynamicParserTest.java
          http://jenkins-ci.org/commit/warnings-plugin/c2fcaec495f69bb8a90b0edc83b03a22635bb30a
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber in groovy.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/DynamicParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java src/test/java/hudson/plugins/warnings/parser/DynamicParserTest.java http://jenkins-ci.org/commit/warnings-plugin/c2fcaec495f69bb8a90b0edc83b03a22635bb30a Log: [FIXED JENKINS-21569] Expose variable lineNumber in groovy.
          Hide
          drulli Ulli Hafner added a comment -

          The line number is exposed via property 'lineNumber'.

          Show
          drulli Ulli Hafner added a comment - The line number is exposed via property 'lineNumber'.
          Hide
          jameshowe James Howe added a comment -

          Upgraded to 4.39, and get this error on the "Configure System" page when testing the script you added to the tests.
          An exception occurred during evaluation of the Groovy script: No such property: lineNumber for class: Script1

          Show
          jameshowe James Howe added a comment - Upgraded to 4.39, and get this error on the "Configure System" page when testing the script you added to the tests. An exception occurred during evaluation of the Groovy script: No such property: lineNumber for class: Script1
          Hide
          drulli Ulli Hafner added a comment -

          I see, but this is only in the UI validation code. The parser still does work even though an error is shown. Seems that I need to remove some duplicate code

          Show
          drulli Ulli Hafner added a comment - I see, but this is only in the UI validation code. The parser still does work even though an error is shown. Seems that I need to remove some duplicate code
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/GroovyParser.java
          src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
          http://jenkins-ci.org/commit/warnings-plugin/14b3ce92f80a51778b37e2eef44687897c14d562
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/GroovyParser.java src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java http://jenkins-ci.org/commit/warnings-plugin/14b3ce92f80a51778b37e2eef44687897c14d562 Log: [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          warnings
          http://jenkins-ci.org/commit/analysis-suite-plugin/cb1d3e4b9c59fc693064952ba2c1c8b5dce495b1
          Log:
          [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: warnings http://jenkins-ci.org/commit/analysis-suite-plugin/cb1d3e4b9c59fc693064952ba2c1c8b5dce495b1 Log: [FIXED JENKINS-21569] Expose variable lineNumber also when validating the script.

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              jameshowe James Howe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: