swarm-controller, swarm-ci-metrics: build forge clients through forge-client
This commit is contained in:
parent
d54b59df7e
commit
a77131ca3f
2 changed files with 75 additions and 28 deletions
|
|
@ -9,6 +9,8 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
# Builds the forge client, from the `ci-metrics` account token.
|
||||
forge-client.workspace = true
|
||||
# The runs list and the repo search, as the `ci-metrics` account.
|
||||
forgejo-api.workspace = true
|
||||
hive-log.workspace = true
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ use std::path::{Path, PathBuf};
|
|||
use std::time::Duration;
|
||||
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use forge_client::{StaticToken, async_client};
|
||||
use forgejo_api::Forgejo;
|
||||
use forgejo_api::structs::{ActionRun, ListActionRunsQuery, RepoSearchQuery};
|
||||
use forgejo_api::{Auth, Forgejo};
|
||||
use swarm_queue_client::{ClientSecret, QueueConfig};
|
||||
use swarm_secret_client::ci_metrics::{ClientSecret as StoredClientSecret, client_secret_path};
|
||||
use swarm_secret_client::client::ENV_CLIENT_CERT;
|
||||
|
|
@ -84,8 +85,11 @@ async fn main() -> Result<()> {
|
|||
state_file: PathBuf::from(state_dir).join("cursor.json"),
|
||||
};
|
||||
|
||||
let forge = Forgejo::new(Auth::Token(&forge_token().await?), cfg.forge_url.clone())
|
||||
.context("building the forge client")?;
|
||||
let forge = async_client(
|
||||
cfg.forge_url.clone(),
|
||||
&StaticToken::new(forge_token().await?),
|
||||
)
|
||||
.context("building the forge client")?;
|
||||
let http = reqwest::Client::builder()
|
||||
.timeout(Duration::from_secs(30))
|
||||
.build()
|
||||
|
|
|
|||
Loading…
Reference in a new issue