All parts of the script are like this:

try {
   // do something
} catch(all) {
    def message="...."
    notifySlack(message)
    throw new Exception(message)
}

// finally
notifySlack("Done!")
currentBuild.result = "SUCCESS"


I never see a message from the "catch" but I see the "Done!". All processes 
of the pipeline are fine:
 - war file created
 - Docker container/images created and/or deleted
 - Upload of things in S3 bucket
 - ...

The build is red. To be more precise ... the stage show in deep red is this 
one:

 stage 'Remove Build Image'
            try {
                removeBuildImage(WORKSPACE)
            } catch (all) {
                def message="Failed to remove build image!"
                notifySlack(message)
                // Does not make sense to continue
                throw new Exception(message)
            }


The slack message is not shown ... and in the logs:

*06:58:21* Deleted: 
sha256:aa4e7c1557f3bfab99c3e233d6be5647061d81fdc5b570921eec0d7cc033c2dd*06:58:21*
 Deleted: 
sha256:6a74d75c87b71c9d8e6e6988baf48cc2ed2b7fb6b4ea87cb5d602c4b224a0483*06:58:21*
 remove_image.sh :: Success: Docker build image removed


That's the last "echo" of that script. In the Jenkins file the function 
looks like this

  4 // Remove the Docker image for the build.                               
                                      
  5 def removeBuildImage(WORKSPACE) {                                       
                                      
  6     sh "WORKSPACE=$WORKSPACE $WORKSPACE/cicd/scripts/remove_image.sh 
build"                                   
  7 }        

I don't see the moment how to proceed. If I could adjust the pipeline to 
debug mode that it does print
its state so I could see at which point it "believes" that something has 
been going wrong ...

Any ideas what I could do?


On Tuesday, August 2, 2016 at 1:42:58 PM UTC+2, Baptiste Mathus wrote:
>
> Maybe you could share a gist of your script, showing the issue you're 
> having and what you want/expect? Will probably be more efficient than just 
> speaking about that code?
>
> Le 2 août 2016 12:39 PM, <thomas....@teamaol.com <javascript:>> a écrit :
>
>> I still have the issue with a succeeded pipeline that shows red.
>> Even when I say: currentBuild.result = "SUCCESS" ... at the end
>> No trace all steps are executed fine .... just the state is wrong.
>>
>> Using now Jenkins 2.14
>>
>> On Thursday, July 21, 2016 at 11:53:41 AM UTC+2, thomas....@teamaol.com 
>> wrote:
>>>
>>> We are working with Jenkins 2.13 the moment.
>>> We have a ci/cd pipeline with all stages green but the build itself is 
>>> red.
>>>
>>> From the log I cannot see anything which gives me a hint.
>>> Also all deployed stuff is fine and the final slack notification were 
>>> also fine!
>>>
>>> Every "sh" call is wrapped by the try ... catch ... throw ... so if 
>>> there would
>>> be an error the pipeline should stop at the stage where the error 
>>> appears.
>>>
>>> I wrote manually a jenkinsfile but ... as you can guess ... all fine.
>>>
>>> I didn't found a way to check the build state. When is this set?
>>> Can I do an echo of current state so I could add some output?
>>>
>>> currentBuild.result prints null, so obviously this is not used.
>>> Any help, proposes?
>>>
>>> Kind regards,
>>> Thomas
>>>
>> -- 
>> 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-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/deca56cf-72e0-4735-a570-e59aad7b79e7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/deca56cf-72e0-4735-a570-e59aad7b79e7%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3941d3c2-7149-4552-aa87-52c34e4e3365%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to