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

Instance cap configuration not honored for spot insances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ec2-plugin
    • None

      The instance cap for an AMI configuration is ignored when spot instances turned on, causing EC2 plugin to create new spots instances for jobs in queue above the instance cap limit instead of keeping the number of agents (spot and on-demand) for the AMI configuration up to the instance cap limit.

      When on-demand instances are used (e.g spot instances off), the instance cap is honored by the EC2 Plugin.

      Our current workaround is to turn off the spot instances option until this issue is fixed.

       

      How to recreate:

      1. Turn on spot instances option on Cloud configuration, and set the instance cap limit for that configuration to 2.
      2. Create a pipeline job that runs sleep 120 in 4 parallel stages, using the agent configuration created in step 1.

      3. Run the job and check the Build executor staut on the main Jenkins page. If spot instances are available, Jenkins will start 4 agents, above the instance cap limit of 2.

      Example pipeline job for #2:

      pipeline {
          agent none
          
          stages {
              stage("run") {
                  parallel {
                      stage("1") {
                          agent { label "mylabel" }
                          steps {
                              sh "sleep 120"
                          }
                      }
                      stage("2") {
                          agent { label "mylabel" }
                          steps {
                              sh "sleep 120"
                          }
                      }
                      stage("3") {
                          agent { label "mylabel" }
                          steps {
                              sh "sleep 120"
                          }
                     }
                      stage("4") {
                          agent { label "mylabel" }
                          steps {
                              sh "sleep 120"
                          }
                      }
                  }
              }
          }
      } 

            thoulen FABRIZIO MANFREDI
            yanivyam Yaniv
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: