MCPcopy Index your code
hub / github.com/dagger/dagger / tryRunGeneratorAsCheckScaleOut

Method tryRunGeneratorAsCheckScaleOut

core/modtree.go:191–232  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

189}
190
191func (node *ModTreeNode) tryRunGeneratorAsCheckScaleOut(ctx context.Context) (_ bool, rerr error) {
192 q, err := CurrentQuery(ctx)
193 if err != nil {
194 return true, err
195 }
196
197 cloudClient, useCloud, err := q.CloudEngineClient(ctx,
198 node.RootAddress(),
199 node.PathString(),
200 nil,
201 )
202 if err != nil {
203 return true, fmt.Errorf("engine-to-engine connect: %w", err)
204 }
205 if !useCloud {
206 return false, nil
207 }
208 defer func() {
209 rerr = errors.Join(rerr, cloudClient.Close())
210 }()
211
212 query, err := node.buildScaleOutModuleQuery(cloudClient.Dagger().QueryBuilder())
213 if err != nil {
214 return true, err
215 }
216
217 query = query.Select("generator").Arg("name", node.moduleLocalPathString())
218 query = query.Select("run")
219 query = query.Select("isEmpty")
220
221 var empty bool
222 if err := query.Bind(&empty).Execute(ctx); err != nil {
223 return true, err
224 }
225
226 if !empty {
227 return true, fmt.Errorf("generate function %s produced changes; run 'dagger generate %s' to apply",
228 node.PathString(), node.PathString())
229 }
230
231 return true, nil
232}
233
234func (node *ModTreeNode) runCheckLocally(ctx context.Context) error {
235 var status dagql.AnyResult

Callers 1

RunGeneratorAsCheckMethod · 0.80

Calls 13

RootAddressMethod · 0.95
PathStringMethod · 0.95
moduleLocalPathStringMethod · 0.95
CurrentQueryFunction · 0.85
DaggerMethod · 0.80
CloudEngineClientMethod · 0.65
CloseMethod · 0.65
SelectMethod · 0.65
QueryBuilderMethod · 0.45
ArgMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected