Skip to content

Commit

Permalink
Rename source to uses
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborszakacs committed Dec 16, 2024
1 parent 26d069b commit 7db8e1f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cli/run_util_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pipelines:
dag:
workflows:
a: {}
a1: { source: a, inputs: [key: value] }
a1: { uses: a, inputs: [key: value] }
b: { depends_on: [a] }
c: { depends_on: [a] }
d: { depends_on: [a] }
Expand Down Expand Up @@ -109,7 +109,7 @@ pipelines:
dag:
workflows:
a: {}
b: { source: c }
b: { uses: c }
workflows:
a: {}
`
Expand All @@ -120,7 +120,7 @@ pipelines:
dag:
workflows:
a: {}
b: { source: c }
b: { uses: c }
workflows:
a: {}
b: {}
Expand Down
3 changes: 1 addition & 2 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ type GraphPipelineWorkflowModel struct {
AbortOnFail bool `json:"abort_on_fail,omitempty" yaml:"abort_on_fail,omitempty"`
RunIf GraphPipelineRunIfModel `json:"run_if,omitempty" yaml:"run_if,omitempty"`
ShouldAlwaysRun GraphPipelineAlwaysRunMode `json:"should_always_run,omitempty" yaml:"should_always_run,omitempty"`
// TODO: the name is not final
Source string `json:"source,omitempty" yaml:"source,omitempty"`
Uses string `json:"uses,omitempty" yaml:"uses,omitempty"`
}

type GraphPipelineRunIfModel struct {
Expand Down
6 changes: 3 additions & 3 deletions models/models_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,10 @@ func validateDAGPipeline(pipelineID string, pipeline *PipelineModel, config *Bit
return fmt.Errorf("workflow (%s) defined in pipeline (%s) is a utility workflow", pipelineWorkflowID, pipelineID)
}

isWorkflowVariant := pipelineWorkflow.Source != ""
isWorkflowVariant := pipelineWorkflow.Uses != ""
if isWorkflowVariant {
if _, ok := config.Workflows[pipelineWorkflow.Source]; !ok {
return fmt.Errorf("workflow (%s) referenced in pipeline (%s) in workflow variant (%s) is not found in the workflow definitions", pipelineWorkflow.Source, pipelineID, pipelineWorkflowID)
if _, ok := config.Workflows[pipelineWorkflow.Uses]; !ok {
return fmt.Errorf("workflow (%s) referenced in pipeline (%s) in workflow variant (%s) is not found in the workflow definitions", pipelineWorkflow.Uses, pipelineID, pipelineWorkflowID)
}

if _, ok := config.Workflows[pipelineWorkflowID]; ok {
Expand Down

0 comments on commit 7db8e1f

Please sign in to comment.