Module: GitlabTools
- Defined in:
- lib/citasks/ci_lib.rb
Class Method Summary collapse
- ._setup_gitlab(gitlab_url, token) ⇒ Object
- .delete!(repo_name, gitlab_url, token) ⇒ Object
- .new_repo(repo_name, gitlab_url, token) ⇒ Object
- .setup_hook(repo_name, gitlab_url, token, hooked_url, secret_token = nil) ⇒ Object
Class Method Details
._setup_gitlab(gitlab_url, token) ⇒ Object
262 263 264 265 |
# File 'lib/citasks/ci_lib.rb', line 262 def self._setup_gitlab gitlab_url, token Gitlab.endpoint = "#{gitlab_url}/api/v4" Gitlab.private_token = token end |
.delete!(repo_name, gitlab_url, token) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/citasks/ci_lib.rb', line 285 def self.delete! repo_name, gitlab_url, token _setup_gitlab gitlab_url, token project = Gitlab.projects.find do |p| p.name== repo_name end if project.nil? puts "repo #{repo_name} doesn't exists" return end Gitlab.delete_project project.id end |
.new_repo(repo_name, gitlab_url, token) ⇒ Object
267 268 269 270 |
# File 'lib/citasks/ci_lib.rb', line 267 def self.new_repo repo_name, gitlab_url, token _setup_gitlab gitlab_url, token Gitlab.create_project repo_name end |
.setup_hook(repo_name, gitlab_url, token, hooked_url, secret_token = nil) ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/citasks/ci_lib.rb', line 272 def self.setup_hook repo_name, gitlab_url, token, hooked_url, secret_token=nil _setup_gitlab gitlab_url, token project = Gitlab.projects.find do |p| p.name== repo_name end secret_token = token_shared_persistently if secret_token.nil? Gitlab.add_project_hook project.id, hooked_url, :push_events => 1,:enable_ssl_verification=>0, :token=> secret_token end |