Instance cap configuration not honored for spot insances

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • Component/s: ec2-plugin
    • Environment:

      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"
                          }
                      }
                  }
              }
          }
      } 

            Assignee:
            FABRIZIO MANFREDI
            Reporter:
            Yaniv
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: