Skip to content

Add canceled state to project import state and stage methods

Carla Drago requested to merge 366427-add-canceled-state into master

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.

  1. run the gdk from the branch: gdk start
  2. run the rails console: gdk rails console
  3. in the UI (at gdk.test:3000) import a large project from GitHub http://gdk.test:3000/projects/new#import_project (we want a large project so that the import doesn't end too soon)
  4. once the import starts, in the console find the project: project=Project.last
  5. check the project import jid (job id): project.import_state.jid
  6. check the project import data: project.import_data
  7. cancel the project import: project.import_state.cancel
  8. check the project.import_state.jid is nil
  9. check the project.import_data is nil
  10. check the project.import_status is canceled

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #366427 (closed)

Merge request reports