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 <[email protected]>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/bb0ee8b0-0775-4a53-ad60-46f6e2491bffn%40googlegroups.com.