From 3e3e5e23dc848ed76f3d4e8d0ba9021f65ce3c39 Mon Sep 17 00:00:00 2001
From: Dong Zhang <dong.zhang@bmw.de>
Date: Tue, 6 Aug 2024 12:33:08 +0200
Subject: [PATCH] Print instance type in emit-job-header role

It would be useful especially when ec2 fleet api is configured,
and the instance type is unknown in advance.

Change-Id: Ibcdade5cfffd13fddd95e797c60c5327bb34fdb6
---
 roles/emit-job-header/tasks/main.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/roles/emit-job-header/tasks/main.yaml b/roles/emit-job-header/tasks/main.yaml
index 314a140ac..ec783f48c 100644
--- a/roles/emit-job-header/tasks/main.yaml
+++ b/roles/emit-job-header/tasks/main.yaml
@@ -24,6 +24,9 @@
           Event ID: {{ zuul.event_id }}
           {% endif %}
 
+    # The "Product Name" prints the instance type for AWS nodes but may be something else
+    # for other providers. It is useful when AWS EC2 Fleet is configured so that we know
+    # the exact instance type of the running node
     - name: Print node information
       debug:
         msg: |
@@ -34,6 +37,7 @@
           Distro: {{ hostvars[zj_item]['ansible_distribution'] | default('unknown') }} {{ hostvars[zj_item]['ansible_distribution_version'] | default('unknown') }}
           Provider: {{ hostvars[zj_item]['nodepool']['provider'] }}
           Label: {{ hostvars[zj_item]['nodepool']['label'] }}
+          Product Name: {{ hostvars[zj_item]['ansible_product_name'] | default('unknown') }}
           {% if hostvars[zj_item]['nodepool']['interface_ip'] is defined %}
           Interface IP: {{ hostvars[zj_item]['nodepool']['interface_ip'] }}
           {% endif %}