Skip to content
Snippets Groups Projects

Add error handling for workspace project cloning

Merged Vishal Tak requested to merge vtak/fix_workspace_cloning_issue into master
All threads resolved!

Issue: BUG: Errors are not properly handled when proje... (#471531 - closed)

What does this MR do and why?

Current logic of project cloning is faulty. If there is some error mid-cloning, the project is not cloned successfully again because we only check for the existence of project folder which will be present.

Ideally, the project should be cloned only if one is not cloned successfully already. This is required to avoid resetting user's modifications to the files. This is achieved by checking for the existence of a file before cloning. If the file does not exist, clone the project. To accommodate for scenarios where the project cloning failed midway in the previous attempt, remove the directory before cloning. Once cloning is successful, create the file which is used in the check above. This will ensure the project is not cloned again on restarts.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a workspace. Check the logs of the project cloner container. It should clone the project from scratch.
$ kubectl logs -f workspace-1-1-ornkbn-67c57bd4c-h4kq8 -c gl-cloner-injector-gl-cloner-injector-command-1
Cloning project
Cloning into '/projects/gitlab-shell'...
Project cloning successful
Updated file to indicate successful project cloning
  1. Restart the workspace. Check the logs of the project cloner container. It should not clone the project.
$ kubectl logs -f workspace-1-1-ornkbn-67c57bd4c-9mx4p -c gl-cloner-injector-gl-cloner-injector-command-1
Project cloning was already successful
Edited by Vishal Tak

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Chad Woolley requested changes

    requested changes

  • Zhaochen Li
  • Zhaochen Li requested changes

    requested changes

  • Vishal Tak added 234 commits

    added 234 commits

    Compare with previous version

  • Chad Woolley
  • Chad Woolley requested changes

    requested changes

  • requested review from @cwoolley-gitlab

  • Vishal Tak changed the description

    changed the description

  • Chad Woolley resolved all threads

    resolved all threads

  • Chad Woolley approved this merge request

    approved this merge request

  • Chad Woolley requested review from @zhaochen_li

    requested review from @zhaochen_li

  • Zhaochen Li approved this merge request

    approved this merge request

  • Zhaochen Li resolved all threads

    resolved all threads

  • Chad Woolley removed this merge request from the merge train

    removed this merge request from the merge train

  • Chad Woolley enabled automatic add to merge train when checks pass

    enabled automatic add to merge train when checks pass

  • Chad Woolley added this merge request to the merge train at position 2

    added this merge request to the merge train at position 2

  • merged

  • Chad Woolley mentioned in commit 694a8c28

    mentioned in commit 694a8c28

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading