Skip to content

Commit

Permalink
Only use buildplanner if branch is set
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Sep 6, 2023
1 parent 6721e1c commit 9dfb2d8
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions internal/runners/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,22 +210,21 @@ func (r *Push) Run(params PushParams) error {

// Update the project at the given commit id.
bp := model.NewBuildPlannerModel(r.auth)
var branchCommitID string
if branch.CommitID != nil {
branchCommitID = branch.CommitID.String()
}
err = bp.AttachStagedCommit(targetNamespace.Owner, targetNamespace.Project, branchCommitID, commitID.String(), branch.Label)
if err != nil {
return locale.WrapError(err, "err_push_attach_staged_commit", "Failed to attach staged commit to project.")
err = bp.AttachStagedCommit(targetNamespace.Owner, targetNamespace.Project, branch.CommitID.String(), commitID.String(), branch.Label)
if err != nil {
return locale.WrapError(err, "err_push_attach_staged_commit", "Failed to attach staged commit to project.")
}
} else {
err = model.UpdateProjectBranchCommitWithModel(targetPjm, branch.Label, commitID)
if err != nil {
if errs.Matches(err, &model.ErrUpdateBranchAuth{}) {
return locale.WrapInputError(err, "push_project_branch_no_permission", "You do not have permission to push to {{.V0}}.", targetNamespace.String())
} else {
return locale.WrapError(err, "push_project_branch_commit_err", "Failed to update new project {{.V0}} to current commitID.", targetNamespace.String())
}
}
}
// err = model.UpdateProjectBranchCommitWithModel(targetPjm, branch.Label, commitID)
// if err != nil {
// if errs.Matches(err, &model.ErrUpdateBranchAuth{}) {
// return locale.WrapInputError(err, "push_project_branch_no_permission", "You do not have permission to push to {{.V0}}.", targetNamespace.String())
// } else {
// return locale.WrapError(err, "push_project_branch_commit_err", "Failed to update new project {{.V0}} to current commitID.", targetNamespace.String())
// }
// }

// Write the project namespace to the as.yaml, if it changed
if r.project.Owner() != targetNamespace.Owner || r.project.Name() != targetNamespace.Project {
Expand Down

0 comments on commit 9dfb2d8

Please sign in to comment.