Add canceled state to project import state and stage methods
What does this MR do and why?
This change updates the ProjectImportState and StageMethods to handle a canceled state.
This is a part of the work required to enable cancelling of github imports in the UI.
How to set up and validate locally
As these are initial backend changes it's not possible to test things locally via the UI. However it is possible to trigger a GitHub project import in the UI, then use the rails console to cancel this import and observe changes to the project resource attributes and associations.
- run the gdk from the branch:
gdk start
- run the rails console:
gdk rails console
- in the UI (at
gdk.test:3000
) import a large project from GitHubhttp://gdk.test:3000/projects/new#import_project
(we want a large project so that the import doesn't end too soon) - once the import starts, in the console find the project:
project=Project.last
- check the project import jid (job id):
project.import_state.jid
- check the project import data:
project.import_data
- cancel the project import: project.import_state.cancel
- check the
project.import_state.jid
isnil
- check the
project.import_data
isnil
- check the
project.import_status
iscanceled
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #366427 (closed)