1 Commits

Author SHA1 Message Date
Tom Alexander
81bebf7e17 Test: instantiate new clients for every request.
Some checks failed
semver Build semver has succeeded
format Build format has succeeded
rust-test Build rust-test has failed
build Build build has failed
clippy Build clippy has failed
Trying to figure out why I am getting the below error occasionally in gitea:

Delivery: Post "https://webhookbridge.fizz.buzz/hook": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2024-09-29 21:50:28 -04:00
8 changed files with 16 additions and 42 deletions

View File

@@ -14,9 +14,6 @@ spec:
- name: image-name - name: image-name
description: The name for the built image description: The name for the built image
type: string type: string
- name: target-name
description: The dockerfile target to build
type: string
- name: path-to-image-context - name: path-to-image-context
description: The path to the build context description: The path to the build context
type: string type: string
@@ -125,7 +122,6 @@ spec:
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- "--destination=$(params.image-name)" # Also write the :latest image - "--destination=$(params.image-name)" # Also write the :latest image
- "--target=$(params.target-name)"
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@@ -220,8 +216,6 @@ spec:
params: params:
- name: image-name - name: image-name
value: "harbor.fizz.buzz/private/webhook-bridge" value: "harbor.fizz.buzz/private/webhook-bridge"
- name: target-name
value: ""
- name: path-to-image-context - name: path-to-image-context
value: . value: .
- name: path-to-dockerfile - name: path-to-dockerfile

View File

@@ -14,9 +14,6 @@ spec:
- name: image-name - name: image-name
description: The name for the built image description: The name for the built image
type: string type: string
- name: target-name
description: The dockerfile target to build
type: string
- name: path-to-image-context - name: path-to-image-context
description: The path to the build context description: The path to the build context
type: string type: string
@@ -92,7 +89,6 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- "--target=$(params.target-name)"
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@@ -296,9 +292,7 @@ spec:
secretName: harbor-plain secretName: harbor-plain
params: params:
- name: image-name - name: image-name
value: "harbor.fizz.buzz/private/webhook-bridge-development-format" value: "harbor.fizz.buzz/private/webhook-bridge-development"
- name: target-name
value: ""
- name: path-to-image-context - name: path-to-image-context
value: docker/webhook_bridge_development/ value: docker/webhook_bridge_development/
- name: path-to-dockerfile - name: path-to-dockerfile

View File

@@ -14,9 +14,6 @@ spec:
- name: image-name - name: image-name
description: The name for the built image description: The name for the built image
type: string type: string
- name: target-name
description: The dockerfile target to build
type: string
- name: path-to-image-context - name: path-to-image-context
description: The path to the build context description: The path to the build context
type: string type: string
@@ -92,7 +89,6 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- "--target=$(params.target-name)"
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@@ -275,9 +271,7 @@ spec:
secretName: harbor-plain secretName: harbor-plain
params: params:
- name: image-name - name: image-name
value: "harbor.fizz.buzz/private/webhook-bridge-development-clippy" value: "harbor.fizz.buzz/private/webhook-bridge-development"
- name: target-name
value: ""
- name: path-to-image-context - name: path-to-image-context
value: docker/webhook_bridge_development/ value: docker/webhook_bridge_development/
- name: path-to-dockerfile - name: path-to-dockerfile

View File

@@ -14,9 +14,6 @@ spec:
- name: image-name - name: image-name
description: The name for the built image description: The name for the built image
type: string type: string
- name: target-name
description: The dockerfile target to build
type: string
- name: path-to-image-context - name: path-to-image-context
description: The path to the build context description: The path to the build context
type: string type: string
@@ -92,7 +89,6 @@ spec:
value: "gcr.io/kaniko-project/executor:v1.12.1" value: "gcr.io/kaniko-project/executor:v1.12.1"
- name: EXTRA_ARGS - name: EXTRA_ARGS
value: value:
- "--target=$(params.target-name)"
- --cache=true - --cache=true
- --cache-copy-layers - --cache-copy-layers
- --cache-repo=harbor.fizz.buzz/kanikocache/cache - --cache-repo=harbor.fizz.buzz/kanikocache/cache
@@ -265,9 +261,7 @@ spec:
secretName: harbor-plain secretName: harbor-plain
params: params:
- name: image-name - name: image-name
value: "harbor.fizz.buzz/private/webhook-bridge-development-test" value: "harbor.fizz.buzz/private/webhook-bridge-development"
- name: target-name
value: ""
- name: path-to-image-context - name: path-to-image-context
value: docker/webhook_bridge_development/ value: docker/webhook_bridge_development/
- name: path-to-dockerfile - name: path-to-dockerfile

View File

@@ -26,6 +26,6 @@ version = "0.0.1"
[[push]] [[push]]
name = "build" name = "build"
source = "pipeline-build-semver.yaml" source = "pipeline-build.yaml"
clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git" clone_uri = "git@code.fizz.buzz:talexander/webhook_bridge.git"
branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ] branches = [ "^v[0-9]+\\.[0-9]+\\.[0-9]+$" ]

View File

@@ -1,3 +1,5 @@
cargo-features = ["codegen-backend"]
[package] [package]
name = "webhook_bridge" name = "webhook_bridge"
version = "0.0.1" version = "0.0.1"
@@ -59,3 +61,10 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
inherits = "release" inherits = "release"
lto = true lto = true
strip = "symbols" strip = "symbols"
[profile.dev]
codegen-backend = "cranelift"
[profile.dev.package."*"]
codegen-backend = "llvm"
opt-level = 3

View File

@@ -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 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 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 rustfmt
RUN rustup component add clippy RUN rustup component add clippy

View File

@@ -46,20 +46,8 @@ pub(crate) async fn hook(
.await .await
.expect("Set KUBECONFIG to a valid kubernetes config."); .expect("Set KUBECONFIG to a valid kubernetes config.");
let gitea_api_root = std::env::var("WEBHOOK_BRIDGE_API_ROOT"); 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_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 = GiteaClient::new(gitea_api_root, gitea_api_token); let gitea = GiteaClient::new(gitea_api_root, gitea_api_token);
let push_result = handle_push( let push_result = handle_push(