X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;ds=sidebyside;f=jenkins-admin%2Fcreate_jenkins_clouds_openstack_yaml.py;h=50c4c0385192fae87ef5d603c5694baa17c04482;hb=refs%2Ftags%2Fv0.65.3;hp=4201cdb48b38d0db8665d8af50aa55fe5e5dcc28;hpb=eafdcafcbe25dbad05e5117aca20bf6ea048ac44;p=releng%2Fglobal-jjb.git diff --git a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py index 4201cdb4..50c4c038 100755 --- a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py +++ b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py @@ -97,12 +97,13 @@ jenkins: """ machinetemplate = """\ - labels: {{ labels }} - name: {{ name_prefix }}-{{ labels }} + name: {{ name_prefix }}-{{ agent_name }} slaveOptions: bootSource: - volumeFromImage: + {{ image_type }}: name: {{ image_name }} - volumeSize: {{ volume_size }} +{%- if image_type == "volumeFromImage" %} + volumeSize: {{ volume_size }}{% endif %} {%- if hardware_id %} hardwareId: {{ hardware_id }}{% endif %} {%- if instance_cap %} @@ -200,13 +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(volume_size="10") + 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: - print("LABELS not Set in builder config") - print(section_all_machines) - exit(1) + # "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)