New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repository Management #3196
Repository Management #3196
Conversation
I've prepared a stage to preview changes. Open stage or view logs. |
# Reads from configuration whether repositories of this kind | ||
# may be managed from OpenProject. | ||
def manageable? | ||
! managed_root.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not leave space between !
and its argument.
revisions | ||
end | ||
|
||
def build_revision_args(path, identifier_from, identifier_to, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assignment Branch Condition size for build_revision_args is too high. [23.85/15]
) | ||
end | ||
|
||
def revisions(path, identifier_from, identifier_to, options = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assignment Branch Condition size for revisions is too high. [63.58/15]
9ac429e
to
a8b5fec
Compare
method: :get, | ||
with: "Form.serialize(this.form)") | ||
data: { remote: true, | ||
url: url_for(controller: "repositories", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
e002848
to
6ac12a2
Compare
end | ||
|
||
describe 'repository with authorization' do | ||
let(:adapter) { OpenProject::Scm::Adapters::Subversion.new url, root_url, login, password} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary spacing detected.
Space missing inside }.
This commit adds / extends the following specs: RepositoriesController: Ensure empty repository page is shown for empty repositories adapters/subversion: Test correct use of --login, --password arguments
bd2cb70
to
9336cff
Compare
# Adds the scm_type column to the repositories table and updates all previous | ||
# repository to correspond to these types. | ||
# | ||
# As until now, OP only supported local Git repositories and local or remote Subversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliverguenther why do you differentiate between 'local' and 'existing'. I have scanned the code but couldn't find the explanation. Can you enlighten me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason was to differentiate between existing, but local-only repositories (Git does not allow remote repositories currently, and will not after this PR), and Subversion's URL-based existing repositories (which doesn't care whether the repository is accessed on the filesystem, or on a remote server).
I could have named the scm_type for Git existing as well, but the reason I chose not to was to make some later wishlist upgrade that allows remote Git repositories to change that type back to existing for consistency.
In the end, all that this type controls is the partial that is rendered from /repositories/settings//. It only does more when it is :managed
.
I'd go with this option.
|
This commit (temporarily) removes the delayed creation and deletion of managed repositories for the sake of improvded error handling. After consultation with @ulferts, we suggest to improve the `Delayed::Job` pipeline to create means for identifying jobs (referenced ID) and to create a unified service to manage database AND filesystem access in a transactional manner. Also provides the following corrections: - Improve migration speed - Delete parent projects only by their identifier, not the managed root
Previously, repositories could not be deleted on disk when the `manages:` configuration entry was removed in the meantime. This commit allows repositories to be deleted in that case because we no longer depend on accessing the managed_root (path for `manages:`).
# Instead, this will be refactored into a single service wrapper for | ||
# creating and deleting repositories, which provides transactional DB access | ||
# as well as filesystem access. | ||
Scm::CreateRepositoryJob.new(repository).perform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this is synchronous, I think this should actually somehow return the errors e.g. not permitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Job does not catch any errors and thus, will raise when a directory could not be created or a permission error occurred. It will escalate to the repository itself. I will extend it however to catch intermittent exceptions and set localized_rejected_reason
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I've now added error handling for OS errors (a special case for permission errors as this is likely to happen, and a handler for all I also found an issue with how the managed path is accessed for created repositories, which is why this commit took a bit more time. Now, all views and services use |
This commit: - adds error messages for filesystem errors - Forces services and views to use repository.root_url instead of managed_path, which may not be available when config is missing
3b69b8a
to
ad0632a
Compare
I've detected one more issue when updating the settings, the method was invalid and apparently, a spec was missing for that. Added both now. |
@ulferts I've skimmed over all your remarks again and If I'm not mistaken, we have covered the open points. I will address asynchronous error handling in a separate WP / PR. |
Sorry, found one more issue: Why should I, as a user, need a save button here? I cannot alter the information in the form anyway.
|
For the current set of attributes, you're right. I suggest to take it out now, but we may need some logic to ask the repository whether repositories (of some unknown third-party vendor) may have attributes that can be updated even when they are managed. |
The checkout plugin btw. has to override this latest change and display the button. I've fixed this by letting the helper decide whether to display the button for the given repository and patch that method instead. |
Relevant work package: https://community.openproject.org/work_packages/21037 |
This commit removes the settings `save` button for managed repositories. Important: When adjustable settings for any vendor should be added, this button must be shown depending on some individual vendor logic.
923430d
to
baf48fe
Compare
This commit provides the functionality required by the checkout plugin (and possibly others) to change certain attributes and extend views in the repositories settings scope.
baf48fe
to
aec6593
Compare
This PR begins the push towards management of repository lifetime
from within OpenProject.
What this currently provides is the following:
ManageableRepository
, included byRepository::{Git, Subversion}
to provide an interface to repo managementCreateManagedRepositoryService
) anddeleting (
DeleteRepositoryService
)arbitrary SCM vendors.
{scm}_tags
is currently HTML generatedfrom within a Helper.)
repository (currently outputs 500, as Git HEAD / svn revision is not
available)
Filesystem
adapterWill be removed in subsequent PRMerged into this PR due to the errors that would occur when using existing Filesystem repositories on these features.Review remarks
Open Questions:
configuration.yml
.repositories)
Relevant work packages: