Page MenuHomePhabricator

Write a script to create security release task tree
Open, Needs TriagePublic

Description

Instead of creating the heirarchy of security release tasks every time, it'd be much easier to have a script to do this...

AIUI, Release-Engineering-Team do have scripts for creating phab taks etc... So ideally repurposing that would be nice

Though, might need some tweaks to file as security tasks etc?

Hacky!

from phabricator import Phabricator

phab = Phabricator(host='https://phabricator.wikimedia.org/api/', token='')

aclSec = 'PHID-PROJ-koo4qqdng27q7r65x3cw'

projSecTeam = 'PHID-PROJ-pdw4jlcz543opbp2drhq'
projSec = 'PHID-PROJ-dwqfaiejpr656zc6hf6o'

version = 'x/y/z'

res = phab.maniphest.createtask(
    title='Release MediaWiki {0}'.format(version),
    description="""Tracking for activities actually pertaining to making the release of MediaWiki {0}

Previous release work:

Tracking for activities actually pertaining to making the release of MediaWiki {0}""".format(version),
    viewPolicy=aclSec,
    editPolicy=aclSec,
    projectPHIDs=[projSec, projSecTeam],
)
parentTaskPHID=res['phid']
print("Parent task: https://phabricator.wikimedia.org/T{0}".format(res['id']))

subTasks = [
    {
        "title": "Tracking bug for MediaWiki {0}".format(version),
        "description": """Previous work:

Tracking bug for next security release, {0}""".format(version),
    },
    {
        "title": "Write and send pre-release announcements for MediaWiki {0}".format(version),
        "description": "Previous work: ",
    },
    {
        "title": "Write and send release announcements for MediaWiki {0}".format(version),
        "description": "Previous work: ",
    },
    {
        "title": "Update onwiki release notes for {0}".format(version),
        "description": "The following MW.org need updating from the RELEASE-NOTES files",
        # TODO: URLS!
    },
    {
        "title": "Update HISTORY in master after {0}".format(version),
        "description": "Point release RELEASE-NOTES from {0} need copying to HISTORY in the relevant places in master".format(version),
    },
    {
        "title": "Tag {0}".format(version),
        "description": "Create and push git tags for {0}".format(version),
    },
    {
        "title": "Obtain CVEs for {0} security releases".format(version),
        "description": "",
    },
    {
        "title": "Write and send supplementary release announcement for extensions and skins with security patches ({0})".format(version),
        "description": "Previous work: ",
    },
]

subTaskPHIDS = []

for task in subTasks:
    res = phab.maniphest.createtask(
        title=task['title'],
        description=task['description'],
        viewPolicy=aclSec,
        editPolicy=aclSec,
        projectPHIDs=[projSec, projSecTeam],
    )
    subTaskPHIDS.append(res['phid'])

# Add trackingTaskPHID as sub tasks of parentTaskPHID
res = phab.maniphest.edit(
    transactions=[{"type": "subtasks.add", "value": subTaskPHIDS}],
    objectIdentifier=parentTaskPHID,
)
# print(res)

Event Timeline

Reedy created this task.Jun 24 2020, 5:02 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 24 2020, 5:02 PM
Reedy updated the task description. (Show Details)Jun 24 2020, 11:42 PM
Reedy updated the task description. (Show Details)

Change 607643 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/tools/release@master] Add script for creating MW Security Release Phab tasks

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

Change 607643 merged by jenkins-bot:
[mediawiki/tools/release@master] Add script for creating MW Security Release Phab tasks

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

Reedy added a comment.Jun 25 2020, 1:21 AM

It looks like with maniphest.info you can't get/view the visibility/edibility policies...

And with maniphest.edit and maniphest.createtask you can't do complex policies...

How do I create a task via the conduit api, and make it have the same policies as https://phabricator.wikimedia.org/maniphest/task/edit/form/75/ ?

Reedy moved this task from Incoming to In Progress on the Security-Team board.Jun 29 2020, 3:18 PM