diff --git a/executor/linux/build.go b/executor/linux/build.go index e85a52ce..cfb6eff5 100644 --- a/executor/linux/build.go +++ b/executor/linux/build.go @@ -42,9 +42,6 @@ func (c *client) CreateBuild(ctx context.Context) error { b.SetStatus(constants.StatusError) } - // update the build fields - b.SetFinished(time.Now().UTC().Unix()) - c.logger.Info("uploading build state") // send API call to update the build _, _, err := c.Vela.Build.Update(r.GetOrg(), r.GetName(), b) @@ -69,6 +66,8 @@ func (c *client) CreateBuild(ctx context.Context) error { return fmt.Errorf("unable to upload start state: %w", err) } + c.build = b + // TODO: make this better init := new(pipeline.Container) if len(p.Steps) > 0 { @@ -288,9 +287,6 @@ func (c *client) CreateBuild(ctx context.Context) error { l.SetData(append(l.GetData(), image...)) } - b.SetStatus(constants.StatusSuccess) - c.build = b - return nil } @@ -301,6 +297,9 @@ func (c *client) ExecBuild(ctx context.Context) error { r := c.repo e := c.err + b.SetStatus(constants.StatusSuccess) + c.build = b + defer func() { // NOTE: When an error occurs during a build that does not have to do // with a pipeline we should set build status to "error" not "failed"