Skip to content

BF: Remove create-sibling-gitlab's hierarchy layout, make collection the default#7410

Merged
adswa merged 10 commits into
datalad:masterfrom
jsheunis:gitlab-hierarchy-fix
Jun 14, 2023
Merged

BF: Remove create-sibling-gitlab's hierarchy layout, make collection the default#7410
adswa merged 10 commits into
datalad:masterfrom
jsheunis:gitlab-hierarchy-fix

Conversation

@jsheunis
Copy link
Copy Markdown
Member

@jsheunis jsheunis commented Jun 6, 2023

This PR:

The result is that each dataset name in a nested structure, including the top-level dataset, will map onto a gitlab group, and the associated dataset repositories will be created as a projects inside these nested groups.

An additional requirement is that a user needs to create a top-level group via the Gitlab UI (this cannot be done via the API) and this group needs to be provided as the base of the value in the --project argument, e.g. newgroup/mydatasets.

EDIT by adina: This PR started out trying to fix the hierarchy layout of create-sibling-gitlab, but eventually discovered the same problems others have discovered at several different times in the past. See #7411 and #7409.
Now, this PR implements a suggestion that has been made by Kyle already shortly after the original create-sibling-gitlab feature was merged: Make collection the default layout. The need for this arose because the hierarchy layout has a number of edge cases that make it break when it operates on hierarchies of datasets (see #7411 and #7409 as well for details). Rather than keeping the hierarchy layout around in a dysfunctional state, this PR removes it entirely, and adjusts documentation and tests accordingly. I would argue that there is little use if we keep it - it has been broken since it existed for recursive operations, and in non-recursive operations, the outcome that the collection layout provides is identical to what hierarchy would provide.

jsheunis and others added 3 commits June 6, 2023 11:49
This commit applies a small change to remove the
discrepancy between the docs description of the
hierarchy layout and the actual implementation.
The result is that each dataset name in a nested
structure, including the top-level dataset, will
map onto a gitlab group, and the associated dataset
repositories will be created as a projects inside
these nested groups.

An additional requirement is that a user needs to
create a top-level group via the Gitlab UI (this
cannot be done via the API) and this group needs to
be provided as the base of the value in the
--project argument, e.g. 'newgroup/mydatasets'.
@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 6, 2023

I rebased your changes to sit on top of #7407

@adswa adswa added semver-minor Increment the minor version when merged CHANGELOG-missing When a PR's description does not contain a changelog item, yet. labels Jun 6, 2023
@github-actions github-actions Bot removed the CHANGELOG-missing When a PR's description does not contain a changelog item, yet. label Jun 6, 2023
Comment thread changelog.d/pr-7410.md Outdated
@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 6, 2023

Hold off reviews or merges, I found an unrelated bug I'd like to slay in this PR, too

adswa added 3 commits June 6, 2023 15:46
This is a fix for datalad#7411.
In a dataset hierarchy with subdatasets in subdirectories, the
hierarchy layout of create-sibling-gitlab will keep path separators
in the project path. This is problematic, because for GitLab, this
makes it look like the subdirectory needs to be a pre-existing group.
For example:

[DS~0] /home/me/dl-101/DataLad-101
├── recordings/
│   └── [DS~1] longnow/

will create a project path like this:
<gitlab-instance>/<gitlab-group>/recordings/longnow/project

DataLad will attempt to create the group 'longnow', but won't consider
creating 'recordings'. Thus, the action will fail due to a missing
parent level group that was never meant to be created.

With this change, the project path becomes
<gitlab-instance>/<gitlab-group>/longnow/project

I.e., subdirectories are stripped.
@adswa adswa mentioned this pull request Jun 7, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 7, 2023

Codecov Report

Patch coverage: 79.31% and project coverage change: +2.86 🎉

Comparison is base (4750981) 88.68% compared to head (f3b704e) 91.54%.

❗ Current head f3b704e differs from pull request most recent head 8510b5c. Consider uploading reports for the commit 8510b5c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7410      +/-   ##
==========================================
+ Coverage   88.68%   91.54%   +2.86%     
==========================================
  Files         327      325       -2     
  Lines       44703    43333    -1370     
  Branches     5948     5804     -144     
==========================================
+ Hits        39645    39670      +25     
+ Misses       5043     3648    -1395     
  Partials       15       15              
Impacted Files Coverage Δ
datalad/support/gitrepo.py 91.95% <ø> (ø)
datalad/ui/progressbars.py 79.51% <50.00%> (+2.98%) ⬆️
datalad/local/wtf.py 78.99% <57.69%> (+1.25%) ⬆️
datalad/distributed/create_sibling_gitlab.py 68.90% <100.00%> (ø)
datalad/distributed/drop.py 96.83% <100.00%> (+0.05%) ⬆️
...ad/distributed/tests/test_create_sibling_gitlab.py 98.59% <100.00%> (+0.09%) ⬆️
datalad/distributed/tests/test_drop.py 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adswa adswa marked this pull request as ready for review June 7, 2023 10:16
@adswa adswa changed the title BF: gitlab hierarchy fix BF: Remove create-sibling-gitlab's hierarchy layout, make collection the default Jun 7, 2023
Comment thread changelog.d/pr-7410.md Outdated
Copy link
Copy Markdown
Member Author

@jsheunis jsheunis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes:

  • Made a very minor doc edit
  • I've tested it with multiple nested datasets, within subdirectories, and the collection and flat layouts seem to be working as expected
  • The tests all pass locally
  • While reviewing this I noticed some issues with the path separator code, but I have moved those comments over to #7407

Comment thread datalad/distributed/create_sibling_gitlab.py Outdated
DataLad Bot and others added 2 commits June 9, 2023 08:15
Improve changelog

Update changelog
Co-authored-by: Stephan Heunis <jsheunis@gmail.com>
@adswa adswa force-pushed the gitlab-hierarchy-fix branch from 9e50e41 to 7c83f4a Compare June 9, 2023 06:16
mih added a commit to mih/datalad-next that referenced this pull request Jun 9, 2023
@mih
Copy link
Copy Markdown
Member

mih commented Jun 9, 2023

Given the time pressure imposed by upcoming events that require this command to work well, I have taken this changeset (plus #7407) and introduced it as a patch in datalad-next: datalad/datalad-next#413

It may be interesting to absorb the RF of the gitlab tests from that PR, which removes nose-residuals and switches to better use of pytest paradigms. The commit cannot be taken 1:1, but needs an adjustment of monkeypatch targets.

mih added a commit to datalad/datalad-next that referenced this pull request Jun 9, 2023
Import create-sibling-gitlab patch from datalad/datalad#7410
@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 12, 2023

woah, I haven't seen this much green in a while!

@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 12, 2023

btw I have created a dedicated walk-through (relies on this PR) in the handbook: https://datalad-handbook--963.org.readthedocs.build/en/963/basics/101-139-hostingservices.html#creating-a-sibling-on-gitlab

@yarikoptic yarikoptic added the release Create a release when this pr is merged label Jun 13, 2023
* origin/master:
  [skip ci] Update docs/source/changelog.rst
  [skip ci] Update CHANGELOG
  [gh-actions](deps): Bump con/tributors from 0.0.21 to 0.1.1
  Use getpwd() instead of Path.cwd() to account for $PWD (symlinked paths)
  OPT: parse_gitconfig_dump() origin path processing
  [release-action] Autogenerate changelog snippet for PR 7050
  ENH: check file size on the filesytem for relaxed annexed files with content
  BF: status - report annexed files even if no bytesize known
  Use pytest.skip instead of raise SkipTest in the added test
  [release-action] Autogenerate changelog snippet for PR 7422
  BF/RF(TST): skip test_system_ssh_version if no ssh found + split parsing into separate test
  ENH(TST): test that Runner raises FileNotFoundError if binary does not exist
  remove unused in the test @with_tempfile
  [release-action] Autogenerate changelog snippet for PR 7418
  Do not map (leave as is) trailing \/ in github URLs.
  [release-action] Autogenerate changelog snippet for PR 7412
  Use `sphinx_autodoc_typehints`
  [release-action] Autogenerate changelog snippet for PR 7388 (codespelled)
  RF: Issue a warning while minting annex key but getting KeyError
  BF: make addurls tollerate the case that not all rows have all metadata fields
@qlty-cloud-legacy
Copy link
Copy Markdown

Code Climate has analyzed commit 8510b5c and detected 0 issues on this pull request.

View more on Code Climate.

@yarikoptic
Copy link
Copy Markdown
Member

master is now up to date with fresh maint release and is 0.18.5-69-g6d5278172 . I have merged it in, and added release label. If tests are all good -- someone hit "Merge" and see what happens ;)

@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 14, 2023

Everything is green! I'm hitting merge 💥

@adswa adswa merged commit 879a262 into datalad:master Jun 14, 2023
@adswa
Copy link
Copy Markdown
Member

adswa commented Jun 14, 2023

I think it didn't do anything...

@yarikoptic-gitmate
Copy link
Copy Markdown
Collaborator

PR released in 0.19.0

adswa added a commit to adswa/datalad that referenced this pull request Jun 16, 2023
BF: Remove create-sibling-gitlab's hierarchy layout, make collection the default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Create a release when this pr is merged semver-minor Increment the minor version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants