Fix: Labels should always include config name 88/68588/1 v0.65.3
authorEric Ball <eball@linuxfoundation.org>
Thu, 19 Aug 2021 21:58:20 +0000 (14:58 -0700)
committerEric Ball <eball@linuxfoundation.org>
Thu, 19 Aug 2021 22:01:15 +0000 (15:01 -0700)
Openstack labels need to include the config name, in addition to any
labels explicitly defined. This also changes the builder name to
match the config name, rather than using the labels (which can be
only one label, but is technically a space-separated list).

Change-Id: I29ccc9987aa02d1e96930d165908396b46223fa8
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
jenkins-admin/create_jenkins_clouds_openstack_yaml.py
releasenotes/notes/fix-openstack-labels-750d2ca73ff0ea29.yaml [new file with mode: 0644]

index ec11f45..50c4c03 100755 (executable)
@@ -97,7 +97,7 @@ jenkins:
 """
 machinetemplate = """\
           - labels: {{ labels }}
-            name: {{ name_prefix }}-{{ labels }}
+            name: {{ name_prefix }}-{{ agent_name }}
             slaveOptions:
               bootSource:
                 {{ image_type }}:
@@ -201,14 +201,19 @@ for section in config_parser_merged.sections():
                 value = lookuptable[value]
             section_all_machines[key] = value
 
-        # Default volume size of 10
         if "volume_size" not in section_all_machines:
             section_all_machines.update(image_type="image")
         else:
             section_all_machines.update(image_type="volumeFromImage")
+
+        # Naming and labels
+        section_all_machines.update(agent_name=section)
         if "labels" not in section_all_machines:
             # "section" is the name of the cloud agent, which is the default label
             section_all_machines.update(labels=section)
+        elif section not in section_all_machines["labels"]:
+            labels = section + " " + section_all_machines["labels"]
+            section_all_machines.update(labels=labels)
 
         j2_template = Template(machinetemplate)
         section_all_machines.update(name_prefix=name_prefix)
diff --git a/releasenotes/notes/fix-openstack-labels-750d2ca73ff0ea29.yaml b/releasenotes/notes/fix-openstack-labels-750d2ca73ff0ea29.yaml
new file mode 100644 (file)
index 0000000..8350999
--- /dev/null
@@ -0,0 +1,7 @@
+---
+fixes:
+  - |
+    Openstack labels need to include the config name, in addition to any
+    labels explicitly defined. This also changes the builder name to
+    match the config name, rather than using the labels (which can be
+    only one label, but is technically a space-separated list).