2 Commits

Author SHA1 Message Date
Tom Alexander
f3b00c46ea Test: Remove the clients from AppState entirely.
Some checks failed
semver Build semver has succeeded
format Build format has succeeded
clippy Build clippy has succeeded
rust-test Build rust-test has failed
build Build build has succeeded
2024-09-30 00:38:32 -04:00
Tom Alexander
e4463fe79d Remove redundant runAfter directives from workflows.
Some checks failed
semver Build semver has failed
format Build format has succeeded
clippy Build clippy has failed
rust-test Build rust-test has succeeded
2024-09-30 00:29:07 -04:00
7 changed files with 1 additions and 35 deletions

View File

@@ -66,8 +66,6 @@ spec:
value: df36b3853a5657fd883015cdbf07ad6466918acf value: df36b3853a5657fd883015cdbf07ad6466918acf
- name: pathInRepo - name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@@ -139,8 +137,6 @@ spec:
workspace: git-source workspace: git-source
- name: dockerconfig - name: dockerconfig
workspace: docker-credentials workspace: docker-credentials
runAfter:
- detect-tag
finally: finally:
- name: report-success - name: report-success
when: when:

View File

@@ -34,8 +34,6 @@ spec:
value: df36b3853a5657fd883015cdbf07ad6466918acf value: df36b3853a5657fd883015cdbf07ad6466918acf
- name: pathInRepo - name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@@ -106,8 +104,6 @@ spec:
workspace: git-source workspace: git-source
- name: dockerconfig - name: dockerconfig
workspace: docker-credentials workspace: docker-credentials
runAfter:
- fetch-repository
- name: run-cargo-fmt - name: run-cargo-fmt
taskSpec: taskSpec:
metadata: {} metadata: {}

View File

@@ -34,8 +34,6 @@ spec:
value: df36b3853a5657fd883015cdbf07ad6466918acf value: df36b3853a5657fd883015cdbf07ad6466918acf
- name: pathInRepo - name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@@ -106,8 +104,6 @@ spec:
workspace: git-source workspace: git-source
- name: dockerconfig - name: dockerconfig
workspace: docker-credentials workspace: docker-credentials
runAfter:
- fetch-repository
- name: run-cargo-clippy - name: run-cargo-clippy
taskSpec: taskSpec:
metadata: {} metadata: {}

View File

@@ -34,8 +34,6 @@ spec:
value: df36b3853a5657fd883015cdbf07ad6466918acf value: df36b3853a5657fd883015cdbf07ad6466918acf
- name: pathInRepo - name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@@ -106,8 +104,6 @@ spec:
workspace: git-source workspace: git-source
- name: dockerconfig - name: dockerconfig
workspace: docker-credentials workspace: docker-credentials
runAfter:
- fetch-repository
- name: run-cargo-test - name: run-cargo-test
taskSpec: taskSpec:
metadata: {} metadata: {}

View File

@@ -26,7 +26,7 @@ spec:
tasks: tasks:
- name: calculate-tag - name: calculate-tag
runAfter: runAfter:
- report-pending - fetch-repository
workspaces: workspaces:
- name: source - name: source
workspace: git-source workspace: git-source
@@ -77,8 +77,6 @@ spec:
value: df36b3853a5657fd883015cdbf07ad6466918acf value: df36b3853a5657fd883015cdbf07ad6466918acf
- name: pathInRepo - name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"

View File

@@ -1,13 +1,7 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::sync::Arc; use std::sync::Arc;
use kube::Client;
use crate::gitea_client::GiteaClient;
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct AppState { pub(crate) struct AppState {
pub(crate) kubernetes_client: Client,
pub(crate) gitea: GiteaClient,
pub(crate) allowed_repos: Arc<HashSet<String>>, pub(crate) allowed_repos: Arc<HashSet<String>>,
} }

View File

@@ -47,14 +47,6 @@ pub async fn init_tracing() -> Result<(), Box<dyn std::error::Error>> {
} }
pub async fn launch_server() -> 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 = std::env::var("WEBHOOK_BRIDGE_REPO_WHITELIST")?;
let allowed_repos: HashSet<_> = allowed_repos let allowed_repos: HashSet<_> = allowed_repos
.split(",") .split(",")
@@ -73,8 +65,6 @@ pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> {
TimeoutLayer::new(Duration::from_secs(600)), TimeoutLayer::new(Duration::from_secs(600)),
)) ))
.with_state(AppState { .with_state(AppState {
kubernetes_client,
gitea,
allowed_repos: Arc::new(allowed_repos), allowed_repos: Arc::new(allowed_repos),
}); });