Skip to content

Commit

Permalink
Update build status handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Aug 22, 2023
1 parent 0011409 commit 301154e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/platform/api/buildplanner/model/buildplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
// BuildPlan statuses
Planning = "PLANNING"
Planned = "PLANNED"
Building = "BUILDING"
Started = "STARTED"
Completed = "COMPLETED"

// Artifact statuses
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/model/buildplanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/ActiveState/cli/pkg/platform/api/buildplanner/model"
bpModel "github.com/ActiveState/cli/pkg/platform/api/buildplanner/model"
"github.com/ActiveState/cli/pkg/platform/api/buildplanner/request"
"github.com/ActiveState/cli/pkg/platform/api/headchef"
"github.com/ActiveState/cli/pkg/platform/api/headchef/headchef_models"
"github.com/ActiveState/cli/pkg/platform/api/reqsimport"
"github.com/ActiveState/cli/pkg/platform/authentication"
Expand Down Expand Up @@ -53,7 +52,7 @@ type BuildResult struct {
CommitID strfmt.UUID
Build *bpModel.Build
BuildStatusResponse *headchef_models.V1BuildStatusResponse
BuildStatus headchef.BuildStatusEnum
BuildStatus string
BuildReady bool
}

Expand Down Expand Up @@ -154,6 +153,7 @@ func (bp *BuildPlanner) FetchBuildResult(commitID strfmt.UUID, owner, project st
BuildEngine: buildEngine,
Build: build,
BuildReady: build.Status == bpModel.Completed,
BuildStatus: build.Status,
CommitID: id,
}

Expand Down
7 changes: 1 addition & 6 deletions pkg/platform/runtime/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/ActiveState/cli/internal/rtutils/ptr"
"github.com/ActiveState/cli/internal/svcctl"
"github.com/ActiveState/cli/internal/unarchiver"
"github.com/ActiveState/cli/pkg/platform/api/headchef"
"github.com/ActiveState/cli/pkg/platform/api/inventory/inventory_models"
"github.com/ActiveState/cli/pkg/platform/authentication"
apimodel "github.com/ActiveState/cli/pkg/platform/model"
Expand Down Expand Up @@ -429,14 +428,10 @@ func (s *Setup) fetchAndInstallArtifactsFromBuildPlan(installFunc artifactInstal
}

// send analytics build event, if a new runtime has to be built in the cloud
if buildResult.BuildStatus == headchef.Started {
if buildResult.BuildStatus == bpModel.Started {
s.analytics.Event(anaConsts.CatRuntime, anaConsts.ActRuntimeBuild, dimensions)
}

if buildResult.BuildStatus == headchef.Failed {
return nil, nil, &BuildError{locale.NewError("headchef_build_failure", "Build Failed: {{.V0}}", buildResult.BuildStatusResponse.Message)}
}

changedArtifacts, err := buildplan.NewBaseArtifactChangesetByBuildPlan(buildResult.Build, false)
if err != nil {
return nil, nil, errs.Wrap(err, "Could not compute base artifact changeset")
Expand Down

0 comments on commit 301154e

Please sign in to comment.