Skip to content

Commit 5e5386f

Browse files
fmudrymmorhun
authored andcommitted
fix generating on-cel-expression in an 'on push' PipelineRun file
Currently, generated on-cel-expression would contain a path to a <component-name>-pull-request.yaml file in an 'on push' PipelineRun, which is not correct. We need to determine between on-push and on-pull-request and adjust the filename in the on-cel-expression accordingly. Signed-off-by: Filip Mudry <[email protected]>
1 parent bd5d6e7 commit 5e5386f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/controller/component_build_controller_pipeline.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,12 @@ func generateCelExpressionForPipeline(component *appstudiov1alpha1.Component, gi
484484
}
485485
}
486486

487-
pullPipelineFileName := component.Name + "-" + pipelineRunOnPRFilename
488-
pathChangedSuffix = fmt.Sprintf(` && ( "%s***".pathChanged() || ".tekton/%s".pathChanged() %s)`, contextDir, pullPipelineFileName, dockerfilePathChangedSuffix)
487+
pipelineFileName := component.Name + "-" + pipelineRunOnPushFilename
488+
if onPull {
489+
pipelineFileName = component.Name + "-" + pipelineRunOnPRFilename
490+
}
491+
492+
pathChangedSuffix = fmt.Sprintf(` && ( "%s***".pathChanged() || ".tekton/%s".pathChanged() %s)`, contextDir, pipelineFileName, dockerfilePathChangedSuffix)
489493
}
490494

491495
return fmt.Sprintf("%s && %s%s", eventCondition, targetBranchCondition, pathChangedSuffix), nil

0 commit comments

Comments
 (0)