Skip to content

Commit

Permalink
fix(exec): move secret.exec to ExecBuild and assemble prior to st…
Browse files Browse the repository at this point in the history
…reaming (#544)

* init commit

* remove patch file

* add back progress log in AssembleBuild
  • Loading branch information
ecrupper authored Nov 27, 2023
1 parent c07a1a8 commit b45d0ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions cmd/vela-worker/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ func (w *Worker) exec(index int, config *library.Worker) error {
return nil
}

logger.Info("assembling build")
// assemble the build with the executor
err = _executor.AssembleBuild(timeoutCtx)
if err != nil {
logger.Errorf("unable to assemble build: %v", err)
return nil
}

// add StreamBuild goroutine to WaitGroup
wg.Add(1)

Expand All @@ -282,14 +290,6 @@ func (w *Worker) exec(index int, config *library.Worker) error {
}
}()

logger.Info("assembling build")
// assemble the build with the executor
err = _executor.AssembleBuild(timeoutCtx)
if err != nil {
logger.Errorf("unable to assemble build: %v", err)
return nil
}

logger.Info("executing build")
// execute the build with the executor
err = _executor.ExecBuild(timeoutCtx)
Expand Down
14 changes: 7 additions & 7 deletions executor/linux/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,6 @@ func (c *client) AssembleBuild(ctx context.Context) error {
// https://pkg.go.dev/github.com/go-vela/types/library#Log.AppendData
_log.AppendData([]byte("> Executing secret images...\n"))

c.Logger.Info("executing secret images")
// execute the secret
c.err = c.secret.exec(ctx, &c.pipeline.Secrets)
if c.err != nil {
return fmt.Errorf("unable to execute secret: %w", c.err)
}

return c.err
}

Expand All @@ -513,6 +506,13 @@ func (c *client) ExecBuild(ctx context.Context) error {
build.Upload(c.build, c.Vela, c.err, c.Logger, c.repo)
}()

c.Logger.Info("executing secret images")
// execute the secret
c.err = c.secret.exec(ctx, &c.pipeline.Secrets)
if c.err != nil {
return fmt.Errorf("unable to execute secret: %w", c.err)
}

// execute the services for the pipeline
for _, _service := range c.pipeline.Services {
c.Logger.Infof("planning %s service", _service.Name)
Expand Down

0 comments on commit b45d0ce

Please sign in to comment.