Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-75115

Agent pods get deleted 6 minutes after pipeline aborted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • kubernetes-plugin
    • None

      When I start and stop a pipeline quickly, the pipeline shows it has been aborted, but the agent pod still kept running and got deleted about 5 minutes later.

       

      Any jenkinsfile is able to reproduce this issue, here is a simple example:

       

      ```

       

      pipeline {
        agent any
        stages {
          stage('stage-zkk34') {
            agent none
            steps

      {         sleep(time: 10, unit: 'SECONDS')         echo 'sleep done'       }

          }

        }
      }

      ```

       

      Start a build, then quickly navigate to build page and stop this build. Refresh page and you can see this build has been aborted.

       

      But the agent pod was killed/terminated 6 minutes later.

      ```

      $ kubectl -n kubesphere-devops-worker get pod -w
      NAME         READY   STATUS    RESTARTS   AGE
      base-8krf0   0/2     Pending   0          0s
      base-8krf0   0/2     Pending   0          0s
      base-8krf0   0/2     ContainerCreating   0          0s
      base-8krf0   2/2     Running             0          2s
      base-8krf0   2/2     Terminating         0          6m12s
      base-8krf0   0/2     Terminating         0          6m43s
      base-8krf0   0/2     Terminating         0          6m43s
      base-8krf0   0/2     Terminating         0          6m43s
      base-8krf0   0/2     Terminating         0          6m43s

      ```

       

      Since 6 minutes is a long time, the build actually has completed successfully. Stopping build actually failed.

       

      I don't know if this is a jenkins or kubernetes plugin bug, or is there any fix or workaround?

       

            Unassigned Unassigned
            stoneshiyunify stone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: