Return a commit even if there's a polling error.#3630
Merged
mitchell-as merged 1 commit intoversion/0-48-0-RC1from Jan 17, 2025
Merged
Return a commit even if there's a polling error.#3630mitchell-as merged 1 commit intoversion/0-48-0-RC1from
mitchell-as merged 1 commit intoversion/0-48-0-RC1from
Conversation
Recent Platform changes have resulted in every stageCommit call responding with "build planning". `state import` does not care if the plan ultimately fails due to requirements not being found. It should still make the commit.
mitchell-as
commented
Jan 17, 2025
| resp.Build, err = b.pollBuildPlanned(resp.CommitID.String(), params.Owner, params.Project, nil) | ||
| if err != nil { | ||
| return nil, errs.Wrap(err, "failed to poll build plan") | ||
| return &Commit{resp, nil, nil}, errs.Wrap(err, "failed to poll build plan") |
Collaborator
Author
There was a problem hiding this comment.
We do the same thing earlier in this function:
cli/pkg/platform/model/buildplanner/commit.go
Lines 65 to 67 in 2d271e1
It's up to the caller to handle error conditions, and state import does something with the returned commit, even if there's an error:
cli/internal/runners/packages/import.go
Lines 129 to 141 in 2d271e1
Other callers just error if err is not nil. The point is, it's okay to return the commit returned by StageCommit, even if there was ultimately an error (the commit was created after all; it just doesn't build).
tjsanterre
approved these changes
Jan 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recent Platform changes have resulted in every stageCommit call responding with "build planning".
state importdoes not care if the plan ultimately fails due to requirements not being found. It should still make the commit.