Skip to content

Add support for custom Git resource types - #34

Open
kimgr wants to merge 1 commit into
sapcc:masterfrom
kimgr:add-resource-uri-pattern
Open

Add support for custom Git resource types#34
kimgr wants to merge 1 commit into
sapcc:masterfrom
kimgr:add-resource-uri-pattern

Conversation

@kimgr

@kimgr kimgr commented Oct 3, 2025

Copy link
Copy Markdown

Resource types in Concourse, except the built-in 'git' type, are mostly type aliases. Users can name them whatever they want, provided they declare them pointing to a resource Docker image. Rather than hard-code which type names are handled by the resource scan loop, make it table-driven.

Since different resource type implementations use different attributes to denote the target Git repository, generalize so that users can register type names and URI patterns on the command-line.

The new -add-resource-uri-pattern option lets users register custom type names, and the associated pattern to build a Git repository URI from the resource attributes.

Every resource is now evaluated against all patterns registered for the type name to produce an URI, and if any of them match the push event, the resource will be further evaluated (branch filter, path filter).

Describe the pattern language in the README.

Baseline behavior should be the same after this patch, the mechanics are just more general.

Resource types in Concourse, except the built-in 'git' type, are mostly
type aliases. Users can name them whatever they want, provided they
declare them pointing to a resource Docker image. Rather than hard-code
which type names are handled by the resource scan loop, make it
table-driven.

Since different resource type implementations use different attributes
to denote the target Git repository, generalize so that users can
register type names and URI patterns on the command-line.

The new -add-resource-uri-pattern option lets users register custom type
names, and the associated pattern to build a Git repository URI from the
resource attributes.

Every resource is now evaluated against all patterns registered for the
type name to produce an URI, and if any of them match the push event,
the resource will be further evaluated (branch filter, path filter).

Describe the pattern language in the README.

Baseline behavior should be the same after this patch, the mechanics are
just more general.
@kimgr

kimgr commented Oct 3, 2025

Copy link
Copy Markdown
Author

Hey! We've been using a patched version of the webhook-broadcaster for several years to recognize some additional resource types. I ended up generalizing it here, to enable:

  • custom resource type names -- the resource types matched in the broadcaster on mainline are really only conventional. Each pipeline can name their custom resource types as they see fit.
  • custom resource URI patterns -- popular resource types such as https://github.com/telia-oss/github-pr-resource do not necessarily have an uri attribute to denote the GitHub clone URL. Many only use repository, or keep owner and repository separately.

The pattern expansion allows us to use any combination of attributes and literal strings to compose URIs, and also makes it possible to expand private forge base URLs (e.g. https://mything.ghe.com) for matching.

Let me know what you think!

@kimgr

kimgr commented Oct 3, 2025

Copy link
Copy Markdown
Author

cc @jknipper @databus23

@kimgr

kimgr commented Oct 3, 2025

Copy link
Copy Markdown
Author

If this is accepted, I believe you can also close #11, that looks like a hardcoded solution to part of the problem.

@kimgr

kimgr commented Oct 9, 2025

Copy link
Copy Markdown
Author

Ping @jknipper @databus23

@kimgr

kimgr commented Oct 20, 2025

Copy link
Copy Markdown
Author

Monday evening ping!

@kimgr

kimgr commented Oct 24, 2025

Copy link
Copy Markdown
Author

Gentle Friday ping!

@kimgr

kimgr commented Nov 12, 2025

Copy link
Copy Markdown
Author

Ping!

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.

1 participant