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

ec2-plugin cannot add specified instance tags on launched spot instances

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It is really urgent for me to choose the latest EC2 plugin (still not released) in testing. It seems that there are no latest commits since two months ago.
      I have configured the tags for my new spot instance request, like:
      Name: Name
      Value: Henry

      But after the spot instance launched, it seems no tags have been attached to this spot instance.

      Could you please fix it before the official release?

      Thanks
      Henry

        Attachments

          Activity

          henrysher Henry Huang created issue -
          Hide
          aji9861 Adam Irr added a comment -

          Some more information about why this is happening.

          Spot Instance Requests should be getting the tags assigned. The problem is that the tags do not then get passed on to the fulfilling instance. According to the AWS documentation this is the intended behavior (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.html). It seems we need to manually pass on the tags from the Spot Request to the actual instance.

          Show
          aji9861 Adam Irr added a comment - Some more information about why this is happening. Spot Instance Requests should be getting the tags assigned. The problem is that the tags do not then get passed on to the fulfilling instance. According to the AWS documentation this is the intended behavior ( http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts-spot-instances-request-tags.html ). It seems we need to manually pass on the tags from the Spot Request to the actual instance.
          aji9861 Adam Irr made changes -
          Field Original Value New Value
          Assignee Francis Upton [ francisu ] Adam Irr [ aji9861 ]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Adam I
          Path:
          src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java
          src/main/java/hudson/plugins/ec2/EC2Computer.java
          src/main/java/hudson/plugins/ec2/EC2ComputerListener.java
          src/main/java/hudson/plugins/ec2/EC2SpotSlave.java
          http://jenkins-ci.org/commit/ec2-plugin/f6d54a7948b171d093b02a7def4141d8b2716494
          Log:
          JENKINS-19058 Fix cannot add tags to Spot Instances

          Add a ComputerListener so that we can take action when a
          slave is connected. This allows us to be notified when a
          Spot instance is connected and add the Spot Request's tags
          to its instance.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Adam I Path: src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java src/main/java/hudson/plugins/ec2/EC2Computer.java src/main/java/hudson/plugins/ec2/EC2ComputerListener.java src/main/java/hudson/plugins/ec2/EC2SpotSlave.java http://jenkins-ci.org/commit/ec2-plugin/f6d54a7948b171d093b02a7def4141d8b2716494 Log: JENKINS-19058 Fix cannot add tags to Spot Instances Add a ComputerListener so that we can take action when a slave is connected. This allows us to be notified when a Spot instance is connected and add the Spot Request's tags to its instance.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Francis Upton
          Path:
          src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java
          src/main/java/hudson/plugins/ec2/EC2Computer.java
          src/main/java/hudson/plugins/ec2/EC2ComputerListener.java
          src/main/java/hudson/plugins/ec2/EC2SpotSlave.java
          http://jenkins-ci.org/commit/ec2-plugin/6a374e309c229f1b3227791dea9c088eadb088db
          Log:
          Merge pull request #61 from aji9861/master

          JENKINS-19058 Fix cannot add tags to Spot Instances

          Compare: https://github.com/jenkinsci/ec2-plugin/compare/98a36f1f2512...6a374e309c22

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Francis Upton Path: src/main/java/hudson/plugins/ec2/EC2AbstractSlave.java src/main/java/hudson/plugins/ec2/EC2Computer.java src/main/java/hudson/plugins/ec2/EC2ComputerListener.java src/main/java/hudson/plugins/ec2/EC2SpotSlave.java http://jenkins-ci.org/commit/ec2-plugin/6a374e309c229f1b3227791dea9c088eadb088db Log: Merge pull request #61 from aji9861/master JENKINS-19058 Fix cannot add tags to Spot Instances Compare: https://github.com/jenkinsci/ec2-plugin/compare/98a36f1f2512...6a374e309c22
          Hide
          aji9861 Adam Irr added a comment -

          When you get a chance let us know if you are still seeing this issue with the latest commit.

          Show
          aji9861 Adam Irr added a comment - When you get a chance let us know if you are still seeing this issue with the latest commit.
          aji9861 Adam Irr made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          henrysher Henry Huang added a comment -

          Thanks for your quick patch and instant response.

          From my testing, when no global security enabled, it works and tags have been added. But if enable the global security, it will pop out the errors like this:

          === Slave ===
          $ java -jar slave.jar -jnlpUrl http://ec2-XX-XX-XX-xX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp

          java.io.IOException: Failed to load http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp: 403 Forbidden
          at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:261)
          at hudson.remoting.Launcher.run(Launcher.java:215)
          at hudson.remoting.Launcher.main(Launcher.java:189)
          Waiting 10 seconds before retry

          === Master ===
          INFO: While serving http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp: hudson.security.AccessDeniedException2: anonymous is missing the Slave/Connect permission

          Besides, I also enabled the "Slave/Connect" permission for anonymous users. It still cannot work with 403 forbidden.

          Then, I created one normal user with all permission, and use "-auth xxx:xxx" as a parameter in the command line. It seems that Master did not recognize the user and still consider it as anonymous.

          So I am not sure whether the code has this logic now.

          Thanks
          Henry

          Show
          henrysher Henry Huang added a comment - Thanks for your quick patch and instant response. From my testing, when no global security enabled, it works and tags have been added. But if enable the global security, it will pop out the errors like this: === Slave === $ java -jar slave.jar -jnlpUrl http://ec2-XX-XX-XX-xX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp java.io.IOException: Failed to load http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp: 403 Forbidden at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:261) at hudson.remoting.Launcher.run(Launcher.java:215) at hudson.remoting.Launcher.main(Launcher.java:189) Waiting 10 seconds before retry === Master === INFO: While serving http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXX/slave-agent.jnlp: hudson.security.AccessDeniedException2: anonymous is missing the Slave/Connect permission Besides, I also enabled the "Slave/Connect" permission for anonymous users. It still cannot work with 403 forbidden. Then, I created one normal user with all permission, and use "-auth xxx:xxx" as a parameter in the command line. It seems that Master did not recognize the user and still consider it as anonymous. So I am not sure whether the code has this logic now. Thanks Henry
          Hide
          aji9861 Adam Irr added a comment -

          I was able to connect with the following command:
          java -jar slave.jar -jnlpCredentials user:passsword -jnlpUrl http://ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXXX/slave-agent.jnlp

          This however requires you put the user password in the command parameters.

          There should be a way to use your auth token instead of your password, but when I try I am getting a 401. Issues with connecting a slave using jnlp are not specific to this plugin/Spot instances. It uses the standard Jenkins jnlp information.

          Show
          aji9861 Adam Irr added a comment - I was able to connect with the following command: java -jar slave.jar -jnlpCredentials user:passsword -jnlpUrl http://ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com:8080/computer/XXXXXX-XXXXXXX/slave-agent.jnlp This however requires you put the user password in the command parameters. There should be a way to use your auth token instead of your password, but when I try I am getting a 401. Issues with connecting a slave using jnlp are not specific to this plugin/Spot instances. It uses the standard Jenkins jnlp information.
          henrysher Henry Huang made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 150505 ] JNJira + In-Review [ 206847 ]
          Hide
          dinesh_dh Dinesh Dharmawardena added a comment -

          I think this is still an issue in version 1.38 of the ec2-plugin. Did this actually get released?

          Show
          dinesh_dh Dinesh Dharmawardena added a comment - I think this is still an issue in version 1.38 of the ec2-plugin. Did this actually get released?
          dinesh_dh Dinesh Dharmawardena made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          mykola Mykola Marzhan added a comment -

          I still don't have tags on spot instances in plugin version 1.39, Jenkins 2.136

          Show
          mykola Mykola Marzhan added a comment - I still don't have tags on spot instances in plugin version 1.39, Jenkins 2.136
          Hide
          sw97272 simon Wall added a comment -

          Is there any further development on this ticket?  I am hopeful to be able to make use of the EC2 plugin's ability to manage worker nodes using spot instances, but we need to have tags passed to the instance.

          Show
          sw97272 simon Wall added a comment - Is there any further development on this ticket?  I am hopeful to be able to make use of the EC2 plugin's ability to manage worker nodes using spot instances, but we need to have tags passed to the instance.
          slide_o_mix Alex Earl made changes -
          Component/s plugin-proposals [ 15491 ]
          Hide
          thoulen FABRIZIO MANFREDI added a comment -

          Did you test the last version ? the Tag should be there for all type of the nodes

          Show
          thoulen FABRIZIO MANFREDI added a comment - Did you test the last version ? the Tag should be there for all type of the nodes
          thoulen FABRIZIO MANFREDI made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Closed [ 6 ]

            People

            Assignee:
            aji9861 Adam Irr
            Reporter:
            henrysher Henry Huang
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: