How can I get my current stage name in the pipeline

2,397 views
Skip to first unread message

Ron Keidar

unread,
Nov 3, 2016, 5:17:26 AM11/3/16
to Jenkins Users
Hi 
I'm writing a new Jenkins function and I would like to get the current stage name that is running right now on the pipeline.
for example:


stage("Stage1"){
    def current_stage = getCurrentStageName()
    echo "I'm in satage: $current_stage"
}

Lee Meador

unread,
Nov 15, 2016, 2:53:44 PM11/15/16
to jenkins...@googlegroups.com
Just inside the squiggle braces, set a variable.

stage("Stage1"){
def current_stage = "Stage1"
echo "I'm in stage: $current_stage"
}

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/89c43598-1d80-475b-b7cb-9bc3759b2ec7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

ronke...@gmail.com

unread,
Nov 15, 2016, 9:04:54 PM11/15/16
to jenkins...@googlegroups.com
Thanks allot 

Sent from my iPhone
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/1YdAJY9vATA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA4vtDRUp6nuFGAZbmPAnUmruF64QxY2AD914tXZc4%3DdgAJEbw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages