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

Columns with value of a variable from script

    Details

    • Similar Issues:

      Description

      In a "view" page, allowing a column to take a value from the script that's being executed.

      (That value could be transferred from the script to jenkins via the environment variables.)

        Attachments

          Activity

          Hide
          fredg Fred G added a comment -

          Hi,

          Can you give an example of what kind of value you would like to see in such a column?
          Please also keep in mind, that without additional work such a value would only be displayed as long as the job is executed.
          So most of the time the column would be empty.

          Regards,

          Fred

          Show
          fredg Fred G added a comment - Hi, Can you give an example of what kind of value you would like to see in such a column? Please also keep in mind, that without additional work such a value would only be displayed as long as the job is executed. So most of the time the column would be empty. Regards, Fred
          Hide
          dor_lan dor cohen added a comment -

          Hi Fred,

          There could be anything in it, either a string or number (integer/float).
          The value would be decided by the script.

          Is it possible to make the value to stay after that the job has been completed?
          The value that is displayed should be taken from the last job being executed.

          Thank you.

          Best regards,
          Dor.

          Show
          dor_lan dor cohen added a comment - Hi Fred, There could be anything in it, either a string or number (integer/float). The value would be decided by the script. Is it possible to make the value to stay after that the job has been completed? The value that is displayed should be taken from the last job being executed. Thank you. Best regards, Dor.
          Hide
          fredg Fred G added a comment -

          Hi,
          I was pretty sure that it would be either a string or a number.
          What I meant was rather the meaning of the value, for example a certain build parameter or return value of a script.
          => Can you give a practical use case?

          Regards,

          Fred

          Show
          fredg Fred G added a comment - Hi, I was pretty sure that it would be either a string or a number. What I meant was rather the meaning of the value, for example a certain build parameter or return value of a script. => Can you give a practical use case? Regards, Fred
          Hide
          dor_lan dor cohen added a comment -

          hehe yeah that's pretty obvious =D

          At first I thought of maybe setting one of the environment variables, but probably Jenkins can't read it when the script ends.

          So now I'm thinking of taking a value that is actually the contents of a file, who's path will be decided in the job's parameters.
          For example, maybe it could be taken from "./workspace/reports/buildParameterName.txt" and later that file would be transferred to the archive directory.

          The path to the file should be either absolute or relative.

          The value of "buildParameterName" would be set in the "Edit view" page, as part of the absolute/relative path.
          When clicking on the button "Add column", an option of "Contents of file" should be displayed and it will determine the path of the file.

          I'm yet to have a complete familiarity with Jenkins, so maybe you'll see a better approach.

          Show
          dor_lan dor cohen added a comment - hehe yeah that's pretty obvious =D At first I thought of maybe setting one of the environment variables, but probably Jenkins can't read it when the script ends. So now I'm thinking of taking a value that is actually the contents of a file, who's path will be decided in the job's parameters. For example, maybe it could be taken from "./workspace/reports/buildParameterName.txt" and later that file would be transferred to the archive directory. The path to the file should be either absolute or relative. The value of "buildParameterName" would be set in the "Edit view" page, as part of the absolute/relative path. When clicking on the button "Add column", an option of "Contents of file" should be displayed and it will determine the path of the file. I'm yet to have a complete familiarity with Jenkins, so maybe you'll see a better approach.
          Hide
          fredg Fred G added a comment -

          Sorry, but this sounds overly complicated. How is this different from a normal build parameter wrapped in a file?

          Without knowing more about the "Why?" it's really hard to find a good approach.
          You still did not provide a reasonable use case for the requested column.

          Show
          fredg Fred G added a comment - Sorry, but this sounds overly complicated. How is this different from a normal build parameter wrapped in a file? Without knowing more about the "Why?" it's really hard to find a good approach. You still did not provide a reasonable use case for the requested column.
          Hide
          dor_lan dor cohen added a comment -

          Hi Fred,

          By "a normal build parameter wrapped in a file", do you mean to the field "File Parameter" that appear when clicking "Add parameter" in the configuration page of a build?
          If so, then this option isn't good because that I provide the data (the file with it's contents) from outside of the script.
          The feature that I ask here tries to do the exact opposite - provide a piece of data that is created/calculated by the script, which is to be displayed in a column under a "view" page.

          The "Why?" is that currently nothing allows the script to create data and display it under one of the columns in one of the "Views" in Jenkins.

          Use case:
          1. Run job "Foo" that is in view "Bar"
          2. The script extracts a version number from a hardware (e.g. Arduino board or something similar)
          3. The version number is written to a file in the workspace
          4. At the end of the job, the number is displayed in one of the columns under the view named "Bar"

          (Each time that the job "Foo" is executed, the number will be taken from the last build)

          I hope that I answered properly, if not please ask and I'll try to elaborate!
          Thank you.

          Regards,
          Dor.

          Show
          dor_lan dor cohen added a comment - Hi Fred, By "a normal build parameter wrapped in a file", do you mean to the field "File Parameter" that appear when clicking "Add parameter" in the configuration page of a build? If so, then this option isn't good because that I provide the data (the file with it's contents) from outside of the script. The feature that I ask here tries to do the exact opposite - provide a piece of data that is created/calculated by the script, which is to be displayed in a column under a "view" page. The "Why?" is that currently nothing allows the script to create data and display it under one of the columns in one of the "Views" in Jenkins. Use case: 1. Run job "Foo" that is in view "Bar" 2. The script extracts a version number from a hardware (e.g. Arduino board or something similar) 3. The version number is written to a file in the workspace 4. At the end of the job, the number is displayed in one of the columns under the view named "Bar" (Each time that the job "Foo" is executed, the number will be taken from the last build) I hope that I answered properly, if not please ask and I'll try to elaborate! Thank you. Regards, Dor.
          Hide
          fredg Fred G added a comment -

          In the foreseeable future I won't have time to work on this, but I'll happily accept patches/contributions/pull requests for this issue.

          Show
          fredg Fred G added a comment - In the foreseeable future I won't have time to work on this, but I'll happily accept patches/contributions/pull requests for this issue.

            People

            • Assignee:
              dor_lan dor cohen
              Reporter:
              dor_lan dor cohen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: