prow/cmd/pipeline/controller.go
func makePipelineRun(pj prowjobv1.ProwJob, pr *pipelinev1alpha1.PipelineResource) (*pipelinev1alpha1.PipelineRun, error) {
	if pj.Spec.PipelineRunSpec == nil {
		return nil, errors.New("no PipelineSpec defined")
	}
	p := pipelinev1alpha1.PipelineRun{
		ObjectMeta: pipelineMeta(pj),
		Spec:       *pj.Spec.PipelineRunSpec.DeepCopy(),
	}
	buildID := pj.Status.BuildID
	if buildID == "" {
		return nil, errors.New("empty BuildID in status")
	}
	p.Spec.Params = append(p.Spec.Params, pipelinev1alpha1.Param{
		Name:  "build_id",
		Value: buildID,
	})
	rb := pipelinev1alpha1.PipelineResourceBinding{
		Name: pr.Name,
		ResourceRef: pipelinev1alpha1.PipelineResourceRef{
			Name:       pr.Name,
			APIVersion: pr.APIVersion,
		},
	}
	p.Spec.Resources = append(p.Spec.Resources, rb)

	return &p, nil
}
func makePipelineRun(pj prowjobv1.ProwJob, pr *pipelinev1alpha1.PipelineResource) (*pipelinev1alpha1.PipelineRun, error) {
	if pj.Spec.PipelineRunSpec == nil {
		return nil, errors.New("no PipelineSpec defined")
	}
	p := pipelinev1alpha1.PipelineRun{
		ObjectMeta: pipelineMeta(pj),
		Spec:       *pj.Spec.PipelineRunSpec.DeepCopy(),
	}
	buildID := pj.Status.BuildID
	if buildID == "" {
		return nil, errors.New("empty BuildID in status")
	}
	p.Spec.Params = append(p.Spec.Params, pipelinev1alpha1.Param{
		Name:  "build_id",
		Value: buildID,
	})
	rb := pipelinev1alpha1.PipelineResourceBinding{
		Name: pr.Name,
		ResourceRef: pipelinev1alpha1.PipelineResourceRef{
			Name:       pr.Name,
			APIVersion: pr.APIVersion,
		},
	}
	p.Spec.Resources = append(p.Spec.Resources, rb)

	return &p, nil
}
func makePipelineRun ( pj prowjobv1 . ProwJob , pr * pipelinev1alpha1 . PipelineResource ) ( * pipelinev1alpha1 . PipelineRun , error ) { if pj . Spec . PipelineRunSpec == nil { return nil , errors . New ( " " ) } p := pipelinev1alpha1 . PipelineRun { ObjectMeta : pipelineMeta ( pj ) , Spec : * pj . Spec . PipelineRunSpec . DeepCopy ( ) , } buildID := pj . Status . BuildID if buildID == " " { return nil , errors . New ( " " ) } p . Spec . Params = append ( p . Spec . Params , pipelinev1alpha1 . Param { Name : " " , Value : buildID , } ) rb := pipelinev1alpha1 . PipelineResourceBinding { Name : pr . Name , ResourceRef : pipelinev1alpha1 . PipelineResourceRef { Name : pr . Name , APIVersion : pr . APIVersion , } , } p . Spec . Resources = append ( p . Spec . Resources , rb ) return & p , nil }
// makePipeline creates a PipelineRun from a prow job using the PipelineRunSpec defined in the prow job
makePipeline creates a PipelineRun from a prow job using the PipelineRunSpec defined in the prow job