update deps

This commit is contained in:
sevki 2024-05-25 10:24:48 +01:00
parent 7c7daff745
commit 68b98de797
8 changed files with 150 additions and 34 deletions

8
.cargo/config.toml Normal file
View file

@ -0,0 +1,8 @@
[registry]
default = "oksoftware"
[registries.oksoftware]
index = "sparse+https://ok.software/api/packages/ok/cargo/" # Sparse index
[net]
git-fetch-with-cli = true

105
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "actions-proto-rs"
version = "0.1.0"
source = "registry+https://git.ok.software/ok/_cargo-index.git"
checksum = "103ad30c374e6bbaa9668ba99193159326f7396665d306b8e8b8701f44f93c4d"
version = "0.1.2"
source = "sparse+https://ok.software/api/packages/ok/cargo/"
checksum = "82413645b9516043d46c6a00b76793e4e83d0cb9d696925dd94eff9510c2ae1c"
dependencies = [
"hyper",
"prost",
@ -18,7 +18,7 @@ dependencies = [
[[package]]
name = "actions-proto-rs"
version = "0.1.1"
version = "0.1.3"
dependencies = [
"hyper",
"prost",
@ -58,6 +58,37 @@ version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "argh"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219"
dependencies = [
"argh_derive",
"argh_shared",
]
[[package]]
name = "argh_derive"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a"
dependencies = [
"argh_shared",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "argh_shared"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531"
dependencies = [
"serde",
]
[[package]]
name = "async-stream"
version = "0.3.5"
@ -299,6 +330,15 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
[[package]]
name = "futures-channel"
version = "0.3.30"
@ -367,15 +407,17 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "gump"
version = "0.1.0"
version = "0.1.2"
dependencies = [
"actions-proto-rs 0.1.0",
"actions-proto-rs 0.1.2",
"argh",
"hyper",
"hyper-tls",
"tokio",
"tonic",
"tonic-web",
"tower",
"url",
"uuid",
]
@ -511,6 +553,16 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "indexmap"
version = "1.9.3"
@ -1105,6 +1157,21 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.37.0"
@ -1333,12 +1400,38 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "unicode-bidi"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
dependencies = [
"tinyvec",
]
[[package]]
name = "url"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
[[package]]
name = "uuid"
version = "1.8.0"

View file

@ -1,7 +1,7 @@
workspace = { members = ["gump"] }
[package]
name = "actions-proto-rs"
version = "0.1.1"
version = "0.1.3"
edition = "2021"
repository = "https://ok.software/ok/runner_rs.git"
description = "Protobuf definitions for Forgejo actions"

View file

@ -15,7 +15,7 @@ fn main() {
"-L",
"-o",
outfile.to_str().unwrap(),
"https://git.ok.software/ok/actions-proto-def/archive/main.tar.gz",
"https://ok.software/ok/actions-proto-def/archive/main.tar.gz",
])
.status()
.unwrap();

View file

@ -1,11 +0,0 @@
{
"WARNING": "This file is automatically generated by act-runner. Do not edit it manually unless you know what you are doing. Removing this file will cause act runner to re-register as a new runner.",
"id": 19,
"uuid": "2e316e01-b5ca-459e-acac-47c79dc76c37",
"name": "nixos",
"token": "ab717f33b403025c465c3e22f7b121c134f45ee6",
"address": "https://git.ok.software",
"labels": [
"docker:docker://node:16-bullseye"
]
}

View file

@ -1,15 +1,17 @@
[package]
name = "gump"
version = "0.1.0"
version = "0.1.3"
edition = "2021"
license = "MIT"
description = "A forgejo / gitea action runner"
repository = "https://ok.software/ok/action-proto-rs"
repository = "https://ok.software/ok/runner_rs.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actions-proto-rs = { version = "0.1.0", registry = "oksoftware" }
actions-proto-rs = { version = "0.1.1", registry = "oksoftware" }
url = "2.2.2"
argh = "0.1.1"
hyper = { version = "0.14" }
hyper-tls = "0.5"
tokio = { version = "1.37.0", features = ["full"] }

Binary file not shown.

View file

@ -1,6 +1,7 @@
use actions_proto_rs::ping_service_client::PingServiceClient;
use actions_proto_rs::runner_service_client::RunnerServiceClient;
use actions_proto_rs::RegisterRequest;
use hyper::Uri;
use hyper::client::HttpConnector;
use hyper::Client;
use hyper_tls::HttpsConnector;
@ -12,32 +13,55 @@ use tonic::service::Interceptor;
use tonic::Extensions;
use tonic::{transport::Channel, Request};
use tonic_web::GrpcWebClientLayer;
use url::Url;
use argh::FromArgs;
const UUID_HEADER_KEY: &str = "x-runner-uuid";
const TOKEN_HEADER_KEY: &str = "x-runner-token";
const VERSION_HEADER_KEY: &str = "x-runner-version";
// Structure to hold command-line arguments
#[derive(FromArgs, Debug)]
/// Actions Runner Client
struct Gump {
/// authentication token
#[argh(option, short = 't', long = "token")]
token: String,
/// runner version
#[argh(option, short = 'v', long = "version")]
version: Option<String>,
/// unique identifier
#[argh(option, short = 'u', long = "uuid")]
uuid: Option<String>,
/// base URL of the API server
#[argh(option, short = 'b', long = "base-url")]
base_url: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let token = "V4jpnTdZJBOVawC7tuQqZwdPpAnORlygg8Uoz2ff";
// version needcs to be in v3.4.1 format
// so concat v
let version = concat!("v", env!("CARGO_PKG_VERSION"));
let version = "v3.4.1";
let uuid = uuid::Uuid::new_v4().to_string();
// Parse arguments using argh
let args: Gump = argh::from_env();
// Parse base URL
let base_url = args.base_url.unwrap_or("https://ok.software/api/actions".to_string());
let version = args.version.unwrap_or(concat!("v", env!("CARGO_PKG_VERSION")).to_string());
let base_url = base_url.parse::<Uri>().unwrap();
let client = hyper::Client::builder().build(HttpsConnector::new());
let svc = tower::ServiceBuilder::new()
.layer(GrpcWebClientLayer::new())
.service(client);
let mut runner_client = RunnerServiceClient::with_origin(
svc.clone(),
"https://git.ok.software/api/actions".try_into()?,
base_url.clone(),
);
let mut ping_client =
PingServiceClient::with_origin(svc, "https://git.ok.software/api/actions".try_into()?);
let mut ping_client = PingServiceClient::with_origin(svc, base_url);
let token = args.token;
let uuid = args.uuid.unwrap_or(uuid::Uuid::new_v4().to_string());
// Log the client creation
println!("Client created with UUID: {}", uuid);
@ -83,7 +107,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Extensions::default(),
RegisterRequest {
name: "nixos".to_string(),
version: version.to_string(),
version: version,
token: token.to_string(),
labels: labels.clone(),
agent_labels: labels,