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

EC2 Alternate Endpoint and Region are reset when managing jenkins configuration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Review (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: ec2-plugin
    • Environment:
    • Similar Issues:

      Description

      This plugin’s configuration section, within the “Manage → System Configuration” area of Jenkins, has a bug that wipes the Alternate EC2 url and region parameters. In the event that someone opens the System Configuration page and performs a “Save” without resetting these fields, Jenkins will get into a state where it’s either partially or completely unusable due to it saving a configuration with no region set, which shouldn't be allowed.

      Attached are two examples of what has happened when a save occurs and the fields were not set.

      Additionally, when you go to the configuration page and try to reset the fields an error is returned via the plugin, and saving still results in the region not being set. A screenshot of that is included as well.

      If you wait long enough, eventually the plugin will return a 504 gateway timeout. A screenshot of that is also included.

      In order to resolve the issue, we have to go onto the ec2 instance where jenkins is running, edit the config.xml and restart the jenkins docker container.

      Edit: We have since updated Jenkins to v 2.204.2 and the issue persists.

        Attachments

          Activity

          Hide
          phathobo123 Kevin Flynn added a comment -

          This is also an issue for me. We tried setting the AWS_DEFAULT_REGION env var in the Jenkins docker container, but the EC2 Plugin still can't determine the EC2 endpoint on it's own.

          Show
          phathobo123 Kevin Flynn added a comment - This is also an issue for me. We tried setting the AWS_DEFAULT_REGION env var in the Jenkins docker container, but the EC2 Plugin still can't determine the EC2 endpoint on it's own.
          Hide
          troymohl Troy Mohl added a comment -

          I have submitted a PR that I believe fixes this problem when using an alternate endpoint to select the AWS region: https://github.com/jenkinsci/ec2-plugin/pull/439

          Show
          troymohl Troy Mohl added a comment - I have submitted a PR that I believe fixes this problem when using an alternate endpoint to select the AWS region:  https://github.com/jenkinsci/ec2-plugin/pull/439
          Hide
          mlee Martin Lee added a comment -

          This is an issue for me as well for a different reason - we have the us-east-1 region blocked org-wide for reasons various. This means we rely on this setting to get the region list.

          Show
          mlee Martin Lee added a comment - This is an issue for me as well for a different reason - we have the us-east-1 region blocked org-wide for reasons various. This means we rely on this setting to get the region list.
          Hide
          motoman Josh Fernandes added a comment - - edited

          I have the same issue. Every time we configure our cloud nodes we lose the alternate ec2 endpoint so the populated region list is also lost. This becomes a pain with multiple nodes.

          Show
          motoman Josh Fernandes added a comment - - edited I have the same issue. Every time we configure our cloud nodes we lose the alternate ec2 endpoint so the populated region list is also lost. This becomes a pain with multiple nodes.
          Hide
          gatoraidab Andrew Barrett added a comment -

          This is a constant frustration. I love the plugin, but everytime I have to go into the config it makes me cringe. I have to double check to make sure I put the endpoints back in correctly.

          Show
          gatoraidab Andrew Barrett added a comment - This is a constant frustration. I love the plugin, but everytime I have to go into the config it makes me cringe. I have to double check to make sure I put the endpoints back in correctly.
          Hide
          allan_burdajewicz Allan BURDAJEWICZ added a comment -

          The altEC2Endpoint does not seem to have a field in AmazonEC2Cloud so it is not persisted. It is only used in the UI to be able to list region from a different URL. This field would need to be added with data binding if people want it to persist.
          The root cause of the problem however seems to be that the method that fills the selector does not keep the current selection: https://github.com/jenkinsci/ec2-plugin/blob/ec2-1.50.3/src/main/java/hudson/plugins/ec2/AmazonEC2Cloud.java#L165-L190. Maybe that ListBoxModel should always have the current value of the region

          Show
          allan_burdajewicz Allan BURDAJEWICZ added a comment - The altEC2Endpoint does not seem to have a field in AmazonEC2Cloud so it is not persisted. It is only used in the UI to be able to list region from a different URL. This field would need to be added with data binding if people want it to persist. The root cause of the problem however seems to be that the method that fills the selector does not keep the current selection: https://github.com/jenkinsci/ec2-plugin/blob/ec2-1.50.3/src/main/java/hudson/plugins/ec2/AmazonEC2Cloud.java#L165-L190 . Maybe that ListBoxModel should always have the current value of the region
          Hide
          alecharp Adrien Lecharpentier added a comment -

          Allan BURDAJEWICZ with the PR 489, the alternateEC2Endpoint is saved in the model and I could see that it fixed a problem where the default region ( ec2.amazonaws.com ) is not authorized (proxy, firewall, etc.). In those case, the configuration page would timeout because we cannot get a list of regions.

          By the way, the ListBoxModel is not keeping the region previously selected value because it's not its job. It has to provide the available options, and only that. The previous value is provided by a getter and Jelly is making the "selection" once the select has all its options.

          Show
          alecharp Adrien Lecharpentier added a comment - Allan BURDAJEWICZ with the PR 489 , the alternateEC2Endpoint is saved in the model and I could see that it fixed a problem where the default region ( ec2.amazonaws.com ) is not authorized (proxy, firewall, etc.). In those case, the configuration page would timeout because we cannot get a list of regions. By the way, the ListBoxModel is not keeping the region previously selected value because it's not its job. It has to provide the available options, and only that. The previous value is provided by a getter and Jelly is making the "selection" once the select has all its options.
          Hide
          mramonleon Ramon Leon added a comment -

          I've filed this PR: https://github.com/jenkinsci/ec2-plugin/pull/439

          It is simpler than the previous one and keeps the current behavior of the Alternate EC2 Endpoint field. To make it clear how this field behaves, I've recorded a video showing how it works (after the new PR): https://photos.app.goo.gl/aADg5roUcKbMqLKj8

           

          IMO we should merge this simpler PR, but I'm open to discussion, maybe I misunderstood the problems some people are having.

          Show
          mramonleon Ramon Leon added a comment - I've filed this PR: https://github.com/jenkinsci/ec2-plugin/pull/439 It is simpler than the previous one and keeps the current behavior of the Alternate EC2 Endpoint field. To make it clear how this field behaves, I've recorded a video showing how it works (after the new PR): https://photos.app.goo.gl/aADg5roUcKbMqLKj8   IMO we should merge this simpler PR, but I'm open to discussion, maybe I misunderstood the problems some people are having.

            People

            Assignee:
            mramonleon Ramon Leon
            Reporter:
            hlemieux Heather Lemieux
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Dates

              Created:
              Updated: