Add support for custom Git resource types - #34
Open
kimgr wants to merge 1 commit into
Open
Conversation
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.
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:
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! |
Author
Author
|
If this is accepted, I believe you can also close #11, that looks like a hardcoded solution to part of the problem. |
Author
|
Ping @jknipper @databus23 |
Author
|
Monday evening ping! |
Author
|
Gentle Friday ping! |
Author
|
Ping! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.