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

Free style projects/jobs not sending email notification if removed the slave with post build action groovy script enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • core
    • None
    • Jenkins 2.62
      Groovy 1.29
      Groovy Post build 2.3.1
      Docker plugin 0.16.2


      Hi All,

      I have my jenkins server set up such that we are deploying our jobs inside spawned docker containers. I have templates( for each docker image) created for each of the Docker Cloud instance inside my " http://serveripaddress:8080/configure",

      And for each of my jobs , i use a groovy post build step which deletes the instance of the docker container after the job finished execution.

      Post build groovy script is as below

      // This script will delete only the currently spawned docker container on vm as well as jenkins web UI
      import jenkins.model.Jenkins

      def x=manager.envVars['NODE_NAME']
      Jenkins.instance.slaves.each {
          if(it.name==x){
             it.getComputer().doDoDelete()
          }
      }

       

      Also have "Email notification" configured for each job . All the above job configurations were working smoothly -

      1) Post build groovy script was deleting currently spawned container allocated to the job

      2) Email notification was working wonderfully.

      All this was working smoothly on jenkins ver 2.1 , however post upgrading my jenkins to 2.62 and other default plugins upgrade which was suggested by default on the dashboard.

      Am getting  below errors for all the jobs :

      ERROR: Step ?E-mail Notification? failed: no workspace for job-name #build-num

      If i comment out the "post build action" - Groovy post build above , then the job passes successfully and email notification works wonderfully.

      Has anyone faced such error ( ERROR: Step ?E-mail Notification? failed: no workspace for job-name #build-num ) post upgrading Jenkins to 2.62 or by just upgrading the Groovy plugin to 2.0 help resolve this issue

      Job Build log error is below
      Started by user
      xxxxxxx
      Building remotely on
      xxxxxxxxx
      (xxxxxxxxxx) in workspace /home/jenkins/workspace/000_AAA_TEMPLATE
      [000_AAA_TEMPLATE] $ /bin/bash /tmp/jenkins356349421822671799.sh
      ERROR: Step ?E-mail Notification? failed: no workspace for 000_AAA_TEMPLATE #432
      Finished: FAILURE
      Whereas the jenkins.log shows below

      INFO: 000_AAA_TEMPLATE #432 main build action completed: SUCCESS
      INFO: Unable to identify the slave of 000_AAA_TEMPLATE #432 (class hudson.model.FreeStyleBuild)

       

      Any comments/thoughts on this would be helpful.

       

       

            davidvanlaatum David van Laatum
            amitkumar_ghatwal Amitkumar Ghatwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: