Skip to content

Commit

Permalink
fix: pipeline tasks specs
Browse files Browse the repository at this point in the history
Signed-off-by: mbwhite <[email protected]>
  • Loading branch information
mbwhite committed Jan 4, 2024
1 parent 2a8b87a commit c578da7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/prefer-beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c578da7

Please sign in to comment.