Commit Graph

58 Commits

Author SHA1 Message Date
Josh e6d32fb392 Use internal origins for service APIs
These origins are only ever used to access the REST APIs and need to be
resolvable internally.
2024-02-07 21:11:12 +01:00
Adnan Maolood c4e50c633e hubsrht: Use repository visibility for builds 2023-04-19 09:22:20 +02:00
Conrad Hoffmann ec7a552ffc webhooks: add error handling for patch submission
Currently, any 400 error that occurs will be swallowed by
`SrhtService.post()` [1] - the caller must use a validation object to
become aware of an error.

This commit adds such error handling by means of a validation object to
the build submission webhook.

[1]: https://git.sr.ht/~sircmpwn/hub.sr.ht/tree/f37b9e6e/item/hubsrht/services.py#L56-60
2022-11-25 10:24:17 +01:00
Drew DeVault f37b9e6e18 Update patchset build submission to use GQL API 2022-11-09 11:53:43 +01:00
Adnan Maolood db74624e2a hubsrht: Use User.tracker instead of trackerByOwner 2022-04-29 11:10:37 +02:00
Drew DeVault d292f65f1f projects: remember visibility across form submissions
References: https://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3CCJ5SEF4HBSQ5.2N6Y2AG1CUDQZ%40arctic%3E
2022-04-11 12:16:21 +02:00
Robin Jarry 1b33a612d1 webhooks: avoid duplicate todo comments
When pushing a tag, the webhooks are invoked twice: once for the the
commit and once for the tag. Avoid inserting the same comment multiple
times. This also fixes the multiple comments issue when a git repository
is associated with more than one project.

This requires the new graphql method to get specific tickets by their
scoped ID on a given tracker.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-02-21 11:51:37 +01:00
Adnan Maolood 800aa59bda hubsrht/services: Fix log query (again) 2022-02-14 19:02:09 +01:00
Adnan Maolood 91146b1a15 hubsrht/services: Use api-origin where necessary 2022-02-14 19:02:09 +01:00
Adnan Maolood 7e41182f56 hubsrht/services: Fix log query 2022-02-14 18:17:02 +01:00
Adnan Maolood 9c3aca190b hubsrht/services: Fall back to origin if api-origin is unset 2022-02-14 18:16:59 +01:00
Adnan Maolood 43604cea9b hubsrht/services: Use api-origin for GraphQL queries
Use api-origin instead of origin for GraphQL queries, as these are not
necessarily the same.
2022-02-14 15:42:52 +01:00
Adnan Maolood a77998c012 hubsrht: Remove usage of repository(id) GraphQL query
The repository(id) query will be removed from git.sr.ht, so use the
User.repository(name) query instead.
2022-02-14 15:42:51 +01:00
Robin Jarry be5d50d8d8 webhooks: update todo tickets with git commits
Allow referencing tracker tickets in git commit messages via specific
trailer words:

  Fixes: <ticket url>
  Implements: <ticket url>
  References: <ticket url>

These must follow standard git trailer syntax. The trailers are
extracted from commit messages with the function added in previous
commit. The ticket url must point to a valid ticket.

A comment will be inserted in the ticket with a back reference to the
git commit and its original author. The comment will be made by the user
who pushed the commit. E.g.:

  ~arkanoid REPORTED -> FIXED                          9 seconds ago

  John Doe referenced this ticket in commit b4dc4c40.

Open tickets referenced by a Fixes trailer will be resolved with the
FIXED resolution.

Open tickets referenced by an Implements trailer will be resolved with
the IMPLEMENTED resolution.

Caveats:

* Only the 25 most recent commit messages will be considered when
  pushing long series. This should be a fairly sane limitation.

* If the user pushing commits does not have triage/comment permissions
  on the bug tracker, nothing will happen.

* Invalid/non-existent ticket urls are ignored.

* When a git repository is part of more than one project, the webhook
  will run once per project and update the same ticket(s) once per
  project as well.

* If an already resolved ticket is referenced by a Fixes or Implements
  trailer, only a comment will be added.

Link: https://git-scm.com/docs/git-interpret-trailers
Implements: https://todo.sr.ht/~sircmpwn/hub.sr.ht/55
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-29 10:52:32 +01:00
Drew DeVault c34944b943 trackers: configure with visibility
Following the introduction of visibility parameters to todo.sr.ht.

Fixes ~sircmpwn/hub.sr.ht#75
2021-10-29 10:55:05 +02:00
Drew DeVault fcddddef7a Handle null response from createRepository 2021-09-24 10:05:32 +02:00
Drew DeVault 945967d390 services: fix custom HTML readme display 2021-01-26 09:01:19 -05:00
Drew DeVault 31854be734 Syncronize nullable constraints with service policy 2021-01-18 15:24:59 -05:00
Drew DeVault 89738ae198 Forward errors from GQL to the UI 2021-01-11 09:32:08 -05:00
Drew DeVault eb326ae6fb todo.sr.ht: description is required 2021-01-11 09:29:38 -05:00
Drew DeVault 84e0598f4d Raise exception on unexpected git.sr.ht response 2020-12-19 18:04:03 -05:00
Nolan Prescott 64cd1e0443 Prefix README links to rendered pages
Relative links from project summaries resulted in raw pages rather
than rendered pages for both mercurial and git repositories.

This patch is intended to match the behavior of git.sr.ht and hg.sr.ht
README rendering by passing the previous raw links as secondary link
prefixes (for rendering images) but otherwise link to rendered
resources.

related ticket: todo.sr.ht/~sircmpwn/hub.sr.ht/67
2020-12-08 08:49:05 -05:00
Drew DeVault 5c97b72d51 Replace more git.sr.ht requests with GraphQL 2020-12-03 11:46:55 -05:00
Drew DeVault bd37e09523 Use GraphQL to fetch readmes from git.sr.ht 2020-12-03 08:33:47 -05:00
Drew DeVault 656739112e Expand detail in get_manifests exception 2020-11-28 13:17:48 -05:00
Drew DeVault de0182c2c1 services.py: check for missing repositories 2020-11-28 09:59:36 -05:00
Thorben Günther 502afdd0e1 Delete second declaration of create_tracker 2020-10-31 10:55:40 -04:00
Thorben Günther 8c5aef62b0 Fix subfolders in ".builds" breaking CI
Currently the gql API request will return an empty object for subfoders.
2020-10-31 10:53:22 -04:00
Drew DeVault a6579ef7f5 README: don't add empty pre tag for empty readme 2020-09-22 13:02:15 -04:00
Drew DeVault b1ff1910a3 Fix git.ensure_user_webhooks
Typo had the unensure function overwrite the ensure function, the end
result being that everyone's webhooks were removed -_-
2020-09-03 11:47:28 -04:00
наб db873e2cab Use HTML override for project README, if any 2020-08-25 16:04:15 -04:00
наб dff8093560 Use default branch for querying README blobs
GETting "{_gitsrht}/api/repos/{repo_name}/refdb/HEAD" would also have
worked, but it's hardly necessary

Ref: ~sircmpwn/hub.sr.ht#50
2020-08-18 10:12:43 -04:00
Drew DeVault b72c7c7feb Run build submissions in a job group 2020-07-23 12:58:38 -04:00
Drew DeVault 33ea654ac3 Support multiple manifests 2020-07-13 16:31:44 -04:00
Drew DeVault 581af620f0 Rig up build status to lists.sr.ht tool status 2020-07-13 16:14:59 -04:00
Drew DeVault a1c9c80b29 Submit patches to builds.sr.ht 2020-07-13 13:30:28 -04:00
Drew DeVault a83d6a2cfd Copy visibility of project to new repos 2020-07-11 10:33:42 -04:00
ARaspiK 54e1c5169a Replace misaka (hoedown) with mistletoe
It looked like using hoedown (through misaka), which is very
unmaintained, was leading to a lot of issues (see [0]). This replaces
misaka by mistletoe [1], without losing any functionality (I hope).

This affects the call to 'markdown()', removing the now-redundant
argument for the tag whitelist.

[0]: https://todo.sr.ht/~sircmpwn/sr.ht/20
[1]: https://github.com/miyuchina/mistletoe
2020-07-09 11:47:04 -04:00
Drew DeVault 47d6ec09a1 Implement mailing list removal 2020-07-08 12:19:54 -04:00
Michał Sidor (Michcioperz) d24e508cd4 Add support for different named READMEs 2020-05-25 10:10:57 -04:00
Drew DeVault a34ed9df1b services: consider 404 a successful deletion 2020-05-04 12:00:06 -04:00
Drew DeVault 1b21391014 Swallow errors when unensuring webhooks 2020-05-04 11:20:23 -04:00
Drew DeVault f947f831ab Repo description is required 2020-04-30 09:59:51 -04:00
Drew DeVault a15ff75966 services.py: correct hg user webhook location 2020-04-29 10:05:03 -04:00
Drew DeVault 7c3bb9fc0f Add events for todo.sr.ht tickets 2020-04-23 11:33:08 -04:00
Drew DeVault e0326ac0e2 Refactor webhooks to be more discrete 2020-04-06 16:19:07 -04:00
Drew DeVault 89a2e3ac9f Rig up Mercurial support 2020-04-06 13:21:13 -04:00
Drew DeVault c2b3216250 Implement ticket tracker creation 2020-04-02 13:41:46 -04:00
Drew DeVault 6456c0a7bf Implement tracker management 2020-04-02 10:26:04 -04:00
Drew DeVault ae7768cc70 Implement bug tracker addition 2020-04-02 09:24:29 -04:00