It is intentional that pipeline jobs do not prevent a shutdown of the
Jenkins server.  They are allowed to continue running on the agent hosting
them even while the Jenkins server restarts.  They are "durable" across
Jenkins server restarts.

When the Jenkins server restarts and the agent is reconnected, the status
of the job is communicated to the Jenkins server.

Refer to https://jenkins.io/doc/book/pipeline/scaling-pipeline/
<https://jenkins.io/doc/book/pipeline/scaling-pipeline/#what-am-i-giving-up-with-this-durability-setting-trade-off>
for
more details on pipeline durability settings and the compromises that you
may choose to make between pipeline durability and pipeline performance.

On Mon, Jun 24, 2019 at 6:45 AM Remo Meier <remo.me...@adnovum.ch> wrote:

> Hi
>
> We make use of:
>
> command: ["java", "-jar", "/var/jenkins_home/war/WEB-INF/jenkins-cli.jar", 
> "-s", "http://127.0.0.1:8080/scheduler";, "safe-shutdown"]
>
>
> To shutdown a Jenkins server. According to the documentation
> https://support.cloudbees.com/hc/en-us/articles/216118748-How-to-Start-Stop-or-Restart-your-Instance-
> and
> https://stackoverflow.com/questions/10238604/how-to-shutdown-my-jenkins-safely/13527164
> this should be fine to wait for job completion before shutdown. But the
> command for terminates the server immediately and restarts the Job after.
> Our job is a regular flow/pipeline definition:
>
> <?xml version='1.1' encoding='UTF-8'?>
> <flow-definition plugin="workflow-job@2.24">
>     <actions/>
>     <description></description>
>     <keepDependencies>false</keepDependencies>
>     <properties>
>         
> <org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
>             <triggers>
>                 <hudson.triggers.TimerTrigger>
>                     <spec>0 3 * * *</spec>
>                 </hudson.triggers.TimerTrigger>
>             </triggers>
>         
> </org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
>     </properties>
>     <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" 
> plugin="workflow-cps@2.55">
>         <script>
>             node {
>                 stage('Run') {
>                     sh '''
>                         #!/usr/bin/env bash
>
>
>                         exec kubectl run ...
>
>                         ...
>                     '''
>                 }
>             }
>         </script>
>         <sandbox>true</sandbox>
>     </definition>
>     <triggers/>
>     <disabled>false</disabled>
> </flow-definition>
>
>
> It shows log entries like:
>
> Ready to run at Mon Jun 24 11:46:22 GMT 2019
> Resuming build at Mon Jun 24 11:50:56 GMT 2019 after Jenkins restart
> Waiting to resume part of demo-import #71: Finished waiting
>
>
> In this case it runs some shell scripts. The documentation does not
> mention the use of termination signals or anything that would maybe stop
> the job?
>
> Thank you, Regards Remo
>
> --
> 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/c3fece50-f8b2-41e1-a2f3-9f5a7ce1bb38%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/c3fece50-f8b2-41e1-a2f3-9f5a7ce1bb38%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Thanks!
Mark Waite

-- 
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/CAO49JtEbhi1drpiTSXKpSFicVJBeZ%2BPcoKVHV5Gj1efjnfpZYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to