From e86f38299765b82ad724fdb701557e0eaff3884d Mon Sep 17 00:00:00 2001 From: Tarun Koyalwar <45962551+tarunKoyalwar@users.noreply.github.com> Date: Fri, 1 Mar 2024 21:30:03 +0530 Subject: [PATCH] validate code template in workflows (#4822) * validate code template in workflows * fix missing executer --- pkg/templates/workflows.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/templates/workflows.go b/pkg/templates/workflows.go index 94e2c11c..77e955c1 100644 --- a/pkg/templates/workflows.go +++ b/pkg/templates/workflows.go @@ -80,6 +80,16 @@ func parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, preprocessor Pr gologger.Warning().Msgf("Could not parse workflow template %s: no executer found\n", path) continue } + if len(template.RequestsCode) > 0 { + if !options.Options.EnableCodeTemplates { + gologger.Warning().Msgf("`-code` flag not found, skipping code template from workflow: %v\n", path) + continue + } else if !template.Verified { + // unverfied code templates are not allowed in workflows + gologger.Warning().Msgf("skipping unverified code template from workflow: %v\n", path) + continue + } + } workflowTemplates = append(workflowTemplates, template) }