Add support for tags.
This commit is contained in:
parent
1efd7b1d73
commit
a2aca6d2f1
@ -1,25 +1,25 @@
|
||||
version = "0.0.1"
|
||||
|
||||
[[push]]
|
||||
name = "rust-test"
|
||||
source = "pipeline-rust-test.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
branches = [ "^main$", "^master$" ]
|
||||
name = "rust-test"
|
||||
source = "pipeline-rust-test.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "clippy"
|
||||
source = "pipeline-rust-clippy.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
name = "clippy"
|
||||
source = "pipeline-rust-clippy.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "format"
|
||||
source = "pipeline-format.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
name = "format"
|
||||
source = "pipeline-format.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
skip_branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
[[push]]
|
||||
name = "semver"
|
||||
source = "pipeline-semver.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
branches = [ "^main$", "^master$" ]
|
||||
name = "semver"
|
||||
source = "pipeline-semver.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
branches = [ "^main$", "^master$" ]
|
||||
|
165
example_tag_webhook_payload.json
Normal file
165
example_tag_webhook_payload.json
Normal file
@ -0,0 +1,165 @@
|
||||
{
|
||||
"ref": "refs/tags/v0.0.1",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"after": "1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/0000000000000000000000000000000000000000...1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"commits": [],
|
||||
"total_commits": 0,
|
||||
"head_commit": {
|
||||
"id": "1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"message": "Add a semver job to assign an automatically-incrementing version tag to commits to main.\n\nThis automatically increments the patch (3rd) digit, so to update the major or minor version, manually push a tag.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
"username": ""
|
||||
},
|
||||
"committer": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-09-28T23:59:32-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-semver.yaml"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
".webhook_bridge/webhook_bridge.toml"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 21,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"login": "talexander",
|
||||
"login_name": "",
|
||||
"full_name": "",
|
||||
"email": "gitea@local.domain",
|
||||
"avatar_url": "https://code.fizz.buzz/avatars/9d402a89b5a0786f83c1b8c5486fc7ff3d083a54fe20e55c0a776a1932c30289",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-05T22:03:28Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "talexander"
|
||||
},
|
||||
"name": "webhook_bridge",
|
||||
"full_name": "talexander/webhook_bridge",
|
||||
"description": "A server that receives webhooks from gitea and fires off Tekton jobs in response.",
|
||||
"empty": false,
|
||||
"private": false,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 334,
|
||||
"language": "",
|
||||
"languages_url": "https://code.fizz.buzz/api/v1/repos/talexander/webhook_bridge/languages",
|
||||
"html_url": "https://code.fizz.buzz/talexander/webhook_bridge",
|
||||
"url": "https://code.fizz.buzz/api/v1/repos/talexander/webhook_bridge",
|
||||
"link": "",
|
||||
"ssh_url": "git@code.fizz.buzz:talexander/webhook_bridge.git",
|
||||
"clone_url": "https://code.fizz.buzz/talexander/webhook_bridge.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 0,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-07-14T18:48:52Z",
|
||||
"updated_at": "2024-09-29T03:59:54Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": true,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "merge",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"avatar_url": "",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null
|
||||
},
|
||||
"pusher": {
|
||||
"id": 2,
|
||||
"login": "build-bot",
|
||||
"login_name": "",
|
||||
"full_name": "",
|
||||
"email": "build-bot@noreply.code.fizz.buzz",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/e39ef2faba8a3dfb3dcb4d8275a532d4?d=identicon",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-09T04:25:44Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "private",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "build-bot"
|
||||
},
|
||||
"sender": {
|
||||
"id": 2,
|
||||
"login": "build-bot",
|
||||
"login_name": "",
|
||||
"full_name": "",
|
||||
"email": "build-bot@noreply.code.fizz.buzz",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/e39ef2faba8a3dfb3dcb4d8275a532d4?d=identicon",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-09T04:25:44Z",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "private",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "build-bot"
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"ref": "refs/heads/main",
|
||||
"before": "d3b6cb93897a8f807ee4e31de3a1a231416f8f5e",
|
||||
"after": "efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/d3b6cb93897a8f807ee4e31de3a1a231416f8f5e...efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"before": "b122e6ee992f73be855a9d1cbf8595f6e90418ac",
|
||||
"after": "1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/b122e6ee992f73be855a9d1cbf8595f6e90418ac...1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"commits": [
|
||||
{
|
||||
"id": "efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"message": "Generate names for pipeline runs.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"id": "1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"message": "Add a semver job to assign an automatically-incrementing version tag to commits to main.\n\nThis automatically increments the patch (3rd) digit, so to update the major or minor version, manually push a tag.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
@ -19,22 +19,21 @@
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-09-28T21:50:50-04:00",
|
||||
"added": [],
|
||||
"timestamp": "2024-09-28T23:59:32-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-semver.yaml"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"docker/webhook_bridge_development/Dockerfile",
|
||||
"example_webhook_payload.json",
|
||||
"src/kubernetes.rs",
|
||||
"src/main.rs"
|
||||
".webhook_bridge/webhook_bridge.toml"
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_commits": 1,
|
||||
"head_commit": {
|
||||
"id": "efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"message": "Generate names for pipeline runs.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/efe37f020a949de2b5258593641dcc4b22273a66",
|
||||
"id": "1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"message": "Add a semver job to assign an automatically-incrementing version tag to commits to main.\n\nThis automatically increments the patch (3rd) digit, so to update the major or minor version, manually push a tag.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/1efd7b1d73b5eb0d9a999e4f4666cda521aa0720",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
@ -46,14 +45,13 @@
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-09-28T21:50:50-04:00",
|
||||
"added": [],
|
||||
"timestamp": "2024-09-28T23:59:32-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-semver.yaml"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"docker/webhook_bridge_development/Dockerfile",
|
||||
"example_webhook_payload.json",
|
||||
"src/kubernetes.rs",
|
||||
"src/main.rs"
|
||||
".webhook_bridge/webhook_bridge.toml"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@ -90,7 +88,7 @@
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 315,
|
||||
"size": 331,
|
||||
"language": "",
|
||||
"languages_url": "https://code.fizz.buzz/api/v1/repos/talexander/webhook_bridge/languages",
|
||||
"html_url": "https://code.fizz.buzz/talexander/webhook_bridge",
|
||||
@ -109,7 +107,7 @@
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-07-14T18:48:52Z",
|
||||
"updated_at": "2024-09-29T02:41:59Z",
|
||||
"updated_at": "2024-09-29T03:50:36Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
|
@ -34,7 +34,7 @@ pub(crate) async fn discover_matching_push_triggers<RE: AsRef<str>>(
|
||||
remote_config: &RemoteConfig,
|
||||
) -> Result<Vec<PipelineTemplate>, Box<dyn std::error::Error>> {
|
||||
let mut ret = Vec::new();
|
||||
let ref_to_branch_regex = Regex::new(r"refs/heads/(?P<branch>.+)")?;
|
||||
let ref_to_branch_regex = Regex::new(r"refs/(heads|tags)/(?P<branch>.+)")?;
|
||||
let captures = ref_to_branch_regex
|
||||
.captures(git_ref.as_ref())
|
||||
.ok_or("Could not find branch name.")?;
|
||||
|
@ -166,7 +166,7 @@ pub(crate) trait PipelineParamters {
|
||||
|
||||
impl PipelineParamters for HookPush {
|
||||
fn get_pull_base_ref(&self) -> Result<Cow<str>, Box<dyn std::error::Error>> {
|
||||
let ref_to_branch_regex = Regex::new(r"refs/heads/(?P<branch>.+)")?;
|
||||
let ref_to_branch_regex = Regex::new(r"refs/(heads|tags)/(?P<branch>.+)")?;
|
||||
let captures = ref_to_branch_regex
|
||||
.captures(self.ref_field.as_str())
|
||||
.ok_or("Could not find branch name.")?;
|
||||
|
@ -62,7 +62,7 @@ impl RemoteConfig {
|
||||
.iter()
|
||||
.map(|s| Regex::new(s.as_str()))
|
||||
.collect::<Result<_, _>>()?;
|
||||
if !push.branches.is_empty() && !match_regex.iter().any(|r| r.is_match(branch)) {
|
||||
if !push.branches.is_empty() && match_regex.iter().any(|r| r.is_match(branch)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user