88 "io"
99
1010 "github.com/cockroachdb/errors"
11- "github.com/hashicorp/go-multierror"
1211
1312 "github.com/sourcegraph/src-cli/internal/batches/executor"
1413 "github.com/sourcegraph/src-cli/internal/batches/graphql"
@@ -109,27 +108,11 @@ func executeBatchSpecInWorkspaces(ctx context.Context, ui *ui.JSONLines, opts ex
109108 // we can convert it to a RepoWorkspace and build a task only for that one.
110109 repoWorkspace := convertWorkspace (input .Workspace )
111110
112- // Parse the raw batch spec contained in the input
113- ui .ParsingBatchSpec ()
114- batchSpec , err := svc .ParseBatchSpec ([]byte (input .RawSpec ))
115- if err != nil {
116- var multiErr * multierror.Error
117- if errors .As (err , & multiErr ) {
118- ui .ParsingBatchSpecFailure (multiErr )
119- return cmderrors .ExitCode (2 , nil )
120- } else {
121- // This shouldn't happen; let's just punt and let the normal
122- // rendering occur.
123- return err
124- }
125- }
126- ui .ParsingBatchSpecSuccess ()
127-
128111 var workspaceCreator workspace.Creator
129112
130- if svc . HasDockerImages ( batchSpec ) {
113+ if len ( input . Workspace . Steps ) > 0 {
131114 ui .PreparingContainerImages ()
132- images , err := svc .EnsureDockerImages (ctx , batchSpec , ui .PreparingContainerImagesProgress )
115+ images , err := svc .EnsureDockerImages (ctx , input . Workspace . Steps , ui .PreparingContainerImagesProgress )
133116 if err != nil {
134117 return err
135118 }
@@ -162,13 +145,13 @@ func executeBatchSpecInWorkspaces(ctx context.Context, ui *ui.JSONLines, opts ex
162145 // `src batch exec` uses server-side caching for changeset specs, so we
163146 // only need to call `CheckStepResultsCache` to make sure that per-step cache entries
164147 // are loaded and set on the tasks.
165- tasks := svc .BuildTasks (ctx , batchSpec , []service.RepoWorkspace {repoWorkspace })
148+ tasks := svc .BuildTasks (ctx , input . Spec , []service.RepoWorkspace {repoWorkspace })
166149 if err := coord .CheckStepResultsCache (ctx , tasks ); err != nil {
167150 return err
168151 }
169152
170153 taskExecUI := ui .ExecutingTasks (* verbose , opts .flags .parallelism )
171- specs , _ , err : = coord .Execute (ctx , tasks , batchSpec , taskExecUI )
154+ _ , _ , err = coord .Execute (ctx , tasks , input . Spec , taskExecUI )
172155 if err == nil || opts .flags .skipErrors {
173156 if err == nil {
174157 taskExecUI .Success ()
@@ -181,18 +164,6 @@ func executeBatchSpecInWorkspaces(ctx context.Context, ui *ui.JSONLines, opts ex
181164 return err
182165 }
183166 }
184- ids := make ([]graphql.ChangesetSpecID , len (specs ))
185-
186- ui .UploadingChangesetSpecs (len (specs ))
187- for i , spec := range specs {
188- id , err := svc .CreateChangesetSpec (ctx , spec )
189- if err != nil {
190- return err
191- }
192- ids [i ] = id
193- ui .UploadingChangesetSpecsProgress (i + 1 , len (specs ))
194- }
195- ui .UploadingChangesetSpecsSuccess (ids )
196167
197168 return nil
198169}
0 commit comments