From b4b4f2325db71041f38902143b28bae94762b111 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 12:26:52 +0700 Subject: ui-ci: add a "ci" tab which redirects to an external ci system Add a "ci" page which redirects to an external ci system for the ref being viewed, along with a tab for it in the repository header. The target is a url template, configurable globally or per repository, with separate settings for branches and tags because pipelines for the two commonly live at different locations: on a Jenkins multibranch pipeline a branch is at job//job/ while a tag is at job//view/tags/job/. $ref, $repo and $slug are substituted, $slug being the repository url with any ".git" suffix removed and slashes replaced by dashes, which is the shape job names usually take. An explicit repo.ci-url drops the branch and tag urls the repository would otherwise inherit from the global settings, as it could never take effect otherwise. The expansion is written to the Location header verbatim rather than through cgit_redirect(), which percent-encodes '?', '=' and '%' and would corrupt any url carrying a query string. An expansion containing CR or LF is refused so that it cannot smuggle in further headers. Signed-off-by: Saya Andy --- cgit.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index b8b7712..709fc0c 100644 --- a/cgit.h +++ b/cgit.h @@ -90,6 +90,9 @@ struct cgit_repo { char *extra_head_content; char *owner; char *homepage; + char *ci_url; + char *ci_branch_url; + char *ci_tag_url; char *defbranch; char *module_link; struct string_list readme; @@ -196,6 +199,9 @@ struct cgit_query { struct cgit_config { char *agefile; char *cache_root; + char *ci_url; + char *ci_branch_url; + char *ci_tag_url; char *clone_prefix; char *clone_url; char *favicon; -- cgit v1.3.1+13