Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
fix: don't init pretty_env_logger twice
Lars Wirzenius committed 2 years ago
commit 57791cabb101c5cbd595ddea7ac83736235b6390
parent bce0b2f
2 files changed +9 -6
modified src/main.rs
@@ -62,9 +62,6 @@ fn fallible_main() -> Result<(), NativeError> {
}

fn fallible_main_inner(config: &Config, logfile: &mut LogFile) -> Result<(), NativeError> {
-
    pretty_env_logger::init_custom_env("RADICLE_NATIVE_CI_LOG");
-
    info!("radicle-native-ci starts");
-

    let (run_id, run_dir) = mkdir_run(config)?;
    let run_id = RunId::from(format!("{}", run_id).as_str());
    logfile.write(format!("run directory {}\n", run_dir.display()))?;
@@ -221,7 +218,7 @@ fn runcmd(log: &mut LogFile, argv: &[&str], cwd: &Path) -> Result<(), NativeErro

    log.write_str("## Run command\n\n")?;
    log.write(format!("~~~\n{:?}\n~~~\n\n", argv))?;
-
    log.write(format!("in directory: {}n", cwd.display()))?;
+
    log.write(format!("in directory: {}\n\n", cwd.display()))?;

    assert!(!argv.is_empty());
    let argv0 = argv[0];
modified test.sh
@@ -25,7 +25,7 @@ expect_failure() {
cargo build --all-targets --quiet

tmp="$(mktemp -d)"
-
trap 'rm -rf "$tmp"' EXIT
+
#trap 'rm -rf "$tmp"' EXIT
export TMPDIR="$tmp"

cat <<EOF >"$tmp/config.yaml"
@@ -33,10 +33,16 @@ state: $tmp/test.state
log: $tmp/test.log
EOF

-
export RADICLE_NATIVE_CI="$tmp/test.yaml"
+
export RADICLE_NATIVE_CI="$tmp/config.yaml"
export RADICLE_NATIVE_CI_LOG=debug

python3 test.py --commit b3a9a809420c89d08460046683f33d8a5bdfdc0a >"$tmp/test-request.yaml"
expect_failure
+
echo "test.log"
+
cat "$tmp/test.log"
+

+
echo
+
echo "log.txt"
+
cat "$tmp/test.state"/*/log.txt

echo All good.