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

Read Plastic Environment variables to update to database

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • influxdb-plugin
    • None

      I have seen the Git branch details are updated to the database with the plugin.

      I am using the plastic repository and please read the plastic environment variables and read the all like Branch; Changeset, etc., (all the plastic environment variables including users in terms fo mergebot)

          [JENKINS-67726] Read Plastic Environment variables to update to database

          Aleksi Simell added a comment -

          Hi krishna_1997,

          Have you tried sending that data as custom data?

          script {
              def my_custom_data = [:]
              my_custom_data["branch"] = env.Branch    // or whatever the env variable is called
              my_custom_data["changeset"] = env.Changeset    // or whatever the env variable is called
              // ...
              influxDbPublisher(selectedTarget: "my-target", customData: my_custom_data)
          }
          

          Aleksi Simell added a comment - Hi krishna_1997 , Have you tried sending that data as custom data ? script { def my_custom_data = [:] my_custom_data[ "branch" ] = env.Branch // or whatever the env variable is called my_custom_data[ "changeset" ] = env.Changeset // or whatever the env variable is called // ... influxDbPublisher(selectedTarget: "my-target" , customData: my_custom_data) }

          krishna added a comment -

          Hi aleksisimell,

          I have tried the custom data which you mentioned but because of it, the InfluxDB runs twice.
          1. The custom part which I gave will run at the post-build at always condition, but it won't have all the details which will the default InfluxDB update which provided more details and like builds message, last successful build For custom run is - old data, final default is updated if the latest build is a success, etc.,

          I am using InfluxDB in Grafana and I tried many things to add the queries also which didn't work as expected

          But if the InfluxDB pulls all the Jenkins environment variable things I have asked as changeset and branch which checkout happened or If any pipeline environments are configured it will be helpful

          or If any way I can configure this please help on it

          krishna added a comment - Hi aleksisimell , I have tried the custom data which you mentioned but because of it, the InfluxDB runs twice. 1. The custom part which I gave will run at the post-build at always condition, but it won't have all the details which will the default InfluxDB update which provided more details and like builds message, last successful build For custom run is - old data, final default is updated if the latest build is a success, etc., I am using InfluxDB in Grafana and I tried many things to add the queries also which didn't work as expected But if the InfluxDB pulls all the Jenkins environment variable things I have asked as changeset and branch which checkout happened or If any pipeline environments are configured it will be helpful or If any way I can configure this please help on it

          Aleksi Simell added a comment -

          Sorry for the slight delay. How are you running InfluxDB plugin? Have you set your Target to be a global listener? That's the only reason I can see why it would run twice, unless you specifically invoke it twice in your pipeline. The git data is retrieved from the build API and not from environment variables. You can add custom data to global listeners as shown in https://issues.jenkins.io/browse/JENKINS-62753.

          Aleksi Simell added a comment - Sorry for the slight delay. How are you running InfluxDB plugin? Have you set your Target to be a global listener? That's the only reason I can see why it would run twice, unless you specifically invoke it twice in your pipeline. The git data is retrieved from the build API and not from environment variables. You can add custom data to global listeners as shown in https://issues.jenkins.io/browse/JENKINS-62753 .

            aleksisimell Aleksi Simell
            krishna_1997 krishna
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: