-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore unlock action on queued checkruns (#774)
When we update checkruns for queued commits (after the blocking commit gets confirmed or rejected), we need to check if the queue was previously locked by something else and restore the unlock button for each commit. ### Sequence of events without this change: 1. Queue is locked due to diverged commits on latest deployment vs current plan (i.e. if someone previously force applied). All queued commits should have a unlock button. 2. New commit comes in with a pending confirm/reject action. My other PR makes it so that all queued checkruns are updated to reflect that the queue is waiting on this confirm reject action. <img width="1461" alt="Screenshot 2024-11-08 at 3 08 07 PM" src="https://github.com/user-attachments/assets/3daf3dc4-a95a-411c-983c-8ad95f53d2e7"> 4. Confirm/reject commit gets resolved. All queued commit checkruns get updated to the default status, without the unlock button. Currently users would have to click on the commit they want to unlock (first screenshot below), then click on an older checkrun of that commit (linked in blue) to access the unlock button (2nd screenshot below). <img width="877" alt="Screenshot 2024-11-08 at 3 07 08 PM" src="https://github.com/user-attachments/assets/5c86a489-f18f-45cd-b887-583774ccaa0a"> <img width="1243" alt="Screenshot 2024-11-08 at 3 07 17 PM" src="https://github.com/user-attachments/assets/0fa5b694-6350-450a-9155-7a3ca7583b48"> ### After this change: 4. (Previous step 4) All queued commit checkruns get updated back to its original status from before the confirm/reject commit was applied, **including** unlock actions if the queue was previously locked. ### Additional notes: * LockState is migrated out of the queue package into its own `lock` package to avoid cyclic imports with terraform module * bumping max interfacebloat golangci error to allow adding GetLockState() function to queue interface ### Testing 1. Open PR 1. Force apply PR 1, and verify that the force apply is successful. 2. Open PR 2. Merge PR 2 to master, and verify that PR 2 deployment failed and is now locked on PR 1's last commit (there should be an unlock button and link to the locking commit). 3. Open PR 3. Force apply PR 3, and verify that there is a Confirm/Reject action. 4. Verify that PR 2's deployment checkrun on master has an updated summary with link to the pending Confirm/Reject run on PR 3. 5. Reject forced apply on PR 3. 6. Verify that PR 2's deployment checkrun updates again, this time back to the original checkrun summary from step 2. If the queue was previously locked (which it was), there should be an unlock button.
- Loading branch information
Showing
16 changed files
with
129 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ issues: | |
- dogsled | ||
linters-settings: | ||
interfacebloat: | ||
max: 6 | ||
max: 7 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package lock | ||
|
||
type LockStatus int | ||
|
||
type LockState struct { | ||
Revision string | ||
Status LockStatus | ||
} | ||
|
||
const ( | ||
UnlockedStatus LockStatus = iota | ||
LockedStatus | ||
|
||
QueueDepthStat = "queue.depth" | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.