Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !4363

Closed
Created Jun 20, 2013 by Administrator@rootOwner
  • Report abuse
Report abuse

Add support for creation and removal of branches and tags.

  • Overview 29
  • Commits 5
  • Changes 6

Created by: thomasbiddle

This commit takes advantage of the commit I added to gitlab-shell.

Added API endpoints for POST (Create) and DELETE (Delete, duh.) of branch and tag resources. It takes advantage using Sidekiq to throw the actions into a background process as Gitlab does for many other actions; however Gitlab is setup to cache the branches and tags - So we need to expire the cache. There's a nice existing expire_cache method in the repository model to do this.

We can run into an issue with race conditions in which the expire_cache would be called before the branch was created, rendering it moot - But (Would need to double check this) I believe many other actions expire the cache anyhow - So on any active project it would be updated soon anyhow. I originally thought about passing along the repository object into Sidekiq but this caused Redis to lock up entirely and until I flushed all keys it wouldn't run any sidekiq jobs, even if I cleared them.

This is a very useful feature as personally I integrate with Gitlab and would like to create tags and branches upon different actions when deploying to various environments (Deploy to staging - Create a release candidate branch, deploy to prod - Create a tag)

See GitHub's API for a reference as they support a similar setup: http://developer.github.com/v3/git/refs/

Let me know if there is anything that could be improved!

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/thomasbiddle/support_creating_and_deleting_branches_and_tags_from_api