Environment Variables in Jenkins Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Team,

How Can I get the Environment Variables that are created in a Jenkins Pipeline.

    environment {
        ENV_V_1 = "SASbv"
    }

For now when I try to use 

EnvVars environment = run.getEnvironment(listener);

It fetches only the Environment variables attached with the Jenkins Job.

Pointer to any code or link will be helpful.

Thanks,
Sourabh Jain
Maintainer - sumologic-publisher plugin

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a84644ef-21ba-43e7-a36a-f33d9386e431n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
On Mon, Aug 31, 2020 at 8:44 AM Sourabh Jain <[hidden email]> wrote:
> How Can I get the Environment Variables that are created in a Jenkins Pipeline.

If you mean from within a Pipeline step, you should use

stepContext.get(EnvVars.class)

which will look up variables defined in a particular context.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0Z%3DaLD%3DKiLD9WKbUZJ%2BVFHmugy8JEG8DL8Wc-nZrMjvA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Thanks for a quick response.

So the context is lost after the job is completed..rgt.

Thus, running "run.getEnvironment(listener);" does not give all the environment  variables when the job is completed and we try to fetch the code.

On Mon, Aug 31, 2020 at 7:49 PM Jesse Glick <[hidden email]> wrote:
On Mon, Aug 31, 2020 at 8:44 AM Sourabh Jain <[hidden email]> wrote:
> How Can I get the Environment Variables that are created in a Jenkins Pipeline.

If you mean from within a Pipeline step, you should use

stepContext.get(EnvVars.class)

which will look up variables defined in a particular context.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0Z%3DaLD%3DKiLD9WKbUZJ%2BVFHmugy8JEG8DL8Wc-nZrMjvA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQQG1NvEBStzE-6Mmu4S5Zc0f6achGLh%2BUbHB2RV2UaK9g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Also, is there a class which we can use, extend or implement which can be run by default for each stage in a Jenkins pipeline(without modifying the pipeline)?

On Mon, Aug 31, 2020 at 8:29 PM Sourabh Jain <[hidden email]> wrote:
Thanks for a quick response.

So the context is lost after the job is completed..rgt.

Thus, running "run.getEnvironment(listener);" does not give all the environment  variables when the job is completed and we try to fetch the code.

On Mon, Aug 31, 2020 at 7:49 PM Jesse Glick <[hidden email]> wrote:
On Mon, Aug 31, 2020 at 8:44 AM Sourabh Jain <[hidden email]> wrote:
> How Can I get the Environment Variables that are created in a Jenkins Pipeline.

If you mean from within a Pipeline step, you should use

stepContext.get(EnvVars.class)

which will look up variables defined in a particular context.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0Z%3DaLD%3DKiLD9WKbUZJ%2BVFHmugy8JEG8DL8Wc-nZrMjvA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,



--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQQ9D4c1R4dtTpUqSt1jSLqpYxQ-VAk6cEgz7qin0pwkxg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
On Mon, Aug 31, 2020 at 11:05 AM Sourabh Jain <[hidden email]> wrote:
> is there a class which we can use, extend or implement which can be run by default for each stage in a Jenkins pipeline(without modifying the pipeline)?

https://javadoc.jenkins.io/plugin/workflow-api/org/jenkinsci/plugins/workflow/flow/GraphListener.html

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1y0-V3freUNpf05r6Dn7%2BgTfGCYb2HX3NccvyFvqGTWw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Jesse,

I have a pipeline as below

/**
 * [Pipeline home: BUILD-JENKINS]
 * Required named parameters: assemblyGroup
 */
pipeline {
    agent none
    options {
      timeout(time: 2, unit: 'HOURS')
    }
    stages {
      stage("[Release]") {
          environment {
                Sumo_event_type = "bar"
            }
        stages {
          stage("Prepare") {
            agent any
            steps {
              script {
                echo "Performing Git Checkout $Sumo_event_type"
              }
            }
          }
        }
      }
      stage("[Deploy]") {
        stages {
          stage("Testing") {
            agent any
            steps {
              script {
                echo "building using maven"
                sumoAgrEnv("sourabh-CheckIn", "check")
              }
            }
          }
        }
      }
    }
}

def sumoAgrEnv(String assemblyGroup, String branch){
    env.Sumo_GIT_BRANCH = branch
    env.Sumo_SERVICE_NAME = assemblyGroup
    if (env.Sumo_GIT_BRANCH == 'master') {
        env.Sumo_SERVICE_NAME = 'test-sourabh'
    } else {
       env.Sumo_SERVICE_NAME = 'test' +  env.SUMO_GIT_BRANCH
    }
}


As per the pipeline
- In stage "Release" I am creating environment as Sumo_event_type which should be available to only Release and prepare stage.
- In "Testing" I am creating env. which should be only available to testing stage.

So, is there an API that I can use to fetch the environment variables at each stage level?
On Monday, August 31, 2020 at 10:54:46 PM UTC+5:30 Jesse Glick wrote:
On Mon, Aug 31, 2020 at 11:05 AM Sourabh Jain <[hidden email]> wrote:
> is there a class which we can use, extend or implement which can be run by default for each stage in a Jenkins pipeline(without modifying the pipeline)?

https://javadoc.jenkins.io/plugin/workflow-api/org/jenkinsci/plugins/workflow/flow/GraphListener.html

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/bb0ee8b0-0775-4a53-ad60-46f6e2491bffn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
Not exactly sure what you are asking for. API from a plugin? Defining
a step? Some other kind of listener?

BTW do not use

env.KEY = value

Use the `withEnv` step.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr13YjN70CHeBcJzLbN24iyr0tDL1iqUdHLSUrUkLyNyWA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Jesse,

Thanks for suggestions.

I will use withenv or environment block to set environment variables.

But how to access the class which implements graphlistener class? I tried using run.getAction(EnvActionImpl.class); but it does not have the environment variables.

Please advise.

On Mon, Dec 14, 2020 at 10:23 PM Jesse Glick <[hidden email]> wrote:
Not exactly sure what you are asking for. API from a plugin? Defining
a step? Some other kind of listener?

BTW do not use

env.KEY = value

Use the `withEnv` step.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr13YjN70CHeBcJzLbN24iyr0tDL1iqUdHLSUrUkLyNyWA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQQTHHXvKJoWTiCvGiNm%2BN-HWMEKOy%3Dt-BwqC3YkYHY77w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
On Tue, Dec 15, 2020 at 2:15 AM Sourabh Jain <[hidden email]> wrote:
I tried using run.getAction(EnvActionImpl.class); but it does not have the environment variables.

No, do not use that. It would only have global environment variables (and not even all of those). `StepContext.get(EnvVars.class)` is used from within a step implementation to access contextual variables.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2-dgnKZdcUoNR1QO1U1YDXynkOoiJWnTxWuJr-Muhj%3Dg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Jesse,

Interesting, but do the flownode object in graph listener have the step context?

On Tue, 15 Dec 2020, 22:14 Jesse Glick, <[hidden email]> wrote:
On Tue, Dec 15, 2020 at 2:15 AM Sourabh Jain <[hidden email]> wrote:
I tried using run.getAction(EnvActionImpl.class); but it does not have the environment variables.

No, do not use that. It would only have global environment variables (and not even all of those). `StepContext.get(EnvVars.class)` is used from within a step implementation to access contextual variables.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2-dgnKZdcUoNR1QO1U1YDXynkOoiJWnTxWuJr-Muhj%3Dg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQTNNTKcGCmxYeXTJf57_JMkaMn3%3DXNqDMmGw4qXfrjkZw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
On Tue, Dec 15, 2020 at 1:01 PM Sourabh Jain <[hidden email]> wrote:
> do the flownode object in graph listener have the step context?

No. There is a `StepListener` that does, but this smells like the
wrong approach to whatever problem it is you are trying to solve,
which you have never explained.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0CXWP8h2Ldc70WaBo6w7O4P9doz3ocssZkTy295SJCjw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Jesse,

The problem we have is to send some data(all environment variables, global or local) after each stage is completed in a jenkins Pipeline.

So, we are using GraphListener to listen to every stage end and then send env variables to a HTTP url.

But we are not getting all environment variables as explained previously.

I hope the above helps.

On Wed, Dec 16, 2020 at 1:59 AM Jesse Glick <[hidden email]> wrote:
On Tue, Dec 15, 2020 at 1:01 PM Sourabh Jain <[hidden email]> wrote:
> do the flownode object in graph listener have the step context?

No. There is a `StepListener` that does, but this smells like the
wrong approach to whatever problem it is you are trying to solve,
which you have never explained.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0CXWP8h2Ldc70WaBo6w7O4P9doz3ocssZkTy295SJCjw%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQRg9Q59mW4BTfH8uuSoQZ%2BhmK-auR6Ln0-HXt2wqKeEwA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Björn Pedersen
This seems flawed in 2 ways:
 1) As a stage may contain many steps the env vars at the end of the stage may not be what the main workload saw
   

      stage ('xxx') {
           withEnv(XXX=1) {
                   do work
           }
         withEnv(XXX=2) {}
      } <== XXX has a non-interesting value

2) Security: The collection mechanism needs to carefully filter all 'sensitive' variables (akin to https://www.jenkins.io/security/advisory/2018-02-26/#SECURITY-248, 
see  also https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#interpolation-of-sensitive-environment-variables)
 

[hidden email] schrieb am Mittwoch, 16. Dezember 2020 um 06:31:37 UTC+1:
Hi Jesse,

The problem we have is to send some data(all environment variables, global or local) after each stage is completed in a jenkins Pipeline.

So, we are using GraphListener to listen to every stage end and then send env variables to a HTTP url.

But we are not getting all environment variables as explained previously.

I hope the above helps.

On Wed, Dec 16, 2020 at 1:59 AM Jesse Glick <[hidden email]> wrote:
On Tue, Dec 15, 2020 at 1:01 PM Sourabh Jain <[hidden email]> wrote:
> do the flownode object in graph listener have the step context?

No. There is a `StepListener` that does, but this smells like the
wrong approach to whatever problem it is you are trying to solve,
which you have never explained.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/e16c9622-afd2-4111-9d3c-b8fdc88c1b59n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Yes, for security reasons we will only send the env variables that will start with some prefix like Sumo_, others will be discarded.

Also, even if a stage has lot of env variables it will not matter to us, as we would like to send all env variables prefixed with Sumo_ in that particular stage.

On Wed, Dec 16, 2020 at 5:11 PM 'Björn Pedersen' via Jenkins Developers <[hidden email]> wrote:
This seems flawed in 2 ways:
 1) As a stage may contain many steps the env vars at the end of the stage may not be what the main workload saw
   

      stage ('xxx') {
           withEnv(XXX=1) {
                   do work
           }
         withEnv(XXX=2) {}
      } <== XXX has a non-interesting value

2) Security: The collection mechanism needs to carefully filter all 'sensitive' variables (akin to https://www.jenkins.io/security/advisory/2018-02-26/#SECURITY-248
 

[hidden email] schrieb am Mittwoch, 16. Dezember 2020 um 06:31:37 UTC+1:
Hi Jesse,

The problem we have is to send some data(all environment variables, global or local) after each stage is completed in a jenkins Pipeline.

So, we are using GraphListener to listen to every stage end and then send env variables to a HTTP url.

But we are not getting all environment variables as explained previously.

I hope the above helps.

On Wed, Dec 16, 2020 at 1:59 AM Jesse Glick <[hidden email]> wrote:
On Tue, Dec 15, 2020 at 1:01 PM Sourabh Jain <[hidden email]> wrote:
> do the flownode object in graph listener have the step context?

No. There is a `StepListener` that does, but this smells like the
wrong approach to whatever problem it is you are trying to solve,
which you have never explained.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/e16c9622-afd2-4111-9d3c-b8fdc88c1b59n%40googlegroups.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQR3VFibM-WHgxEnYTLLw-v7TcWH%2BcFN7nWHV2XXceHOEQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
In reply to this post by Sourabh Jain
On Wed, Dec 16, 2020 at 12:31 AM Sourabh Jain <[hidden email]> wrote:
send some data(all environment variables, global or local) after each stage is completed in a jenkins Pipeline.

I do not believe there is any supported way to do this. Environment variables are intended as an implementation detail in particular blocks, for use solely by steps, not exposed as metadata in the flow graph. You will need to rethink your design at a higher level. Again, from your messages I cannot offer real advice, because you are describing what you are attempting to do but not what user problem you are attempting to solve or why you selected this approach.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1Wk4m2b6tK-oZnfddZKZ5WP1vcNURYWt7nUyMp3LcDNA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Yes, we ask our user to send a deploy event or build event (based on a task performed in an stage). We already have sumoupload function that can be used as a step to send the map (which is mostly env variables) to Sumo Logic.

What we were trying to achieve is to remove the overhead of calling the sumoupload step and identifying a way where plugin can send the same data after the stage is complete.

I hope the above helps.

On Wed, Dec 16, 2020 at 5:31 PM Jesse Glick <[hidden email]> wrote:
On Wed, Dec 16, 2020 at 12:31 AM Sourabh Jain <[hidden email]> wrote:
send some data(all environment variables, global or local) after each stage is completed in a jenkins Pipeline.

I do not believe there is any supported way to do this. Environment variables are intended as an implementation detail in particular blocks, for use solely by steps, not exposed as metadata in the flow graph. You will need to rethink your design at a higher level. Again, from your messages I cannot offer real advice, because you are describing what you are attempting to do but not what user problem you are attempting to solve or why you selected this approach.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1Wk4m2b6tK-oZnfddZKZ5WP1vcNURYWt7nUyMp3LcDNA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQS%2BoZ1ZMQeX3DcUc_roK1gde5v6NuaEt5%3DqnAO3F0Sa_A%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
On Wed, Dec 16, 2020 at 7:36 AM Sourabh Jain <[hidden email]> wrote:
We already have sumoupload function that can be used as a step to send the map (which is mostly env variables) to Sumo Logic.

What we were trying to achieve is to remove the overhead of calling the sumoupload step and identifying a way where plugin can send the same data after the stage is complete.

That clears things up, yes. You cannot do this. Be transparent and send events if and when your step is called.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3M%3Dub6-rasq3PieXy1%2B-WV%3Dcc%2B46-7i46Mu9k_D41DFA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Thanks Jesse for clarifcation.

On Wed, Dec 16, 2020 at 6:19 PM Jesse Glick <[hidden email]> wrote:
On Wed, Dec 16, 2020 at 7:36 AM Sourabh Jain <[hidden email]> wrote:
We already have sumoupload function that can be used as a step to send the map (which is mostly env variables) to Sumo Logic.

What we were trying to achieve is to remove the overhead of calling the sumoupload step and identifying a way where plugin can send the same data after the stage is complete.

That clears things up, yes. You cannot do this. Be transparent and send events if and when your step is called.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3M%3Dub6-rasq3PieXy1%2B-WV%3Dcc%2B46-7i46Mu9k_D41DFA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQSSxwKNSC4Ve_9cM1v37-VOpzmJ4FNf4j4h3J_HDOqBcg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Sourabh Jain
Hi Jesse,


It is a small file to read from step context, identify parent stage and gather the data. Can you please give it a quick look to see if everything is in order?

On Wed, Dec 16, 2020 at 7:06 PM Sourabh Jain <[hidden email]> wrote:
Thanks Jesse for clarifcation.

On Wed, Dec 16, 2020 at 6:19 PM Jesse Glick <[hidden email]> wrote:
On Wed, Dec 16, 2020 at 7:36 AM Sourabh Jain <[hidden email]> wrote:
We already have sumoupload function that can be used as a step to send the map (which is mostly env variables) to Sumo Logic.

What we were trying to achieve is to remove the overhead of calling the sumoupload step and identifying a way where plugin can send the same data after the stage is complete.

That clears things up, yes. You cannot do this. Be transparent and send events if and when your step is called.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/CDKvVuClyJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3M%3Dub6-rasq3PieXy1%2B-WV%3Dcc%2B46-7i46Mu9k_D41DFA%40mail.gmail.com.


--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,



--
Best Regards,
Sourabh Jain
8408019626
Integration Engineer, APP DEV team,

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CACHaJQTZyUoUwNLbo51Y58LKBzUw-j%3DW_E8pP%3D_Sfqe3BoNT_Q%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment Variables in Jenkins Plugin

Jesse Glick-4
From a quick glance it seems OK. A `Run` can be gotten from a `StepContext` BTW.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2qhZd9a4s21cgqS_RfHfK6GZGWZ584BH96bFduaiCp0A%40mail.gmail.com.