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

mode should default to NORMAL when absent

    XMLWordPrintable

Details

    • Evergreen - Milestone 2
    • ec2-plugin 1.40

    Description

      When configuring an EC2 cloud using CasC, one must explicitly set mode so that the Cloud actually is usable.

      Here is the working yaml

      ---
      jenkins:   clouds:     - amazonEC2:
              cloudName: "ec2"
              instanceCapStr: 20
              zone: "us-east-1"
              useInstanceProfileForCredentials: true
              privateKey: "${PRIVATE_KEY}"
              templates:           - description: "EC2 Agent"
                  ami: "ami-0c6bb742864ffa3f3"
                  labels: "agent"
                  type: "T2Xlarge"
                  remoteFS: "/home/ec2-user"
                  remoteAdmin: "ec2-user"
                  ################            
                  # FIXME: without this, the whole setup will look like it's not even configured
                  mode: NORMAL 
      

      Expected behaviour

      If mode is not specified, it should default to NORMAL. Or if really we want to make it required, this should fail fast when absent, not stay null and make the whole settings broken.

      I had to run the code through a debugger to actually understand what was going on.

      Attachments

        Activity

          batmat Baptiste Mathus created issue -
          batmat Baptiste Mathus made changes -
          Field Original Value New Value
          Priority Minor [ 4 ] Major [ 3 ]
          batmat Baptiste Mathus made changes -
          Description When configuring an EC2 cloud using CasC, one must explicitly set {{userData}} to avoid getting an NPE during provisioning.

          Here is the working yaml
          {code:yaml}
          ---
          jenkins:
            clouds:
              - amazonEC2:
                  cloudName: "ec2"
                  instanceCapStr: 20
                  zone: "us-east-1"
                  useInstanceProfileForCredentials: true
                  privateKey: "${PRIVATE_KEY}"
                  templates:
                    - description: "EC2 Agent"
                      ami: "ami-0c6bb742864ffa3f3"
                      labels: "agent"
                      type: "T2Xlarge"
                      remoteFS: "/home/ec2-user"
                      remoteAdmin: "ec2-user"
                      ################
                      # FIXME: without this, there's an NPE during provisioning
                      userData: ""
          {code}

          h3. Expected behaviour

          If I do not need any {{userData}}, I should just be able to not specify it like above.

          (the workaround being easy and obvious is the reason I put this as low priority).
          When configuring an EC2 cloud using CasC, one must explicitly set {{mode}} so that the Cloud actually is usable.

          Here is the working yaml
          {code:yaml}
          ---
          jenkins:
            clouds:
              - amazonEC2:
                  cloudName: "ec2"
                  instanceCapStr: 20
                  zone: "us-east-1"
                  useInstanceProfileForCredentials: true
                  privateKey: "${PRIVATE_KEY}"
                  templates:
                    - description: "EC2 Agent"
                      ami: "ami-0c6bb742864ffa3f3"
                      labels: "agent"
                      type: "T2Xlarge"
                      remoteFS: "/home/ec2-user"
                      remoteAdmin: "ec2-user"
                      ################
                      # FIXME: without this, the whole setup will look like it's not even configured
                      mode: NORMAL
          {code}

          h3. Expected behaviour

          If mode is not specified, it should default to {{NORMAL}}. Or if really we want to make it required, this should fail fast when absent, not stay null and make the whole settings broken.
          batmat Baptiste Mathus made changes -
          Description When configuring an EC2 cloud using CasC, one must explicitly set {{mode}} so that the Cloud actually is usable.

          Here is the working yaml
          {code:yaml}
          ---
          jenkins:
            clouds:
              - amazonEC2:
                  cloudName: "ec2"
                  instanceCapStr: 20
                  zone: "us-east-1"
                  useInstanceProfileForCredentials: true
                  privateKey: "${PRIVATE_KEY}"
                  templates:
                    - description: "EC2 Agent"
                      ami: "ami-0c6bb742864ffa3f3"
                      labels: "agent"
                      type: "T2Xlarge"
                      remoteFS: "/home/ec2-user"
                      remoteAdmin: "ec2-user"
                      ################
                      # FIXME: without this, the whole setup will look like it's not even configured
                      mode: NORMAL
          {code}

          h3. Expected behaviour

          If mode is not specified, it should default to {{NORMAL}}. Or if really we want to make it required, this should fail fast when absent, not stay null and make the whole settings broken.
          When configuring an EC2 cloud using CasC, one must explicitly set {{mode}} so that the Cloud actually is usable.

          Here is the working yaml
          {code:yaml}
          ---
          jenkins:
            clouds:
              - amazonEC2:
                  cloudName: "ec2"
                  instanceCapStr: 20
                  zone: "us-east-1"
                  useInstanceProfileForCredentials: true
                  privateKey: "${PRIVATE_KEY}"
                  templates:
                    - description: "EC2 Agent"
                      ami: "ami-0c6bb742864ffa3f3"
                      labels: "agent"
                      type: "T2Xlarge"
                      remoteFS: "/home/ec2-user"
                      remoteAdmin: "ec2-user"
                      ################
                      # FIXME: without this, the whole setup will look like it's not even configured
                      mode: NORMAL
          {code}

          h3. Expected behaviour

          If mode is not specified, it should default to {{NORMAL}}. Or if really we want to make it required, this should fail fast when absent, not stay null and make the whole settings broken.

          I had to run the code through a debugger to actually understand what was going on.
          ndeloof Nicolas De Loof made changes -
          Remote Link This issue links to "https://github.com/jenkinsci/ec2-plugin/pull/293 (Web Link)" [ 21139 ]
          ndeloof Nicolas De Loof made changes -
          Assignee Ewelina Wilkosz [ ewel ] Nicolas De Loof [ ndeloof ]
          oleg_nenashev Oleg Nenashev made changes -
          Component/s configuration-as-code-plugin [ 23170 ]
          oleg_nenashev Oleg Nenashev made changes -
          Assignee Nicolas De Loof [ ndeloof ] Francis Upton [ francisu ]
          batmat Baptiste Mathus made changes -
          Labels essentials essentials-triggered jcasc-compatibility essentials essentials-triggered evergreen jcasc-compatibility
          batmat Baptiste Mathus made changes -
          Labels essentials essentials-triggered evergreen jcasc-compatibility essentials essentials-triggered evergreen evergreen-triggered jcasc-compatibility
          batmat Baptiste Mathus made changes -
          Labels essentials essentials-triggered evergreen evergreen-triggered jcasc-compatibility evergreen evergreen-triggered jcasc-compatibility
          batmat Baptiste Mathus made changes -
          Labels evergreen evergreen-triggered jcasc-compatibility evergreen-triggered jcasc-compatibility
          batmat Baptiste Mathus made changes -
          Assignee Francis Upton [ francisu ] Nicolas De Loof [ ndeloof ]
          batmat Baptiste Mathus made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          batmat Baptiste Mathus made changes -
          Status In Progress [ 3 ] In Review [ 10005 ]
          batmat Baptiste Mathus made changes -
          Sprint Evergreen - Milestone 2 [ 516 ]
          ndeloof Nicolas De Loof made changes -
          Resolution Fixed [ 1 ]
          Status In Review [ 10005 ] Closed [ 6 ]
          batmat Baptiste Mathus made changes -
          Released As ec2-plugin 1.40

          People

            ndeloof Nicolas De Loof
            batmat Baptiste Mathus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: