github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/fly/commands/internal/executehelpers/outputs.go (about) 1 package executehelpers 2 3 import ( 4 "fmt" 5 6 "github.com/pf-qiu/concourse/v6/atc" 7 "github.com/pf-qiu/concourse/v6/fly/commands/internal/flaghelpers" 8 ) 9 10 type Output struct { 11 Name string 12 Path string 13 Plan atc.Plan 14 } 15 16 func DetermineOutputs( 17 fact atc.PlanFactory, 18 taskOutputs []atc.TaskOutputConfig, 19 outputMappings []flaghelpers.OutputPairFlag, 20 ) ([]Output, error) { 21 outputs := []Output{} 22 23 for _, i := range outputMappings { 24 outputName := i.Name 25 26 notInConfig := true 27 for _, configOutput := range taskOutputs { 28 if configOutput.Name == outputName { 29 notInConfig = false 30 } 31 } 32 33 if notInConfig { 34 return nil, fmt.Errorf("unknown output '%s'", outputName) 35 } 36 37 outputs = append(outputs, Output{ 38 Name: outputName, 39 Path: i.Path, 40 Plan: fact.NewPlan(atc.ArtifactOutputPlan{ 41 Name: outputName, 42 }), 43 }) 44 } 45 46 return outputs, nil 47 }