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

Add support for environment variables

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • 1.23

      Add the ability to use environment variables for the Custom Prefix and Custom Project Name.  I'm trying to make a job that haves a parameter variable unique to a person using it, and I'd like that variable to be added as the prefix tag to the InfluxDB also, so the user can filter on their data in the database.  This makes it more dynamic for having multiple users of the same Jenkins job.

      See https://stackoverflow.com/questions/30512887/variable-substitution-in-jenkins-plugin for some details.

      My thought is that adding the following lines to the beginning of InfluxDbPublisher.java:perform()

      final EnvVars env = build.getEnvironment(listener);

      String expandedCustomPrefix = env.expand(customPrefix);

      String expandedCustomProjectName = env.expand(customProjectName);

      Then use the new expanded variables for the rest of the function.I don't exactly know how to get the build and listener variables correct, but the link above should help.

            aleksisimell Aleksi Simell
            dacboy David Sabin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: