Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add reason field for workspace builds #2438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 17, 2022

Conversation

AbhineetJain
Copy link
Contributor

@AbhineetJain AbhineetJain commented Jun 16, 2022

This PR adds a new reason field for workspace builds to indicate the reason for its initiation. The following values are supported: initiator, autostart, autostop.

The following combinations can arise:

Initiator Reason
initiator_id Reason.Initiator
owner_id Reason.Autostart
owner_id Reason.Autostop

In case of Reason.Autostart and Reason.Autostop, we ignore the initiator field when displaying it in the UI, and use the initiator field for the other case - the member could be admin too (or whoever the user may possibly be sharing workspaces with).

Subtasks

  • added a migration to add the new column
  • used the new column while inserting the values into workspace builds table
  • update databasefake

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

I really like this approach! Nice n' simple 😎

@AbhineetJain AbhineetJain requested a review from a team as a code owner June 16, 2022 20:59
Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

LG. Minor nit

@AbhineetJain
Copy link
Contributor Author

Handles the backend changes required for issues: #2029, #2410

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Looks good to me! I Just a couple small issues.

Transition: trans,
JobID: newProvisionerJob.ID,

err = store.InTx(func(db database.Store) error {
Copy link
Member

Choose a reason for hiding this comment

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

This is already in one big transaction, see line 80 -- since we're already in a tx, this ends up being a no-op

Copy link
Member

Choose a reason for hiding this comment

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

Oh TIL. I didn't see that @AbhineetJain

Copy link
Contributor Author

@AbhineetJain AbhineetJain Jun 17, 2022

Choose a reason for hiding this comment

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

Thanks @johnstcn. This was also the reason the tests were failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue: #2468

@AbhineetJain AbhineetJain force-pushed the abhineetjain/2029-show-build-reason-in-ui branch from 778b819 to 4802eaf Compare June 17, 2022 16:15
@AbhineetJain AbhineetJain force-pushed the abhineetjain/2029-show-build-reason-in-ui branch from 4802eaf to c5b9aac Compare June 17, 2022 16:21
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Nice work!

@AbhineetJain AbhineetJain merged commit 289b989 into main Jun 17, 2022
@AbhineetJain AbhineetJain deleted the abhineetjain/2029-show-build-reason-in-ui branch June 17, 2022 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants