- Find specific methods for an object
- Find method source
- Attributes
- Limiting output
- Get or store the result of last operation
- Open object in irb
- Query the database using an ActiveRecord Model
- View all keys in cache
- Profile a page
- Using the GitLab profiler inside console (used as of 10.5)
- Time an operation
- Feature flags
- Command Line
-
Projects
- Clear a project’s cache
- Expire the .exists? cache
- Make all projects private
- Find projects that are pending deletion
- Destroy a project
- Remove fork relationship manually
- Make a project read-only (can only be done in the console)
- Transfer project from one namespace to another
- Bulk update service integration password for all projects
- Bulk update push rules for all projects
- Bulk update to change all the Jira integrations to Jira instance-level values
- Wikis
- Issue boards
- Imports and exports
- Repository
- Mirrors
-
Users
- Create new user
- Skip reconfirmation
- Disable 2fa for single user
- Active users & Historical users
- Update Daily Billable & Historical users
- Block or Delete Users that have no projects or groups
- Deactivate Users that have no recent activity
- Block Users that have no recent activity
- Find a user’s max permissions for project/group
-
Groups
- Transfer group to another location
- Count unique users in a group and subgroups
- Find groups that are pending deletion
- Delete a group
- Modify group project creation
- Modify group - disable 2FA requirement
- Check and toggle a feature for all projects in a group
- Get all error messages associated with groups, subgroups, members, and requesters
- Authentication
- SCIM
- Routes
- Merge requests
-
CI
- Cancel stuck pending pipelines
- Remove artifacts more than a week old
- Find reason failure (for when build trace is empty) (Introduced in 10.3.0)
- Try CI integration
- Validate the
.gitlab-ci.yml
- Disable AutoDevOps on Existing Projects
- Obtain runners registration token
- Seed runners registration token
- Run pipeline schedules manually
- License
- Registry
- Sidekiq
- Redis
- LFS
- Decryption Problems
- Geo
- Gitaly
- Generate Service Ping
- Kubernetes integration
- Elasticsearch
GitLab Rails Console Cheat Sheet
This is the GitLab Support Team’s collection of information regarding the GitLab Rails console, for use while troubleshooting. It is listed here for transparency, and it may be useful for users with experience with these tools. If you are currently having an issue with GitLab, it is highly recommended that you first check our guide on navigating our Rails console, and your support options, before attempting to use this information.
Some of these scripts could be damaging if not run correctly,
or under the right conditions. We highly recommend running them under the
guidance of a Support Engineer, or running them in a test environment with a
backup of the instance ready to be restored, just in case.
As GitLab changes, changes to the code are inevitable,
and so some scripts may not work as they once used to. These are not kept
up-to-date as these scripts/commands were added as they were found/needed. As
mentioned above, we recommend running these scripts under the supervision of a
Support Engineer, who can also verify that they continue to work as they
should and, if needed, update the script for the latest version of GitLab.
Find specific methods for an object
Array.methods.select { |m| m.to_s.include? "sing" }
Array.methods.grep(/sing/)
Find method source
instance_of_object.method(:foo).source_location
# Example for when we would call project.private?
project.method(:private?).source_location
Attributes
View available attributes, formatted using pretty print (pp
).
For example, determine what attributes contain users’ names and email addresses:
u = User.find_by_username('someuser')
pp u.attributes
Partial output:
{"id"=>1234,
"email"=>"someuser@example.com",
"sign_in_count"=>99,
"name"=>"S User",
"username"=>"someuser",
"first_name"=>nil,
"last_name"=>nil,
"bot_type"=>nil}
Then make use of the attributes, testing SMTP, for example:
e = u.email
n = u.name
Notify.test_email(e, "Test email for #{n}", 'Test email').deliver_now
#
Notify.test_email(u.email, "Test email for #{u.name}",