Skip to content
  • I'm desperately seeking a way to force delete some partially deleted (pending_delete?) projects in my gitlab server. I've found my way here. Can you shed some light on how to run this ruby script against my local gitlab DB? Thanks

  • Owner

    You should be able to run this script via sudo gitlab-rails runner /path/to/script.rb.

    Be sure to make a full backup before you do.

  • We have an install of Gitlab running in a Docker container. I'm trying to run this script with the following command;

    sudo docker exec -t gitlab gitlab-rails runner clean_projects.rb

    But it's giving me the error;

    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/runner.rb:62:in <top (required)>': undefined local variable or method clean_projects' for main:Object (NameError)

    Is this not the correct way to run the script for a Docker instance? Thanks.

  • My bad. I had to copy the script into the Docker container. To do that i just copied it to temp;

    sudo docker cp clean_projects.rb gitlab:/tmp

    And then run the gitlab-rails runner with the path /tmp/clean_projects.rb

  • How long should this process take? When i run the script i see;

    Remove *** (ID: 72)? (y/n): y Removing project team... Unlinking fork... Removing project...

    So far ( > 2 hours ) it seems to be stuck on the 'Removing project' stage

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment