Skip to content

feat: create git repo for docs - #1561

Merged
rudimatz merged 8 commits into
ietf-tools:mainfrom
rudimatz:feat/create-draft-repo
Oct 14, 2026
Merged

rudimatz merged 8 commits into
ietf-tools:mainfrom
rudimatz:feat/create-draft-repo

Conversation

@rudimatz

@rudimatz rudimatz commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

resolve #1326

  1. create git repo on doc import
  2. show button to manually trigger the creation for already enqueued docs or on failure
  3. add task that will allow automated creation for all enqueued docs where repo is not set yet

@rudimatz
rudimatz marked this pull request as ready for review October 6, 2026 17:11
@rudimatz
rudimatz marked this pull request as draft October 6, 2026 18:18
@rudimatz
rudimatz marked this pull request as ready for review October 7, 2026 17:50
@rudimatz

rudimatz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

TODO before deploy: set WRITE token

@jennifer-richards jennifer-richards left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it'd be worth at least pulling some consts from settings, rephrasing the notification slightly, and probably extracting a reusable helper (if we don't have one already). See inline.

A couple of other comments are in there also, mostly as questions. I don't think changing the ARCHIVE_URL is necessary without more thought and refactoring notification lengths should be done separately, but I'm leaving the comments.

Comment thread rpc/lifecycle/draft_repo.py Outdated
Comment on lines +30 to +41
TEMPLATE_REPO = "base-template"
BRANCH = "Approved"
EDITS_BRANCH = "RPC-edits"
COMMIT_MESSAGE = "approved I-D"
ARCHIVE_URL = "https://www.ietf.org/archive/id/"
REQUEST_TIMEOUT = 30 # seconds
# GitHub populates a repository created from a template asynchronously. Until it
# has done so, requests for the branch return 409 ("Git Repository is empty") or
# 404.
BRANCH_WAIT_ATTEMPTS = 10
BRANCH_WAIT_SECONDS = 2
_NOT_READY_STATUSES = (404, 409)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some of these seem like they should perhaps be configurable via settings. TEMPLATE_REPO, ARCHIVE_URL, and the timeouts/wait parameters seem like candidates.

Speaking of ARCHIVE_URL, I wonder if we can give purple more direct access to the files than by going out through CF. Not sure, because reading from R2 may be slower and I don't think we want to give purple direct access to blobdb.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we could add a DT API endpoint to return those file contents... but that could be handled outside the PR

Comment thread rpc/tasks.py Outdated
hint = " (needs manual fix)" if isinstance(err, DraftRepoExists) else ""
Notification.emit(
Notification.EventType.REPO_NOT_CREATED,
f"No repo created for {rfctobe.name}: {err}{hint}"[:255],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the length limit on a notification is somewhat arbitrary and it might be worth extending and putting the UI in charge of ellipsizing if necessary. Note that rfctobe.name can be 255 characters on its own, and err can potentially have long content due to the filename (likely including the name again). There's no guarantee that err / hint show up in the first 255 characters.

An alternative that would address what first caught my eye is to move the hint earlier, so that a hinted notification would look like "No repo created (needs manual fix) for draft-ietf-this-has-a-really-long-name-to-be-a-nuisan..." and the known-length parts would be guaranteed visible.

Comment thread rpc/tasks.py Outdated
)


def _rpc_person_of(user_id: int | None) -> RpcPerson | None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

feels like it should be a reusable utility instead of a one-off private helper (and we might have a way to do this already?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes I will simplify this

Comment thread rpc/tasks.py

@shared_task
def create_draft_repos_task():
"""Create repositories for all queued documents that have none yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this intended as a temporary task or are you planning to keep it around?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that would be a one-time task for everything in queue, then it could be removed

@rudimatz
rudimatz merged commit b86b6b6 into ietf-tools:main Oct 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When a document is approved and enqueued, purple should create the doc repo

2 participants