Skip to content
Snippets Groups Projects

Add routes to allow git actions on snippet repositories

All threads resolved!

What does this MR do?

In this MR we implement the following:

  • Refactors the git_http routes because, for now, snippet repositories won't support LFS (mainly because lfs_enabled is a project feature and we have to think if we could enable it by default for personal snippets).
  • It also updates the GitHttpController(s) and the SSH internal API to allow basic cloning/pushing/pulling operations for resources other than projects.

Refs #39176 (closed) Closes #205666 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by Markus Koller

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    • 7ecbc3ef - Create snippet repository models

    Compare with previous version

  • added 1 commit

    • 8c556d96 - Create snippet repository models

    Compare with previous version

  • added 32 commits

    Compare with previous version

  • added 1 commit

    • 20cc8b71 - Create snippet repository models

    Compare with previous version

  • added 136 commits

    Compare with previous version

  • added 36 commits

    Compare with previous version

  • Francisco Javier López marked the checklist item Changelog entry as completed

    marked the checklist item Changelog entry as completed

  • Francisco Javier López unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Heinrich Lee Yu assigned to @fjsanpedro and unassigned @engwan

    assigned to @fjsanpedro and unassigned @engwan

  • added 1 commit

    • aaa9ccbb - Code review comments applied

    Compare with previous version

  • added 1 commit

    • 6d07d763 - Create snippet repository models

    Compare with previous version

  • added 182 commits

    Compare with previous version

  • added 1 commit

    • a3d9f927 - Create snippet repository models

    Compare with previous version

  • added 1 commit

    • d0359232 - Create snippet repository models

    Compare with previous version

  • Thanks very much @engwan for the review!!. I know it's not an easy MR, but in order to have a quick way to revert it in case something goes south, I have to keep most of the new changes together.

    Do you mind another review?

  • assigned to @engwan and unassigned @fjsanpedro

  • Francisco Javier López marked as a Work In Progress

    marked as a Work In Progress

  • added 107 commits

    Compare with previous version

  • added 193 commits

    Compare with previous version

  • added 1 commit

    • 7beb15df - Create snippet repository models

    Compare with previous version

  • @nick.thomas would you mind to take a look at this MR? it needs some groupsource code love (sorry in advance for the size but it's better if we have to revert it).

  • added 174 commits

    Compare with previous version

  • @nick.thomas I'm unassigning you for now and assigning @brodock to polish some things regarding not using old legacy storage.

    @brodock do you mind to take a look?

  • assigned to @brodock and unassigned @nick.thomas

  • added 204 commits

    Compare with previous version

  • added 52 commits

    • 9734358d...337e1fe2 - 51 commits from branch master
    • 7d907672 - Create snippet repository models

    Compare with previous version

  • added 1 commit

    • 12a9afb2 - Create snippet repository models

    Compare with previous version

  • Another thing I thought about is the moving of repositories to other nodes. We would probably need to update the service to also move the project snippet repositories when the project is moved to another gitaly node?

    And for the personal snippets, I guess we just don't support moving of these for now?

    • Resolved by Francisco Javier López

      @engwan project snippets aren't located inside the project hashed storage. They will be stored under @hashed/snippets/.... If a project is moved to a different gitaly node, do we really need to move the snippet from the existing location?.

      Anyway, we can work on that in a different MR, this one already too big. WDYT?

  • added 1 commit

    • 7ef76c1d - Renamed subject to repositorable

    Compare with previous version

  • added 300 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 78 commits

    Compare with previous version

  • added 388 commits

    Compare with previous version

  • changed milestone to %12.8

  • mentioned in issue #39514 (closed)

  • mentioned in merge request !22960 (merged)

  • added 137 commits

    Compare with previous version

  • added 1 commit

    • 4574d14a - Create snippet repository models

    Compare with previous version

  • added 1 commit

    • 6b7b29d9 - Refactored repository#project

    Compare with previous version

  • added 2 commits

    • ef2c5948 - Small refactor
    • 06119f68 - Trying to fix bug with Geo::DeletedProject

    Compare with previous version

  • mentioned in merge request !23494 (merged)

  • added 137 commits

    Compare with previous version

  • added 1 commit

    • c400530e - Code review comments applied

    Compare with previous version

  • added 260 commits

    Compare with previous version

  • Thanks @fjsanpedro, this is looking much better now :thumbsup:

  • added 1 commit

    • 189047eb - Create snippet repository models

    Compare with previous version

  • mentioned in merge request !23678 (merged)

  • added 156 commits

    Compare with previous version

  • added 1 commit

    • 583d5644 - Create snippet repository models

    Compare with previous version

  • added 1 commit

    • 0e8f7c24 - Create snippet repository models

    Compare with previous version

  • added 61 commits

    Compare with previous version

  • added 1 commit

    • 3d99b226 - Create snippet repository models

    Compare with previous version

    • Resolved by Nick Thomas

      @tmslvnkc hi :wave:, for this issue I'd like to several QA tests. Specifically:

      • clone a personal snippet through HTTP (ie. git clone http://127.0.0.1:3000/snippets/1.git)
      • clone a personal snippet through SSH (ie. git clone ssh://fran@localhost:2221/snippets/1.git)
      • clone a project snippet through HTTP (ie. git clone http://127.0.0.1:3000/h5bp/html5-boilerplate/snippets/53.git)
      • clone a project snippet through SSH (ie. git clone ssh://fran@localhost:2221/h5bp/html5-boilerplate/snippets/53.git)
      • clone a project snippet through HTTP, using a project moved to a different namespace and using the old project url.
      • clone a project snippet through SSH, using a project moved to a different namespace and using the old project url.

      I'm not acquainted with QA and its structure. Could you help me with these tests?

  • added 1 commit

    • 8b4c0692 - Create snippet repository models

    Compare with previous version

  • added 66 commits

    Compare with previous version

  • added 1 commit

    • 247eee82 - Create snippet repository models

    Compare with previous version

  • assigned to @fjsanpedro and unassigned @brodock

  • added 104 commits

    Compare with previous version

  • added 85 commits

    Compare with previous version

  • added 75 commits

    Compare with previous version

  • added 1 commit

    • a736e307 - Create snippet repository models

    Compare with previous version

  • added 72 commits

    Compare with previous version

  • added 765 commits

    Compare with previous version

  • Francisco Javier López unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Francisco Javier López changed title from WIP: Version Control for Snippets: Create repository model for snippets to Add routes to allow git actions on snippet repositories

    changed title from WIP: Version Control for Snippets: Create repository model for snippets to Add routes to allow git actions on snippet repositories

  • Francisco Javier López changed the description

    changed the description

  • added 1286 commits

    Compare with previous version

  • added 1 commit

    • 72e523c1 - Removing unnecessary changes

    Compare with previous version

  • added 2 commits

    Compare with previous version

  • Francisco Javier López changed the description

    changed the description

  • @nick.thomas do you mind to take a look and give me your thoughts? It's not a review :wink:.

    I opted for still returning the project (as well as the container) in the controllers, because there are others, like LFS ones, that still need the reference. Besides, there is some logic inside the controllers that still need that reference as well.

  • Francisco Javier López
  • Francisco Javier López
  • Francisco Javier López changed the description

    changed the description

  • Nick Thomas
  • Nick Thomas
  • @Anastasia / @tmslvnkc , please let us know if you have any additional QA recommendations.

  • added 442 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 8db99e8e - Fix post receive for snippets

    Compare with previous version

  • added 1 commit

    • f054d1b8 - Create snippet repository models

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 3ea91b74 - Code review comments applied

    Compare with previous version

  • changed milestone to %12.9

  • added 1 commit

    • f32cb9fe - Create project from push only when repo type is project

    Compare with previous version

  • assigned to @nick.thomas and unassigned @fjsanpedro

  • added 208 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Nick Thomas mentioned in merge request !23492 (merged)

    mentioned in merge request !23492 (merged)

  • Nick Thomas
  • Nick Thomas assigned to @fjsanpedro and unassigned @nick.thomas

    assigned to @fjsanpedro and unassigned @nick.thomas

  • added 1 commit

    • b873270c - Code review comments applied

    Compare with previous version

  • @nick.thomas I address almost all your comments. The only thing left is the policy thing !21739 (comment 288413467) and the problem @lulalala found in !23492 (comment 291461844).

  • added 373 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • @nick.thomas comments answered :ping_pong:

  • assigned to @nick.thomas and unassigned @fjsanpedro

  • Nick Thomas assigned to @fjsanpedro and unassigned @nick.thomas

    assigned to @fjsanpedro and unassigned @nick.thomas

  • added 184 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added workflowin review label and removed workflowblocked label

  • Okay, everything addressed and tested @nick.thomas. I changed the http_download_allowed? to remove the changes we made to the policies until we address what Mark found, but include the access check for snippets and guest users. Another round?

    Edited by Francisco Javier López
  • assigned to @nick.thomas and unassigned @fjsanpedro

  • added 1 commit

    • e5276ccd - Removing guest access check in http controller

    Compare with previous version

  • Francisco Javier López
  • added 361 commits

    Compare with previous version

  • mentioned in issue #208155 (closed)

  • Nick Thomas assigned to @fjsanpedro and unassigned @nick.thomas

    assigned to @fjsanpedro and unassigned @nick.thomas

  • mentioned in issue #207865 (closed)

  • added 182 commits

    Compare with previous version

  • added 43 commits

    Compare with previous version

  • mentioned in issue #207869 (closed)

  • mentioned in issue #207870 (closed)

  • Michael Kozono mentioned in merge request !24435 (closed)

    mentioned in merge request !24435 (closed)

  • added 319 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 205 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 102 commits

    Compare with previous version

  • added 1 commit

    • 88304db5 - Add guest read ability to repo_type

    Compare with previous version

  • @nick.thomas Since !25929 (closed) seems to generate more problems than benefits, I opted here for the other variant we have, updating RepoType and include there the read ability (not 100% sure of the naming). This way we can use it without checking the repo type.

    Besides, it will help fix the problem with wikis whose project repository is disabled. We would just need to add the ability download_wiki_code instead of the default download_code.

  • assigned to @nick.thomas and unassigned @fjsanpedro

  • If we don't like the info in the RepoType we can create a method in GitHttpClientController like:

    def guest_read_ability
      if repo_type.snippet?
        :read_snippet
      elsif repo_type.wiki?
        :download_wiki_code
      else
        :download_code
      end
    end
    Edited by Francisco Javier López
  • added 129 commits

    Compare with previous version

  • mentioned in merge request !24150 (merged)

  • Nick Thomas resolved all threads

    resolved all threads

  • Nick Thomas
  • OK, this LGTM - I don't mind the repo_type approach tot he guest ability. Thanks @fjsanpedro!

    I've got one question about the feature flag, and I've set off QA to see the results of that, but I think we'll be able to merge this more or less as-is.

  • Nick Thomas approved this merge request

    approved this merge request

  • Nick Thomas resolved all threads

    resolved all threads

  • OK, the QA pipeline failed a set of deploy key things - but these seem to be already known, and not to do with the changes in this MR. I'm happy to merge it as-is!

  • 2 Warnings
    :warning: This merge request is quite big (more than 1173 lines changed), please consider splitting it into multiple merge requests.
    :warning: : The merge request title length is acceptable, but please try to reduce it to 50 characters.

    Commit message standards

    The merge request title that will be used in the squash commit does not meet our Git commit message standards.

    For more information on how to write a good commit message, take a look at How to Write a Git Commit Message.

    Here is an example of a good commit message:

    Reject ruby interpolation in externalized strings
    
    When using ruby interpolation in externalized strings, they can't be
    detected. Which means they will never be presented to be translated.
    
    To mix variables into translations we need to use `sprintf`
    instead.
    
    Instead of:
    
        _("Hello #{subject}")
    
    Use:
    
        _("Hello %{subject}") % { subject: 'world' }

    This is an example of a bad commit message:

    updated README.md

    This commit message is bad because although it tells us that README.md is updated, it doesn't tell us why or how it was updated.

    Reviewer roulette

    Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category (e.g. frontend or backend), and by a maintainer in all other categories.

    To spread load more evenly across eligible reviewers, Danger has randomly picked a candidate for each review slot. Feel free to override this selection if you think someone else would be better-suited, or the chosen person is unavailable.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines.

    Once you've decided who will review this merge request, mention them as you normally would! Danger does not (yet?) automatically notify them for you.

    Category Reviewer Maintainer
    backend Josianne Hyson (@jhyson) Grzegorz Bizon (@grzesiek)

    Generated by :no_entry_sign: Danger

  • Nick Thomas enabled an automatic merge when the pipeline for 0d21022b succeeds

    enabled an automatic merge when the pipeline for 0d21022b succeeds

  • merged

  • Nick Thomas mentioned in commit e94f6229

    mentioned in commit e94f6229

  • :tada: :tada:

    Thanks very much @nick.thomas!! Thanks to your insightful review we could catch several edge cases and improve the MR a lot.

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • Markus Koller changed the description

    changed the description

  • added Category:Source Code Management snippets labels and removed 1 deleted label

  • Please register or sign in to reply
    Loading