-
Notifications
You must be signed in to change notification settings - Fork 79
Implement NonLinearFlowException Handling #6135
Copy link
Copy link
Open
Description
Context
Currently when we try to flow a build from a different branch than the one that's in the vmr/repo, we get a non linear flow exception. This exception is not handled, and always results in a failed workitem.
When we see this failed workitem, we manually resolve the issue, using the --unsafe flag in the darc vmr *flow commands.
We want to automate this process as much as we can, so when we detect that this is happening, we want the service to do the --unsafe flow us, and open a PR with clear messaging that reviewers need to take extra care when reviewing.
We also want to mention the vmr reset as an alternative if the repo owners don't care about losing some changes in the VMR.
Flow
flowchart TD
trigger[Codeflow triggered]
linearity[Codeflow linearity check fails]
olderCommit[Are we trying to flow an older commit?]
doNothing[Do nothing]
throwError[Throw error NonLinearityException]
prUpdaterCatch[PR Updater catches NonLinearityException]
prInProgress[Is there an in Progress PR?]
closePR[Close PR with a message]
isItABackflow[Is it a backflow?]
checkVmr[Check if we're trying to backflow contents of one branch to a different one]
error[Error: We can't backflow contents of one branch to a different one. Please create a new PR with the correct target branch.]
unsafeFlow[Retry the codeflow operation with unsafe flag]
success[Was the unsafe flow succesfull?]
error1[Error: The unsafe flow also failed. Please investigate the issue and try again.]
anyConflicts[Are there any conflicts?]
conflict[Open an empty PR with the resolve-conflict message, but we also add the `--unsafe` flag to it. The message also says that this will be an unsafe flow and to be careful when reviewing it]
noConflict[Open a PR with the codeflow changes, say that it was made using the `--unsafe` flag and to be careful when reviewing it]
trigger --> linearity
linearity --> olderCommit
olderCommit -->|No| throwError
olderCommit -->|Yes| doNothing
throwError --> prUpdaterCatch
prUpdaterCatch --> prInProgress
prInProgress -->|Yes| closePR
prInProgress -->|No| isItABackflow
closePR --> isItABackflow
isItABackflow -->|Yes| checkVmr
isItABackflow -->|No| unsafeFlow
checkVmr -->|Yes| error
checkVmr -->|No| unsafeFlow
unsafeFlow --> success
success --> |No| error1
success --> |Yes| anyConflicts
anyConflicts -->|Yes| conflict
anyConflicts -->|No| noConflict
Goal
- Handle NonLinearExceptions where possible
- When opening a PR have CLEAR messaging about the nature of the
--unsafeflow
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels