Skip to content

Commit 4a9f51c

Browse files
mitchell-asNaatan
authored andcommitted
Merge pull request ActiveState#3584 from ActiveState/mitchell/dx-3144
`state commit` should not poll for build result.
1 parent 9132b74 commit 4a9f51c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

internal/runners/commit/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (c *Commit) Run() (rerr error) {
160160
}
161161

162162
// Get old buildplan.
163-
oldCommit, err := bp.FetchCommit(localCommitID, proj.Owner(), proj.Name(), nil)
163+
oldCommit, err := bp.FetchCommitNoPoll(localCommitID, proj.Owner(), proj.Name(), nil)
164164
if err != nil {
165165
return errs.Wrap(err, "Failed to fetch old commit")
166166
}

pkg/platform/model/buildplanner/build.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ func (c *client) Run(req gqlclient.Request, resp interface{}) error {
5757
const fetchCommitCacheExpiry = time.Hour * 12
5858

5959
func (b *BuildPlanner) FetchCommit(commitID strfmt.UUID, owner, project string, target *string) (*Commit, error) {
60+
return b.fetchCommit(commitID, owner, project, target, true)
61+
}
62+
63+
func (b *BuildPlanner) FetchCommitNoPoll(commitID strfmt.UUID, owner, project string, target *string) (*Commit, error) {
64+
return b.fetchCommit(commitID, owner, project, target, false)
65+
}
66+
67+
func (b *BuildPlanner) fetchCommit(commitID strfmt.UUID, owner, project string, target *string, poll bool) (*Commit, error) {
6068
logging.Debug("FetchCommit, commitID: %s, owner: %s, project: %s", commitID, owner, project)
6169
resp := &response.ProjectCommitResponse{}
6270

@@ -92,7 +100,7 @@ func (b *BuildPlanner) FetchCommit(commitID strfmt.UUID, owner, project string,
92100
// The BuildPlanner will return a build plan with a status of
93101
// "planning" if the build plan is not ready yet. We need to
94102
// poll the BuildPlanner until the build is ready.
95-
if resp.Project.Commit.Build.Status == raw.Planning {
103+
if poll && resp.Project.Commit.Build.Status == raw.Planning {
96104
resp.Project.Commit.Build, err = b.pollBuildPlanned(commitID.String(), owner, project, target)
97105
if err != nil {
98106
return nil, errs.Wrap(err, "failed to poll build plan")

0 commit comments

Comments
 (0)