Miscellaneous Snippets for the GitLab Rails Console¶
That looks cool!
project = Project.find(ID)
Gitlab::Kas::Client.new.list_agent_config_files(project: project)
Looking at environment variables:
ENV.key?('no_proxy')
ENV['no_proxy']
prj=Project.find_by_full_path("hello/world");
prj.container_expiration_policy.update_attribute(:enabled, true);
prj.container_expiration_policy.save;
Move repository storages while bypassing Sidekiq:
user_project = Project.find(9)
storage_move = user_project.repository_storage_moves.create!(source_storage_name: user_project.repository_storage, destination_storage_name: 'storage-2')
storage_move.container.set_repository_read_only!(skip_git_transfer_check: true)
storage_move.state = 2
storage_move.save!
storage_move.reload
Projects::UpdateRepositoryStorageService.new(storage_move).execute
Snippets¶
These are things that are in actual snippets on gitlab.com
:
- ℹ [GitLab] Check whether 2FA is enforced for an entire instance
- You can browse through all of my snippets.