Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
fix: cope with heartwood's Id->RepoId rename
Lars Wirzenius committed 2 years ago
commit 3a7c8b668d054b21cd670bf0fb5aa751861adef0
parent 49f6711
5 files changed +13 -13
modified src/bin/run_log.rs
@@ -1,6 +1,6 @@
use std::path::Path;

-
use radicle_ci_broker::msg::{Id, Oid};
+
use radicle_ci_broker::msg::{Oid, RepoId};

use radicle_native_ci::runlog::RunLog;

@@ -8,7 +8,7 @@ use radicle_native_ci::runlog::RunLog;
fn main() {
    let mut run_log = RunLog::new(Path::new("testlog.html"));
    run_log.title("Some Title");
-
    run_log.rid(Id::from_urn("rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE").expect("rid"));
+
    run_log.rid(RepoId::from_urn("rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE").expect("rid"));
    run_log.commit(Oid::try_from("b788f7ffd38572614457adb1656c0b4575b941dd").expect("commit"));
    run_log.runcmd(
        &["git", "pull"],
modified src/engine.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use uuid::Uuid;

use radicle::prelude::Profile;
-
use radicle_ci_broker::msg::{Id, Oid, Request, RunId, RunResult};
+
use radicle_ci_broker::msg::{Oid, RepoId, Request, RunId, RunResult};

use crate::{
    config::{Config, ConfigError},
@@ -140,7 +140,7 @@ impl Engine {

    // Execute the CI run. Log any problems to a log for this run, and
    // persist that. Update the run info builder as needed.
-
    fn run_helper(&mut self, rid: Id, commit: Oid) -> Result<bool, EngineError> {
+
    fn run_helper(&mut self, rid: RepoId, commit: Oid) -> Result<bool, EngineError> {
        // Pick a run id and create a directory for files related to
        // the run.
        let (run_id, run_dir) = mkdir_run(&self.config)?;
modified src/run.rs
@@ -3,7 +3,7 @@ use std::{
    process::Command,
};

-
use radicle_ci_broker::msg::{Id, Oid};
+
use radicle_ci_broker::msg::{Oid, RepoId};

use crate::{
    msg::NativeMessageError,
@@ -29,7 +29,7 @@ const RUNSPEC_PATH: &str = ".radicle/native.yaml";
#[derive(Debug)]
pub struct Run {
    run_log: RunLog,
-
    rid: Option<Id>,
+
    rid: Option<RepoId>,
    commit: Option<Oid>,
    storage: Option<PathBuf>,
    timeout: Option<usize>,
@@ -52,7 +52,7 @@ impl Run {
    }

    /// Set the git repository to use for this run.
-
    pub fn set_repository(&mut self, rid: Id) {
+
    pub fn set_repository(&mut self, rid: RepoId) {
        self.rid = Some(rid);
    }

modified src/runinfo.rs
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
use time::{macros::format_description, OffsetDateTime};

-
use radicle_ci_broker::msg::{Id, Oid, RunId, RunResult};
+
use radicle_ci_broker::msg::{Oid, RepoId, RunId, RunResult};

/// Metadata about a run.
#[derive(Debug, Serialize, Deserialize)]
@@ -52,7 +52,7 @@ impl RunInfo {
#[derive(Debug, Default)]
#[allow(dead_code)]
pub struct RunInfoBuilder {
-
    repo: Option<Id>,
+
    repo: Option<RepoId>,
    commit: Option<Oid>,
    run_id: Option<String>,
    result: Option<RunResult>,
@@ -61,7 +61,7 @@ pub struct RunInfoBuilder {
}

impl RunInfoBuilder {
-
    pub fn repo(&mut self, repo: Id) {
+
    pub fn repo(&mut self, repo: RepoId) {
        self.repo = Some(repo);
    }

modified src/runlog.rs
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};

use html_page::{Document, Element, Tag};

-
use radicle_ci_broker::msg::{Id, Oid};
+
use radicle_ci_broker::msg::{Oid, RepoId};

use crate::runspec::RunSpecError;

@@ -10,7 +10,7 @@ use crate::runspec::RunSpecError;
pub struct RunLog {
    filename: PathBuf,
    title: Option<String>,
-
    rid: Option<Id>,
+
    rid: Option<RepoId>,
    commit: Option<Oid>,
    commands: Vec<Command>,
    timeout: bool,
@@ -29,7 +29,7 @@ impl RunLog {
        self.title = Some(title.into());
    }

-
    pub fn rid(&mut self, rid: Id) {
+
    pub fn rid(&mut self, rid: RepoId) {
        self.rid = Some(rid);
    }