diff --git a/internal/runners/packages/import.go b/internal/runners/packages/import.go index e25c4a8071..43336fa51f 100644 --- a/internal/runners/packages/import.go +++ b/internal/runners/packages/import.go @@ -134,19 +134,20 @@ func (i *Import) Run(params *ImportRunParams) (rerr error) { 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 { + solveSpinner.Stop(locale.T("progress_fail")) + return locale.WrapError(err, "err_package_update_commit_id") + } + pg.Stop(locale.T("progress_success")) + pg = nil + } if err != nil { solveSpinner.Stop(locale.T("progress_fail")) return locale.WrapError(err, "err_commit_changeset", "Could not commit import changes") } - pg.Stop(locale.T("progress_success")) - pg = nil - - if err := localcommit.Set(proj.Dir(), stagedCommit.CommitID.String()); err != nil { - solveSpinner.Stop(locale.T("progress_fail")) - return locale.WrapError(err, "err_package_update_commit_id") - } - // Output change summary. previousCommit, err := bp.FetchCommit(localCommitId, proj.Owner(), proj.Name(), nil) if err != nil { diff --git a/pkg/platform/model/buildplanner/commit.go b/pkg/platform/model/buildplanner/commit.go index ef506bcfbc..50f6ef98e3 100644 --- a/pkg/platform/model/buildplanner/commit.go +++ b/pkg/platform/model/buildplanner/commit.go @@ -64,7 +64,7 @@ func (b *BuildPlanner) StageCommit(params StageCommitParams) (*Commit, error) { } if response.IsErrorResponse(resp.Commit.Build.Type) { - return nil, response.ProcessBuildError(resp.Commit.Build, "Could not process error response from stage commit") + return &Commit{resp.Commit, nil, nil}, response.ProcessBuildError(resp.Commit.Build, "Could not process error response from stage commit") } // The BuildPlanner will return a build plan with a status of