Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ed5a7dad5 |
@@ -14,9 +14,6 @@ spec:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
@@ -61,11 +58,13 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
@@ -86,7 +85,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -106,11 +105,11 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/kaniko/0.6/kaniko.yaml
|
||||
value: task/kaniko/0.6//kaniko.yaml
|
||||
params:
|
||||
- name: IMAGE
|
||||
value: "$(params.image-name):$(tasks.detect-tag.results.tag)"
|
||||
@@ -123,7 +122,6 @@ spec:
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- "--destination=$(params.image-name)" # Also write the :latest image
|
||||
- "--target=$(params.target-name)"
|
||||
- --cache=true
|
||||
- --cache-copy-layers
|
||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
||||
@@ -137,6 +135,8 @@ spec:
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- detect-tag
|
||||
finally:
|
||||
- name: report-success
|
||||
when:
|
||||
@@ -147,7 +147,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -176,7 +176,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -216,8 +216,6 @@ spec:
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge"
|
||||
- name: target-name
|
||||
value: ""
|
||||
- name: path-to-image-context
|
||||
value: .
|
||||
- name: path-to-dockerfile
|
||||
@@ -14,9 +14,6 @@ spec:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
@@ -29,11 +26,13 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
@@ -54,7 +53,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -74,7 +73,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -90,7 +89,6 @@ spec:
|
||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- "--target=$(params.target-name)"
|
||||
- --cache=true
|
||||
- --cache-copy-layers
|
||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
||||
@@ -104,6 +102,8 @@ spec:
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-fmt
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
@@ -149,7 +149,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -185,7 +185,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -214,7 +214,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -292,9 +292,7 @@ spec:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development-format"
|
||||
- name: target-name
|
||||
value: ""
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development"
|
||||
- name: path-to-image-context
|
||||
value: docker/webhook_bridge_development/
|
||||
- name: path-to-dockerfile
|
||||
|
||||
@@ -14,9 +14,6 @@ spec:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
@@ -29,11 +26,13 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
@@ -54,7 +53,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -74,7 +73,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -90,7 +89,6 @@ spec:
|
||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- "--target=$(params.target-name)"
|
||||
- --cache=true
|
||||
- --cache-copy-layers
|
||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
||||
@@ -104,6 +102,8 @@ spec:
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-clippy
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
@@ -164,7 +164,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -193,7 +193,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -271,9 +271,7 @@ spec:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development-clippy"
|
||||
- name: target-name
|
||||
value: ""
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development"
|
||||
- name: path-to-image-context
|
||||
value: docker/webhook_bridge_development/
|
||||
- name: path-to-dockerfile
|
||||
|
||||
@@ -14,9 +14,6 @@ spec:
|
||||
- name: image-name
|
||||
description: The name for the built image
|
||||
type: string
|
||||
- name: target-name
|
||||
description: The dockerfile target to build
|
||||
type: string
|
||||
- name: path-to-image-context
|
||||
description: The path to the build context
|
||||
type: string
|
||||
@@ -29,11 +26,13 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
@@ -54,7 +53,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -74,11 +73,11 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/kaniko/0.6/kaniko.yaml
|
||||
value: task/kaniko/0.6//kaniko.yaml
|
||||
params:
|
||||
- name: IMAGE
|
||||
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
|
||||
@@ -90,7 +89,6 @@ spec:
|
||||
value: "gcr.io/kaniko-project/executor:v1.12.1"
|
||||
- name: EXTRA_ARGS
|
||||
value:
|
||||
- "--target=$(params.target-name)"
|
||||
- --cache=true
|
||||
- --cache-copy-layers
|
||||
- --cache-repo=harbor.fizz.buzz/kanikocache/cache
|
||||
@@ -104,6 +102,8 @@ spec:
|
||||
workspace: git-source
|
||||
- name: dockerconfig
|
||||
workspace: docker-credentials
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- name: run-cargo-test
|
||||
taskSpec:
|
||||
metadata: {}
|
||||
@@ -154,7 +154,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -183,7 +183,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -261,9 +261,7 @@ spec:
|
||||
secretName: harbor-plain
|
||||
params:
|
||||
- name: image-name
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development-test"
|
||||
- name: target-name
|
||||
value: ""
|
||||
value: "harbor.fizz.buzz/private/webhook-bridge-development"
|
||||
- name: path-to-image-context
|
||||
value: docker/webhook_bridge_development/
|
||||
- name: path-to-dockerfile
|
||||
|
||||
@@ -26,7 +26,7 @@ spec:
|
||||
tasks:
|
||||
- name: calculate-tag
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
- report-pending
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: git-source
|
||||
@@ -72,11 +72,13 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
value: task/gitea-set-status/0.1/gitea-set-status.yaml
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
params:
|
||||
- name: CONTEXT
|
||||
value: "$(params.JOB_NAME)"
|
||||
@@ -97,7 +99,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -122,7 +124,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
@@ -151,7 +153,7 @@ spec:
|
||||
resolver: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://code.fizz.buzz/mirror/catalog.git # mirror of https://github.com/tektoncd/catalog.git
|
||||
value: https://github.com/tektoncd/catalog.git
|
||||
- name: revision
|
||||
value: df36b3853a5657fd883015cdbf07ad6466918acf
|
||||
- name: pathInRepo
|
||||
|
||||
@@ -26,6 +26,6 @@ version = "0.0.1"
|
||||
|
||||
[[push]]
|
||||
name = "build"
|
||||
source = "pipeline-build-semver.yaml"
|
||||
source = "pipeline-build.yaml"
|
||||
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
|
||||
branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
cargo-features = ["codegen-backend"]
|
||||
|
||||
[package]
|
||||
name = "webhook_bridge"
|
||||
version = "0.0.1"
|
||||
@@ -59,3 +61,10 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
|
||||
inherits = "release"
|
||||
lto = true
|
||||
strip = "symbols"
|
||||
|
||||
[profile.dev]
|
||||
codegen-backend = "cranelift"
|
||||
|
||||
[profile.dev.package."*"]
|
||||
codegen-backend = "llvm"
|
||||
opt-level = 3
|
||||
|
||||
@@ -2,5 +2,6 @@ FROM rustlang/rust:nightly-alpine3.20 AS builder
|
||||
|
||||
RUN apk add --no-cache musl-dev pkgconfig libressl3.8-libssl libressl-dev
|
||||
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
|
||||
RUN rustup component add rustc-codegen-cranelift
|
||||
RUN rustup component add rustfmt
|
||||
RUN rustup component add clippy
|
||||
|
||||
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.2",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"after": "84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/0000000000000000000000000000000000000000...84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"commits": [],
|
||||
"total_commits": 0,
|
||||
"head_commit": {
|
||||
"id": "84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"message": "Add a pipeline to build the server image.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
"username": ""
|
||||
},
|
||||
"committer": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-09-29T00:19:22-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-build.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": 346,
|
||||
"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-29T04:25:36Z",
|
||||
"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": "f3b00c46ea57d5314063ad6fbfcaf9e38712cafe",
|
||||
"after": "e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/f3b00c46ea57d5314063ad6fbfcaf9e38712cafe...e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"before": "a2aca6d2f1c85b5d4bef1349230fdaef1683622d",
|
||||
"after": "84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"compare_url": "https://code.fizz.buzz/talexander/webhook_bridge/compare/a2aca6d2f1c85b5d4bef1349230fdaef1683622d...84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"commits": [
|
||||
{
|
||||
"id": "e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"message": "Add source_id to HookUser.\n\nThis must be a new field that gitea added in an update.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"id": "84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"message": "Add a pipeline to build the server image.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
@@ -19,24 +19,21 @@
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-10-18T19:41:56-04:00",
|
||||
"added": [],
|
||||
"timestamp": "2024-09-29T00:19:22-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-build.yaml"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
".webhook_bridge/pipeline-build-semver.yaml",
|
||||
".webhook_bridge/pipeline-format.yaml",
|
||||
".webhook_bridge/pipeline-rust-clippy.yaml",
|
||||
".webhook_bridge/pipeline-rust-test.yaml",
|
||||
".webhook_bridge/pipeline-semver.yaml",
|
||||
"src/hook_push.rs"
|
||||
".webhook_bridge/webhook_bridge.toml"
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_commits": 1,
|
||||
"head_commit": {
|
||||
"id": "e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"message": "Add source_id to HookUser.\n\nThis must be a new field that gitea added in an update.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/e991b259f2bdf3f24a2cba309a93d81f32ab7f50",
|
||||
"id": "84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"message": "Add a pipeline to build the server image.\n",
|
||||
"url": "https://code.fizz.buzz/talexander/webhook_bridge/commit/84fe1ec23ae242cb1bbccbc2ab999c3082f54d45",
|
||||
"author": {
|
||||
"name": "Tom Alexander",
|
||||
"email": "tom@fizz.buzz",
|
||||
@@ -48,16 +45,13 @@
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-10-18T19:41:56-04:00",
|
||||
"added": [],
|
||||
"timestamp": "2024-09-29T00:19:22-04:00",
|
||||
"added": [
|
||||
".webhook_bridge/pipeline-build.yaml"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
".webhook_bridge/pipeline-build-semver.yaml",
|
||||
".webhook_bridge/pipeline-format.yaml",
|
||||
".webhook_bridge/pipeline-rust-clippy.yaml",
|
||||
".webhook_bridge/pipeline-rust-test.yaml",
|
||||
".webhook_bridge/pipeline-semver.yaml",
|
||||
"src/hook_push.rs"
|
||||
".webhook_bridge/webhook_bridge.toml"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@@ -66,11 +60,9 @@
|
||||
"id": 1,
|
||||
"login": "talexander",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "gitea@local.domain",
|
||||
"avatar_url": "https://code.fizz.buzz/avatars/9d402a89b5a0786f83c1b8c5486fc7ff3d083a54fe20e55c0a776a1932c30289",
|
||||
"html_url": "https://code.fizz.buzz/talexander",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
@@ -96,7 +88,7 @@
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 151,
|
||||
"size": 343,
|
||||
"language": "",
|
||||
"languages_url": "https://code.fizz.buzz/api/v1/repos/talexander/webhook_bridge/languages",
|
||||
"html_url": "https://code.fizz.buzz/talexander/webhook_bridge",
|
||||
@@ -115,7 +107,7 @@
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-07-14T18:48:52Z",
|
||||
"updated_at": "2024-09-30T04:41:20Z",
|
||||
"updated_at": "2024-09-29T04:14:47Z",
|
||||
"archived_at": "1970-01-01T00:00:00Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
@@ -128,19 +120,17 @@
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": false,
|
||||
"has_wiki": true,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": false,
|
||||
"projects_mode": "all",
|
||||
"has_projects": true,
|
||||
"has_releases": true,
|
||||
"has_packages": false,
|
||||
"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_fast_forward_only_merge": false,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "merge",
|
||||
@@ -148,7 +138,6 @@
|
||||
"avatar_url": "",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha1",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null
|
||||
},
|
||||
@@ -156,11 +145,9 @@
|
||||
"id": 1,
|
||||
"login": "talexander",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "talexander@noreply.code.fizz.buzz",
|
||||
"avatar_url": "https://code.fizz.buzz/avatars/9d402a89b5a0786f83c1b8c5486fc7ff3d083a54fe20e55c0a776a1932c30289",
|
||||
"html_url": "https://code.fizz.buzz/talexander",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
@@ -181,11 +168,9 @@
|
||||
"id": 1,
|
||||
"login": "talexander",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "talexander@noreply.code.fizz.buzz",
|
||||
"avatar_url": "https://code.fizz.buzz/avatars/9d402a89b5a0786f83c1b8c5486fc7ff3d083a54fe20e55c0a776a1932c30289",
|
||||
"html_url": "https://code.fizz.buzz/talexander",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
@@ -1,7 +1,13 @@
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use kube::Client;
|
||||
|
||||
use crate::gitea_client::GiteaClient;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct AppState {
|
||||
pub(crate) kubernetes_client: Client,
|
||||
pub(crate) gitea: GiteaClient,
|
||||
pub(crate) allowed_repos: Arc<HashSet<String>>,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
use webhookbridge::init_tracing;
|
||||
use webhookbridge::local_trigger;
|
||||
|
||||
const EXAMPLE_WEBHOOK_PAYLOAD: &str = include_str!("../local_payload.json");
|
||||
const EXAMPLE_WEBHOOK_PAYLOAD: &str = include_str!("../example_tag_webhook_payload.json");
|
||||
|
||||
#[tokio::main]
|
||||
#[allow(clippy::needless_return)]
|
||||
|
||||
@@ -28,12 +28,9 @@ pub(crate) struct HookUser {
|
||||
id: u64,
|
||||
login: String,
|
||||
login_name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
source_id: Option<u64>,
|
||||
full_name: String,
|
||||
email: String,
|
||||
avatar_url: String,
|
||||
html_url: String,
|
||||
language: String,
|
||||
is_admin: bool,
|
||||
last_login: String, // TODO: parse to datetime
|
||||
@@ -93,7 +90,6 @@ pub(crate) struct HookRepository {
|
||||
has_wiki: bool,
|
||||
has_pull_requests: bool,
|
||||
has_projects: bool,
|
||||
projects_mode: String,
|
||||
has_releases: bool,
|
||||
has_packages: bool,
|
||||
has_actions: bool,
|
||||
@@ -102,7 +98,6 @@ pub(crate) struct HookRepository {
|
||||
allow_rebase: bool,
|
||||
allow_rebase_explicit: bool,
|
||||
allow_squash_merge: bool,
|
||||
allow_fast_forward_only_merge: bool,
|
||||
allow_rebase_update: bool,
|
||||
default_delete_branch_after_merge: bool,
|
||||
default_merge_style: String,
|
||||
@@ -110,7 +105,6 @@ pub(crate) struct HookRepository {
|
||||
avatar_url: String,
|
||||
internal: bool,
|
||||
mirror_interval: String,
|
||||
object_format_name: String,
|
||||
mirror_updated: String, // TODO: parse to datetime
|
||||
repo_transfer: Value, // Was null in test hook
|
||||
}
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -47,6 +47,14 @@ pub async fn init_tracing() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let kubernetes_client: Client = Client::try_default()
|
||||
.await
|
||||
.expect("Set KUBECONFIG to a valid kubernetes config.");
|
||||
|
||||
let gitea_api_root = std::env::var("WEBHOOK_BRIDGE_API_ROOT")?;
|
||||
let gitea_api_token = std::env::var("WEBHOOK_BRIDGE_OAUTH_TOKEN")?;
|
||||
let gitea = GiteaClient::new(gitea_api_root, gitea_api_token);
|
||||
|
||||
let allowed_repos = std::env::var("WEBHOOK_BRIDGE_REPO_WHITELIST")?;
|
||||
let allowed_repos: HashSet<_> = allowed_repos
|
||||
.split(",")
|
||||
@@ -65,6 +73,8 @@ pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> {
|
||||
TimeoutLayer::new(Duration::from_secs(600)),
|
||||
))
|
||||
.with_state(AppState {
|
||||
kubernetes_client,
|
||||
gitea,
|
||||
allowed_repos: Arc::new(allowed_repos),
|
||||
});
|
||||
|
||||
|
||||
@@ -42,24 +42,12 @@ pub(crate) async fn hook(
|
||||
debug!("REQ: {:?}", payload);
|
||||
match payload {
|
||||
HookRequest::Push(webhook_payload) => {
|
||||
let kubernetes_client: kube::Client = kube::Client::try_default()
|
||||
let kubernetes_client: Client = Client::try_default()
|
||||
.await
|
||||
.expect("Set KUBECONFIG to a valid kubernetes config.");
|
||||
|
||||
let gitea_api_root = std::env::var("WEBHOOK_BRIDGE_API_ROOT");
|
||||
let gitea_api_token = std::env::var("WEBHOOK_BRIDGE_OAUTH_TOKEN");
|
||||
let (gitea_api_root, gitea_api_token) = match (gitea_api_root, gitea_api_token) {
|
||||
(Ok(r), Ok(t)) => (r, t),
|
||||
_ => {
|
||||
return (
|
||||
StatusCode::OK,
|
||||
Json(HookResponse {
|
||||
ok: true,
|
||||
message: None,
|
||||
}),
|
||||
);
|
||||
}
|
||||
};
|
||||
let gitea_api_root = std::env::var("WEBHOOK_BRIDGE_API_ROOT")?;
|
||||
let gitea_api_token = std::env::var("WEBHOOK_BRIDGE_OAUTH_TOKEN")?;
|
||||
let gitea = GiteaClient::new(gitea_api_root, gitea_api_token);
|
||||
|
||||
let push_result = handle_push(
|
||||
|
||||
Reference in New Issue
Block a user