Is pipeline timeout suppose to work?

2.262 прегледа
Пређи на прву непрочитану поруку

jer...@bodycad.com

непрочитано,
7. 7. 2017. 15:46:177.7.17.
– Jenkins Users

HI,
is the timeout can be used to prevent the warnings publisher and bat hang even possible?

stage('Build')
{
timeout(60)
{
bat returnStatus: false, script: "\"${bcad.msbuild_current}\" ${bcad.msbuild_solution_name} ${bcad.msbuild_default_arg} /t:Build"
step([$class: 'WarningsPublisher', canRunOnFailed: true, consoleParsers: [[parserName: 'MSBuild']]])
}
}


and it have hang for over 3 hours now :-(
I was hoping to at least be able to stop those nasty hanging build and make them failed but doesn't seem to work. maybe I'm using timeout wrongly or the default units is not min like the doc and example said???



Danny Rehelis

непрочитано,
7. 7. 2017. 15:59:307.7.17.
– Jenkins Users

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8e24ad7b-cb94-4505-8819-e1592c4f2b49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jer...@bodycad.com

непрочитано,
10. 7. 2017. 09:33:1610.7.17.
– Jenkins Users
When trying the 45 minutes units into the syntax helper (pipeline-syntax/ of the project) it display the following code:
timeout(45) {
    // some block
}

If I change the unit the syntax change like follow:
timeout(time: 45, unit: 'SECONDS') {
    // some block
}

So I will try with the following too see if it change something:
timeout(time: 45, unit: 'MINUTES') {
    // some block
}

The document seem to specify the timeout goes into the options block when using declarative pipeline (which I don't), but for normal pipeline I guess the //some block above is for any code block or is a block a specific type (stage, node...) ? This is unclear.
If this is any code block, it doesn't seem to work with either bat or steps warning publisher, which I cannot interrupt by cancelling the build into the GUI, so I guess the timeout may not cancel them either.

Jakub Pawlinski

непрочитано,
11. 7. 2017. 05:31:0811.7.17.
– Jenkins Users
I use this on pipeline level and it works fine there, haven't tried on stage level tho.

pipeline {
options {
timeout(time: 12, unit: 'HOURS')
timestamps()
}
...
}

jer...@bodycad.com

непрочитано,
11. 7. 2017. 16:57:4411.7.17.
– Jenkins Users
This is Declarative pipeline syntax (which I don't use), for non Declarative pipeline (which is what I have), I wonder if this work the same or where it can be used?

jer...@bodycad.com

непрочитано,
12. 7. 2017. 10:55:3312.7.17.
– Jenkins Users
I think I got my answer about it into the console log after a hang, I had to restart the jenkins service and got this as a result:

04:18:53 
04:18:53 Build succeeded.
04:18:53     0 Warning(s)
04:18:53     0 Error(s)
04:18:53
04:18:53 Time Elapsed 00:14:25.77
Waiting to resume part of Bodycad cpp projects » CAD_CPP_ContinuousBuild #172: JGMachine is offline
Waiting to resume part of Bodycad cpp projects » CAD_CPP_ContinuousBuild #172: JGMachine is offline
Ready to run at Wed Jul 12 10:50:34 EDT 2017
10:50:34 Timeout expired 5 hr 46 min ago
10:50:34 Cancelling nested steps due to timeout
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] echo
Error occurred during build:
[Pipeline] echo
java.lang.Exception: Resume after a restart not supported for non-blocking synchronous steps

the line: 
10:50:34 Timeout expired 5 hr 46 min ago
tell me that it cannot be used that way.

Kevin Chow

непрочитано,
10. 4. 2019. 17:27:3610.4.19.
– Jenkins Users
Hi Jer,

I'd like to followup if you figured out how to do timeout with Jenkins Scripted Pipeline. I'm looking into a solution to resolve it. 

I have something like but it doesn't work out for me.

timeout(5) {
node
("docker") {
sh
"""
//do something
"""

}
}



Thanks,

Kevin

Reinhold Füreder

непрочитано,
11. 4. 2019. 03:37:0011.4.19.
– jenkins...@googlegroups.com

Hi Kevin,

 

I have used “timeout” step in the past and as far as I can remember it worked as expected.

 

Note, however, that I may not have put the “node(…)” step inside the “timeout” step; not sure if that is of any relevance though…

 

HTH Reinhold

Одговори свима
Одговори аутору
Проследи
0 нових порука