Just recently I needed a way to create +50 projects. Being the lazy ops guy I am, I quickly whipped this up using NARKOZ’s Ruby wrapper.
The tricky part was switching the context to a different namespace which was only possible using two undocumented parameters.
Patch sent and awaiting approval merged.
#!/usr/bin/env ruby require 'gitlab' group_id = 5 token = 'sekret' endpoint = 'http://gitlab.tld/api/v3' projects = %w( project-1 project-2 project-n ... ) Gitlab.configure do |config| config.endpoint = endpoint config.private_token = token end projects.each do |proj| Gitlab.create_project( proj, :description => "Project #{proj}", :issues_enabled => true, :wiki_enabled => false, :group_id => group_id, :namespace_id => group_id ) end
Be First to Comment