Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / jenkins-admin / create_jenkins_clouds_openstack_yaml.py
index f26eba4..d342469 100755 (executable)
@@ -56,10 +56,14 @@ lookuptable = {
     "v2-standard-8": "e6fe2e37-0e38-438c-8fa5-fc2d79d0a7bb",
     "v2-standard-16": "9e4b01cd-6744-4120-aafe-1b5e17584919",
     "v2-standard-360": "f0d27f44-a410-4f0f-9781-d722f5b5489e",
+    "v3-standard-1": "555dff3a-7ec2-437e-bfc7-5a00113a304d",
     "v3-standard-2": "d6906d2a-e83f-42be-b33e-fbaeb5c511cb",
     "v3-standard-4": "5f1eb09f-e764-4642-a16f-a7230ec025e7",
+    "v3-standard-6": "e145dc6b-7560-4633-ab6e-430028fd877f",
     "v3-standard-8": "47d3707a-c6c6-46ea-a15b-095e336b1edc",
     "v3-standard-16": "8587d458-69de-4fc5-be51-c5e671bc35d5",
+    "v3-standard-20": "6baabd68-258c-4fdc-b0ba-5a77c5b89c21",
+    "v3-standard-24": "cec3e6ff-667e-431c-9c14-ba7c1d9b4cc2",
     "v3-standard-32": "3e01b39f-45a9-4b7b-b6dc-14378433dc36",
     "v3-standard-48": "06a0e8b7-949a-439d-a185-208ae9e645b2",
     "v3-standard-64": "402a2759-cc01-481d-a8b7-2c7056f153f7",
@@ -89,9 +93,10 @@ jenkins:
         slaveOptions:
           availabilityZone: {{ availability_zone }}
           bootSource:
-            volumeFromImage:
+            {{ image_type }}:
               name: {{ image_name }}
-              volumeSize: {{ volume_size }}
+{%- if image_type == "volumeFromImage"  %}
+              volumeSize: {{ volume_size }}{% endif %}
           fsRoot: {{ fs_root }}
           hardwareId: {{ hardware_id }}
 {%- if is_sandbox is defined %}
@@ -121,7 +126,7 @@ machinetemplate = """\
 {%- if instance_cap %}
               instanceCap: {{ instance_cap }}{% endif %}
 {%- if num_executors %}
-              numExectorts: {{ num_executors }}{% endif %}
+              numExecutors: {{ num_executors }}{% endif %}
 {%- if retention_time %}
               retentionTime: {{ retention_time }}
 {%- else %}
@@ -197,6 +202,11 @@ for index, _ in enumerate(cloud_config_final):
         value = lookuptable[value]
     section_cloud[key] = value
 
+    if "volume_size" not in section_cloud:
+        section_cloud.update(image_type="image")
+    else:
+        section_cloud.update(image_type="volumeFromImage")
+
 j2_template = Template(maintemplate)
 print(j2_template.render(section_cloud))