@@ -7,7 +7,6 @@ package local
7
7
import (
8
8
"context"
9
9
"fmt"
10
- "os"
11
10
"sync"
12
11
"time"
13
12
@@ -97,7 +96,7 @@ func (c *client) PlanBuild(ctx context.Context) error {
97
96
}
98
97
99
98
// output init progress to stdout
100
- fmt .Fprintln (os . Stdout , _pattern , "> Inspecting runtime network..." )
99
+ fmt .Fprintln (c . stdout , _pattern , "> Inspecting runtime network..." )
101
100
102
101
// inspect the runtime network for the pipeline
103
102
network , err := c .Runtime .InspectNetwork (ctx , c .pipeline )
@@ -107,7 +106,7 @@ func (c *client) PlanBuild(ctx context.Context) error {
107
106
}
108
107
109
108
// output the network information to stdout
110
- fmt .Fprintln (os . Stdout , _pattern , string (network ))
109
+ fmt .Fprintln (c . stdout , _pattern , string (network ))
111
110
112
111
// create the runtime volume for the pipeline
113
112
err = c .Runtime .CreateVolume (ctx , c .pipeline )
@@ -117,7 +116,7 @@ func (c *client) PlanBuild(ctx context.Context) error {
117
116
}
118
117
119
118
// output init progress to stdout
120
- fmt .Fprintln (os . Stdout , _pattern , "> Inspecting runtime volume..." )
119
+ fmt .Fprintln (c . stdout , _pattern , "> Inspecting runtime volume..." )
121
120
122
121
// inspect the runtime volume for the pipeline
123
122
volume , err := c .Runtime .InspectVolume (ctx , c .pipeline )
@@ -127,7 +126,7 @@ func (c *client) PlanBuild(ctx context.Context) error {
127
126
}
128
127
129
128
// output the volume information to stdout
130
- fmt .Fprintln (os . Stdout , _pattern , string (volume ))
129
+ fmt .Fprintln (c . stdout , _pattern , string (volume ))
131
130
132
131
return c .err
133
132
}
@@ -162,7 +161,7 @@ func (c *client) AssembleBuild(ctx context.Context) error {
162
161
}
163
162
164
163
// output init progress to stdout
165
- fmt .Fprintln (os . Stdout , _pattern , "> Preparing service images..." )
164
+ fmt .Fprintln (c . stdout , _pattern , "> Preparing service images..." )
166
165
167
166
// create the services for the pipeline
168
167
for _ , _service := range c .pipeline .Services {
@@ -183,11 +182,11 @@ func (c *client) AssembleBuild(ctx context.Context) error {
183
182
}
184
183
185
184
// output the image information to stdout
186
- fmt .Fprintln (os . Stdout , _pattern , string (image ))
185
+ fmt .Fprintln (c . stdout , _pattern , string (image ))
187
186
}
188
187
189
188
// output init progress to stdout
190
- fmt .Fprintln (os . Stdout , _pattern , "> Preparing stage images..." )
189
+ fmt .Fprintln (c . stdout , _pattern , "> Preparing stage images..." )
191
190
192
191
// create the stages for the pipeline
193
192
for _ , _stage := range c .pipeline .Stages {
@@ -206,7 +205,7 @@ func (c *client) AssembleBuild(ctx context.Context) error {
206
205
}
207
206
208
207
// output init progress to stdout
209
- fmt .Fprintln (os . Stdout , _pattern , "> Preparing step images..." )
208
+ fmt .Fprintln (c . stdout , _pattern , "> Preparing step images..." )
210
209
211
210
// create the steps for the pipeline
212
211
for _ , _step := range c .pipeline .Steps {
@@ -229,11 +228,11 @@ func (c *client) AssembleBuild(ctx context.Context) error {
229
228
}
230
229
231
230
// output the image information to stdout
232
- fmt .Fprintln (os . Stdout , _pattern , string (image ))
231
+ fmt .Fprintln (c . stdout , _pattern , string (image ))
233
232
}
234
233
235
234
// output a new line for readability to stdout
236
- fmt .Fprintln (os . Stdout , "" )
235
+ fmt .Fprintln (c . stdout , "" )
237
236
238
237
// assemble runtime build just before any containers execute
239
238
c .err = c .Runtime .AssembleBuild (ctx , c .pipeline )
@@ -353,14 +352,14 @@ func (c *client) StreamBuild(ctx context.Context) error {
353
352
streams , streamCtx := errgroup .WithContext (ctx )
354
353
355
354
defer func () {
356
- fmt .Fprintln (os . Stdout , "waiting for stream functions to return" )
355
+ fmt .Fprintln (c . stdout , "waiting for stream functions to return" )
357
356
358
357
err := streams .Wait ()
359
358
if err != nil {
360
- fmt .Fprintln (os . Stdout , "error in a stream request:" , err )
359
+ fmt .Fprintln (c . stdout , "error in a stream request:" , err )
361
360
}
362
361
363
- fmt .Fprintln (os . Stdout , "all stream functions have returned" )
362
+ fmt .Fprintln (c . stdout , "all stream functions have returned" )
364
363
}()
365
364
366
365
// allow the runtime to do log/event streaming setup at build-level
@@ -374,11 +373,11 @@ func (c *client) StreamBuild(ctx context.Context) error {
374
373
select {
375
374
case req := <- c .streamRequests :
376
375
streams .Go (func () error {
377
- fmt .Fprintf (os . Stdout , "[%s: %s] > Streaming container '%s'...\n " , req .Key , req .Container .Name , req .Container .ID )
376
+ fmt .Fprintf (c . stdout , "[%s: %s] > Streaming container '%s'...\n " , req .Key , req .Container .Name , req .Container .ID )
378
377
379
378
err := req .Stream (streamCtx , req .Container )
380
379
if err != nil {
381
- fmt .Fprintln (os . Stdout , "error streaming:" , err )
380
+ fmt .Fprintln (c . stdout , "error streaming:" , err )
382
381
}
383
382
384
383
return nil
@@ -399,7 +398,7 @@ func (c *client) DestroyBuild(ctx context.Context) error {
399
398
err = c .Runtime .RemoveBuild (ctx , c .pipeline )
400
399
if err != nil {
401
400
// output the error information to stdout
402
- fmt .Fprintln (os . Stdout , "unable to destroy runtime build:" , err )
401
+ fmt .Fprintln (c . stdout , "unable to destroy runtime build:" , err )
403
402
}
404
403
}()
405
404
@@ -414,7 +413,7 @@ func (c *client) DestroyBuild(ctx context.Context) error {
414
413
err = c .DestroyStep (ctx , _step )
415
414
if err != nil {
416
415
// output the error information to stdout
417
- fmt .Fprintln (os . Stdout , "unable to destroy step:" , err )
416
+ fmt .Fprintln (c . stdout , "unable to destroy step:" , err )
418
417
}
419
418
}
420
419
@@ -429,7 +428,7 @@ func (c *client) DestroyBuild(ctx context.Context) error {
429
428
err = c .DestroyStage (ctx , _stage )
430
429
if err != nil {
431
430
// output the error information to stdout
432
- fmt .Fprintln (os . Stdout , "unable to destroy stage:" , err )
431
+ fmt .Fprintln (c . stdout , "unable to destroy stage:" , err )
433
432
}
434
433
}
435
434
@@ -439,22 +438,22 @@ func (c *client) DestroyBuild(ctx context.Context) error {
439
438
err = c .DestroyService (ctx , _service )
440
439
if err != nil {
441
440
// output the error information to stdout
442
- fmt .Fprintln (os . Stdout , "unable to destroy service:" , err )
441
+ fmt .Fprintln (c . stdout , "unable to destroy service:" , err )
443
442
}
444
443
}
445
444
446
445
// remove the runtime volume for the pipeline
447
446
err = c .Runtime .RemoveVolume (ctx , c .pipeline )
448
447
if err != nil {
449
448
// output the error information to stdout
450
- fmt .Fprintln (os . Stdout , "unable to destroy runtime volume:" , err )
449
+ fmt .Fprintln (c . stdout , "unable to destroy runtime volume:" , err )
451
450
}
452
451
453
452
// remove the runtime network for the pipeline
454
453
err = c .Runtime .RemoveNetwork (ctx , c .pipeline )
455
454
if err != nil {
456
455
// output the error information to stdout
457
- fmt .Fprintln (os . Stdout , "unable to destroy runtime network:" , err )
456
+ fmt .Fprintln (c . stdout , "unable to destroy runtime network:" , err )
458
457
}
459
458
460
459
return err
0 commit comments