From 99e807b0c13d98a54e02ad146304ca71674dcd50 Mon Sep 17 00:00:00 2001 From: mbwhite Date: Thu, 4 Jan 2024 13:32:42 +0000 Subject: [PATCH] fix: pipeline tasks specs Signed-off-by: mbwhite --- src/reporter.ts | 2 +- src/rules/prefer-beta.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reporter.ts b/src/reporter.ts index 5e24af4..f4f79c2 100644 --- a/src/reporter.ts +++ b/src/reporter.ts @@ -57,7 +57,7 @@ function instrument(docs: Doc[]) { const m = new Map(); for (const doc of docs) { walk(doc.content, [], (node, path) => { - if (node != null && typeof node == 'object') { + if (node != null && typeof node == 'object') { m.set(node, { node: path.length ? doc.doc.getIn(path, true) : doc.doc, path, diff --git a/src/rules/prefer-beta.ts b/src/rules/prefer-beta.ts index 76c6bed..b4c0c8c 100644 --- a/src/rules/prefer-beta.ts +++ b/src/rules/prefer-beta.ts @@ -4,14 +4,14 @@ export default (docs, tekton, report) => { for (const task of pipeline.spec.tasks) { switch (pipeline.apiVersion) { case 'tekton.dev/v1alpha1': - if (task.taskSpec.params) + if (task.taskSpec && task.taskSpec.params) report( `Pipeline '${pipeline.metadata.name}' is defined with apiVersion tekton.dev/v1alpha1, but defines an inlined task (${task.name}) with spec.params. Use spec.inputs.params instead.`, task.taskSpec.params, ); break; case 'tekton.dev/v1beta1': - if (task.taskSpec.inputs && task.taskSpec.inputs.params) + if (task.taskSpec && task.taskSpec.inputs && task.taskSpec.inputs.params) report( `Pipeline '${pipeline.metadata.name}' is defined with apiVersion tekton.dev/v1beta1, but defines an inlined task (${task.name}) with spec.inputs.params. Use spec.params instead.`, task.taskSpec.inputs.params,