Page MenuHomePhabricator

Document how to convert projects into subprojects/milestones etc (sudo privileges for phab admins to run move_project script)
Closed, ResolvedPublic0 Estimated Story Points

Description

https://www.mediawiki.org/wiki/Phabricator/Project_management#Converting_projects_into_subprojects_/_milestones says to file a task under Project-Admins. However, nobody in Project-Admins can perform such conversions as CLI access is required. IIUC only @mmodell can perform such steps currently (like in T138952), so we might face a bottleneck / bad bus factor here.

Having documentation on wikitech how to perform such a conversion could allow others to help with the backlog in https://phabricator.wikimedia.org/maniphest/?ids=219610,219609,219608,169764,153327,147175,195855,182569,221540#R

Event Timeline

MGChecker subscribed.

T123078 contains some information about how this works.

The script is roughly documented upstream at https://secure.phabricator.com/T10350

The version I've been using is essentially the same as upstream except I removed the restriction on moving projects that already have subprojects/milestones of their own. That might be harmful but I've moved whole trees before and it seems to work just fine.

A better documented version of the script is now available: rPHABf8b44b65514e: Added move_project script from upstream.

Note we probably need a new sudoers rule added to allow Andre to run this. I couldn't seem to deduce where those are defined in puppet. It looks like rOPUP has had a few things refactored since the last time I looked. Grepping didn't help much. Help? @Dzahn can you help me figure out how to allow @Aklapper to run /srv/phab/phabricator/bin/move_project on phab1001

NAME

move_project - Transform a project into either a subproject or milestone of another project.

SYNOPSIS

./bin/move_project --parent ParentHashtag --child ChildHashtag ( --subproject | --milestone ) --keep-members (parent|child|both)

OPTION REFERENCE

--parent project
    The project to make a parent of the --child project.

--child project
    The project to make a child of the --parent project.

--keep-members mode
    Choose which members to keep: both, child, parent.

--subproject
    Turn the project into a subproject. Or, use --milestone.

--milestone
    Turn the project into a milestone. Or, use --subproject.

Note we probably need a new sudoers rule added to allow Andre to run this. I couldn't seem to deduce where those are defined in puppet.

https://phabricator.wikimedia.org/source/operations-puppet/browse/production/modules/admin/data/data.yaml I guess?

A better documented version of the script is now available: rPHABf8b44b65514e: Added move_project script from upstream.

Thank you!

Note we probably need a new sudoers rule added to allow Andre to run this.

https://gerrit.wikimedia.org/r/#/c/operations/puppet/+/505667/ , I hope (see my comment over there).

Change 505667 had a related patch set uploaded (by 20after4; owner: Aklapper):
[operations/puppet@production] Phab: Allow greg and aklapper to convert projects to subprojects/milestones

https://gerrit.wikimedia.org/r/505667

@Dzahn can you help me figure out how to allow @Aklapper to run /srv/phab/phabricator/bin/move_project on phab1001

Sorry, i did not see this until today. Getting too many notifications after i subscribed to additional projects and was overlooked in clinic duty due to lack of access request tag. Added that now! Andre is right about the location in the admins module in data/data.yaml

Dzahn renamed this task from Document how to convert projects into subprojects/milestones etc to Document how to convert projects into subprojects/milestones etc (sudo privileges for phab admins to run move_project script).Apr 30 2019, 1:02 AM

Change 505667 merged by Dzahn:
[operations/puppet@production] Phab: Allow greg and aklapper to convert projects to subprojects/milestones

https://gerrit.wikimedia.org/r/505667

@Aklapper @mmodell The request has been approved in today's SRE meeting. I merged the change. Just to make sure, does the move_project script really not need any parameters like the name of the project to be moved?

Puppet ran on phab1001. If you could confirm things work now we can close this ticket i think. Thanks!

@Dzahn: it has a bunch of parameters :-/

Ok, well then the current sudo privileges probably won't be enough, missing a * at the end. Will need follow-up but we don't have to bring it back to the meeting. The intention has been approved.

@Dzahn: it has a bunch of parameters :-/

Ok, well then the current sudo privileges probably won't be enough, missing a * at the end. Will need follow-up but we don't have to bring it back to the meeting. The intention has been approved.

Actually.... "A simple file name allows the user to run the command with any arguments he/she wishes. However, you may also specify command line arguments (including wildcards). Alternately, you can specify "" to indicate that the command may only be run without command line arguments."

This should just work. But let's have Andre confirm that.

Aklapper removed Aklapper as the assignee of this task.

This should just work. But let's have Andre confirm that.

Confirming that I can use move_project and that it works. Tried in https://phabricator.wikimedia.org/T219609#5173422 . Thanks everybody.

Documented move_project in https://wikitech.wikimedia.org/w/index.php?title=Phabricator&type=revision&diff=1825823&oldid=1822024

I need to move a child project - not a top-level project - to be the child of another project. Is it terribly difficult to adapt the move_beneath.php script to allow this?

Is there anyone with some knowledge about the Phabricator code to volunteer to do that?

Currently the script aborts here:

if ($child->getParentProjectPHID()) {
  throw new PhutilArgumentUsageException(
	pht(
	  'The selected child project is already a child of another project. '.
	  'This script can only move root-level projects beneath other projects, '.
	  'not move children within a hierarchy.'));
}

@JjELT: This task is about documenting the existing script and hence resolved. For new feature requests, please create new tickets. Thanks a lot!