From dbb87bd5239e9dd3c403e419b926cb167721aa0a Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Wed, 18 Dec 2024 14:54:00 +0100 Subject: [PATCH 1/2] Fix vm.status output tostring Signed-off-by: gabriel-farache --- workflows/modify-vm-resources/modify-vm-resources.sw.yaml | 4 ++-- workflows/request-vm-cnv/request-vm-cnv.sw.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/workflows/modify-vm-resources/modify-vm-resources.sw.yaml b/workflows/modify-vm-resources/modify-vm-resources.sw.yaml index 703a1319..b2a8cc4f 100644 --- a/workflows/modify-vm-resources/modify-vm-resources.sw.yaml +++ b/workflows/modify-vm-resources/modify-vm-resources.sw.yaml @@ -64,7 +64,7 @@ functions: operation: '{ "result": { "completedWith":"error", - "message": "VM " + .vm_name + " in namespace " + .vm_namespace + " not ready after the update after checking" + (.vmStatusRunningRetries|tostring) + " times: " + .vm.status + "message": "VM " + .vm_name + " in namespace " + .vm_namespace + " not ready after the update after checking" + (.vmStatusRunningRetries|tostring) + " times: " + (.vm.status|tostring) } }' - name: errorAuthorizationDeniedResult @@ -322,7 +322,7 @@ states: entityRef: .recipients payload: title: '"VM " + .vm_name + " in namespace " + .vm_namespace + " not ready"' - description: '"VM " + .vm_name + " in namespace " + .vm_namespace + " not ready after the update after checking" + (.vmStatusRunningRetries|tostring) + " times: " + .vm.status' + description: '"VM " + .vm_name + " in namespace " + .vm_namespace + " not ready after the update after checking" + (.vmStatusRunningRetries|tostring) + " times: " + (.vm.status|tostring)' topic: "Modify VM Resources workflow" severity: "high" - name: setOutput diff --git a/workflows/request-vm-cnv/request-vm-cnv.sw.yaml b/workflows/request-vm-cnv/request-vm-cnv.sw.yaml index 0937c6ef..ba361f22 100644 --- a/workflows/request-vm-cnv/request-vm-cnv.sw.yaml +++ b/workflows/request-vm-cnv/request-vm-cnv.sw.yaml @@ -47,7 +47,7 @@ functions: operation: '{ "result": { "completedWith":"error", - "message": "VM " + .vm_name + " in namespace " + .vm_namespace + " using image " + .vm_image +" not ready after " + (.vmStatusRunning|tostring) + " retries: " + .vm.status + "message": "VM " + .vm_name + " in namespace " + .vm_namespace + " using image " + .vm_image +" not ready after " + (.vmStatusRunning|tostring) + " retries: " + (.vm.status|tostring) } }' - name: errorAuthorizationDeniedResult @@ -315,7 +315,7 @@ states: entityRef: .recipients payload: title: '"VM " + .vm_name + " in namespace "+.vm_namespace + " not ready"' - description: '"VM " + .vm_name + " in namespace " + .vm_namespace + " using image " + .vm_image +" not ready after " + (.vmStatusRunningRetries|tostring) + " retries: " + .vm.status' + description: '"VM " + .vm_name + " in namespace " + .vm_namespace + " using image " + .vm_image +" not ready after " + (.vmStatusRunningRetries|tostring) + " retries: " + (.vm.status|tostring)' topic: "Request VM on CNV workflow" severity: "high" - name: setOutput From a2b0e6b5b9453f5d2e37b0edb3189d805aadda85 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Wed, 18 Dec 2024 14:55:41 +0100 Subject: [PATCH 2/2] Add pattern validation for update vm Signed-off-by: gabriel-farache --- .../schemas/modify-vm-resources__main-schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflows/modify-vm-resources/schemas/modify-vm-resources__main-schema.json b/workflows/modify-vm-resources/schemas/modify-vm-resources__main-schema.json index 401db39c..8ce4e2ee 100644 --- a/workflows/modify-vm-resources/schemas/modify-vm-resources__main-schema.json +++ b/workflows/modify-vm-resources/schemas/modify-vm-resources__main-schema.json @@ -26,7 +26,8 @@ "title": "Memory", "description": "The new guest memory of the VM", "type": "string", - "examples": ["2Gi"] + "examples": ["2Gi"], + "pattern": "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$" }, "vm_new_cpu_cores": { "title": "CPU Cores",