From 2f687b633af95d709a59d0aac9c096a8119da9e7 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Mon, 3 Apr 2023 00:18:32 +0200 Subject: [PATCH] add updater --- Cargo.lock | 10 ---------- Cargo.toml | 5 +---- ci/src/main.rs | 34 +++++++++++++++++++++++++++++++--- src/main.rs | 6 +++--- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 375fc7c..c278d86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -478,15 +478,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "111.25.1+1.1.1t" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef9a9cc6ea7d9d5e7c4a913dc4b48d0e359eddf01af1dfec96ba7064b4aba10" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.84" @@ -495,7 +486,6 @@ checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cargo.toml b/Cargo.toml index da24d28..5d3a35f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +git2 = { version = "0.16.1" } clap = "4.2.1" color-eyre = "0.6.2" dotenv = "0.15.0" eyre = "0.6.8" -git2 = { version = "0.16.1", features = [ - "vendored-libgit2", - "vendored-openssl", -] } serde = { version = "1.0.159", features = ["derive"] } serde_json = "1.0.95" serde_yaml = "0.9.19" diff --git a/ci/src/main.rs b/ci/src/main.rs index ac9821f..846a7af 100644 --- a/ci/src/main.rs +++ b/ci/src/main.rs @@ -12,11 +12,11 @@ async fn main() -> eyre::Result<()> { let src = client.host().directory_opts( ".", HostDirectoryOptsBuilder::default() - .exclude(vec!["target/", ".git/"]) + .exclude(vec!["target/", ".git/", "ci/"]) .build()?, ); - let variants = vec!["linux/amd64", "linux/arm64"]; + let variants = vec![/*"linux/amd64", */ "linux/arm64"]; let platform_variants = Arc::new(Mutex::new(Vec::new())); tokio_scoped::scope(|s| { @@ -35,6 +35,31 @@ async fn main() -> eyre::Result<()> { ) .from("rustlang/rust:nightly") .with_workdir("/app") + //.with_exec(vec!["apt-get", "update"]) + //.with_exec(vec![ + // "apt-get", + // "install", + // "-y", + // "build-essential", + // "cmake", + // "curl", + // "file", + // "git", + // "sudo", + // "xutils-dev", + // "unzip", + // "ca-certificates", + // "python3", + // "python3-pip", + // "autoconf", + // "autoconf-archive", + // "automake", + // "flex", + // "bison", + // "llvm-dev", + // "libclang-dev", + // "clang", + //]) .with_directory(".", src.id().await.unwrap()) .with_exec(vec!["cargo", "build", "--release"]); @@ -46,6 +71,8 @@ async fn main() -> eyre::Result<()> { .unwrap(), ) .from("debian:bullseye") + .with_exec(vec!["apt-get", "update"]) + .with_exec(vec!["apt-get", "install", "-y", "openssl", "git"]) .with_file( "/usr/bin/update-deployment", rust_dep_image @@ -53,7 +80,8 @@ async fn main() -> eyre::Result<()> { .id() .await .unwrap(), - ); + ) + .with_exec(vec!["update-deployment", "--help"]); let mut platform_variants = platform_variants.lock().await; platform_variants.push(dep_image.id().await.unwrap()) diff --git a/src/main.rs b/src/main.rs index b00c738..e3e0cfd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,12 @@ use git2::build::{CheckoutBuilder, RepoBuilder}; -use git2::{Cred, FetchOptions, PushOptions, RemoteCallbacks}; +use git2::{Cred, FetchOptions, PushOptions, RemoteCallbacks, Signature}; use serde::{Deserialize, Serialize}; use serde_yaml::Value; use tempdir::TempDir; #[tokio::main] async fn main() -> eyre::Result<()> { - dotenv::dotenv()?; + let _ = dotenv::dotenv(); color_eyre::install().unwrap(); tracing_subscriber::fmt().pretty().init(); @@ -98,7 +98,7 @@ async fn main() -> eyre::Result<()> { index.write_tree()? }; - let sig = repo.signature()?; + let sig = Signature::now("kjuulh", "contact@kjuulh.io")?; let tree = repo.find_tree(tree_id)?; let head = repo.head()?;