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

Don't use RandomStringGenerator for suffix in instance name

XMLWordPrintable

      Plugin generate suffix for instance name randomly. At first glance, this is a good solution, but in the process of exploitation there are some shortcomings.
      1. If monitoring is used, for example, influxdb, then a huge number of unique hostnames accumulate and this greatly complicates monitoring.
      2. Monitoring in GCE is tied to the name of the instance, and by opening the monitoring tab you can see all the data of the instance with the same name for previous periods.
      3. You can use Commitments and discounts. It count instances with the same name like one and apply discounts.

      I suggest not to use a random name, but to use predefined names, to check whether such a name exists, and if not, to use it.
      Example of code:
      def nodes_list_to_add = []
      int i = 0
      int n = 0
      while ( i < number_of_nodes_to_add ) {
        n++
        node_name = node_name_template + '-' + sprintf('%03d', n)
        if (! nodes_map.containsKey(node_name)){
          nodes_list_to_add.add(node_name)
                i++
          }
      }

            evanbrown Evan Brown
            dubrsl Viacheslav Dubrovskyi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: