Skip to content

Conversation

@mitchell-as
Copy link
Collaborator

@mitchell-as mitchell-as commented Jan 16, 2025

BugDX-3205 Nightly failure: CycloneDX and SPDX SBOM imports do not create commits

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.

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.
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")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do the same thing earlier in this function:

if response.IsErrorResponse(resp.Build.Type) {
return &Commit{resp, nil, nil}, response.ProcessBuildError(resp.Build, "Could not process error response from stage commit")
}

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:

stagedCommit, err := bp.StageCommit(buildplanner.StageCommitParams{
Owner: proj.Owner(),
Project: proj.Name(),
ParentCommit: localCommitId.String(),
Description: msg,
Script: bs,
})
// Always update the local commit ID even if the commit fails to build
if stagedCommit != nil && stagedCommit.Commit != nil && stagedCommit.Commit.CommitID != "" {
if err := localcommit.Set(proj.Dir(), stagedCommit.CommitID.String()); err != nil {
return locale.WrapError(err, "err_package_update_commit_id")
}
}

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).

@mitchell-as mitchell-as marked this pull request as ready for review January 17, 2025 20:49
@mitchell-as mitchell-as merged commit 0213562 into version/0-48-0-RC1 Jan 17, 2025
12 of 16 checks passed
@mitchell-as mitchell-as deleted the mitchell/dx-3205 branch January 17, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants