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

Doc: Change recommendations on EXECUTOR-NUMBER usage

XMLWordPrintable

      Current suggested P4-plugin workspace naming convention is:

         jenkins-${NODE_NAME}${JOB_NAME}${EXECUTOR_NUMBER}

      This ensures that every workspace on every node for every job is unique for each executor. This stops parallel jobs using the same area of disk and overwriting each other's files.

      This causes two problems:

      (1) EXECUTOR_NUMBER is unreliable - JENKINS-48882

      (2) If the job setting 'Execute concurrent builds if necessary' is not ticked you will get different workspace names for the same physical area of disk (same Jenkins 'workspace' path). When the Jenkins servers uses different executors the workspace name used is different so will cause different number of files to be synced.  For example:

      • Build 1 of MyJob starts and completes - system uses jenkins-Node1-MyJob-0. This sync's files up to changelist 1234. This uses the area on disk /ws/MyJob.
      • Build 1 of AnotherJob starts using executor 0.
      • Build 2 of MyJob starts and completes - system uses jenkins-Node1-MyJob-1. This sync's files up to changelist 1300. This uses the area on disk /ws/MyJob.
      • Build 1 of AotherJob finishes.
      • Build 3 of MyJob starts and completes - system uses jenkins-Node1-MyJob-0. This again sync's files up to changelist 1300. This uses the area on disk /ws/MyJob.

      I propose that we drop ${EXECUTOR_NUMBER} from the default naming convention provided by Jenkins Freestyle jobs and the syntax generator, the document the use of '${EXECUTOR_NUMBER}' in the bubble text and documentation.

       

      Reproduction steps

      (1) Create a Jenkins Freestyle job called Job1 that uses p4-plugin to sync files using the workspace name ' jenkins-${NODE_NAME}${JOB_NAME}${EXECUTOR_NUMBER}'. Do not tick the job option 'Execute concurrent builds if necessary'.

      (2) Create a second Freestyle job called Job2 that includes a build step that sleeps for 100 seconds. For example a Linux shell script that runs 'sleep 100'.

      (3) Run Job1 and wait until it completes.

      (4) Run Job2

      (5) Run Job1 while Job2 is still running.

      (6) Compare workspace name and location on disk used for build 1 and 2 of Job1. The workspace 'Root' will be the same but the workspace name will differ. For example:

      $ p4 -Ztag -F "%client% %Root%" clients -e "jenkins-master-Job1-*"
      jenkins-master-Job1-0 /var/lib/jenkins/workspace/Job1
      jenkins-master-Job1-1 /var/lib/jenkins/workspace/Job1
      

            p4kevin Kevin Williamson
            p4karl Karl Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: