Ah! So you're using the fact that if one reaches the end of the stage, the stage has succeeded... I feel stupid - I was trying to get hold of the stage result through the java api...
Thanks! I'll try it out! On Fri, Apr 7, 2017 at 1:14 PM, Idan Adar <[email protected]> wrote: > You could something like the following, where if all actions have worked, > it'll simply read the slack action and perform it. > > stage ("Publish CF app") { > environment { > JENKINSBOT = credentials('...') > } > > when { > branch "develop" > } > > steps { > script { > STAGE_NAME = "Publish CF app" > } > > // Login and push > sh "cf api ..." > sh "cf login ... -u $JENKINSBOT_USR -p $JENKINSBOT_PSW" > sh "cf push" > > slackSend ( > color: '#199515', > message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER> > passed successfully." > ) > } > } > > You could also use the POST directive inside a stage: > > stage { > steps { > ... > } > > post { > success { > slack... > } > failure { > slack... > } > } > } > > Now, once a stage fails, the whole job fails, so you don't really need to > handle the failure in each stage. Instead you can also use POST globally: > And as you can see in my first example, I basically set a "STAGE_NAME" in > each stage and use it in the failure directive globally > > stages { > stage { > steps { > > } > } > > > stage { > steps { > > } > } > > > post { > success { > > } > failure { > slackSend ( > color: '#F01717', > message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, > '$STAGE_NAME' stage failed." > ) > } > } > } > > > > On Friday, April 7, 2017 at 1:41:29 PM UTC+3, Per Ostman wrote: >> >> Hi! >> >> I'm trying to figure out how to get hold of the result of a stage in a >> pipeline job to report progress/status in e g slack as the pipeline stages >> execute. >> >> Does anyone have any pointers to how to accomplish this? >> >> /P >> > -- > 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/FZqiw3_LZ5M/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jenkinsci-users/0c9ade5c-4541-4711-bd49-7cd5f8add805%40googlegroups. > com > <https://groups.google.com/d/msgid/jenkinsci-users/0c9ade5c-4541-4711-bd49-7cd5f8add805%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- All the best, /Per "If we have data, let’s look at data. If all we have are opinions, let’s go with mine." —Jim Barksdale *Per Östman* Manager, Quality Control *O* +46 31 7504897 | *M* +46 766 477602 | *E* *[email protected] <[email protected]>* | *TIBCO Software* | Första Långgatan 26 41328 Gothenburg, Sweden | www.tibco.com | The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CACiEL_KffYKUk0Mmmj07iTP7KV7j24QkVzBEw6JaqoYzLbR-sQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
