Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/orchestrator/internal/template/build/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/phases/steps"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/storage/cache"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/build/writer"
buildcache "github.com/e2b-dev/infra/packages/orchestrator/internal/template/cache"
"github.com/e2b-dev/infra/packages/orchestrator/internal/template/constants"
artifactsregistry "github.com/e2b-dev/infra/packages/shared/pkg/artifacts-registry"
"github.com/e2b-dev/infra/packages/shared/pkg/dockerhub"
Expand Down Expand Up @@ -128,9 +129,12 @@ func (b *Builder) Build(ctx context.Context, template storage.TemplateFiles, con

logger := zap.New(logsCore)
defer func() {
if e != nil {
switch {
case errors.Is(ctx.Err(), context.Canceled):
logger.Error(fmt.Sprintf("Build failed: %s", buildcache.CanceledBuildReason))
case e != nil:
logger.Error(fmt.Sprintf("Build failed: %v", e))
} else {
default:
logger.Info(fmt.Sprintf("Build finished, took %s",
time.Since(startTime).Truncate(time.Second).String()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
buildInfoExpiration = time.Minute * 10 // 10 minutes
)

var CancelledBuildReason = "build was cancelled"
const CanceledBuildReason = "build was cancelled"

type BuildInfoResult struct {
Status template_manager.TemplateBuildState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *ServerStore) TemplateBuildDelete(ctx context.Context, in *templatemanag
zap.L().Info("Canceling running template build", logger.WithTemplateID(in.GetTemplateID()), logger.WithBuildID(in.GetBuildID()))
telemetry.ReportEvent(ctx, "cancel in progress template build")
buildInfo.SetFail(&templatemanager.TemplateBuildStatusReason{
Message: cache.CancelledBuildReason,
Message: cache.CanceledBuildReason,
})
}

Expand Down
Loading