Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/holger

server/lib/src/job_runner/programs.rs

//! **The programs a job runs**, by name (`argv[0]`): compiled into
//! `holger-scan-worker` (which runs one over `/in` in the sandbox) and into the test
//! runner. A name this build does not know is the job's refusal, never a panic.

use holger_job_runner::wire::{Answer, Dirs, WireJob, JOB_SCHEMA};

/// Run `job`'s program over `dirs`.
pub fn run(job: &WireJob, dirs: &Dirs) -> Answer {
    if job.schema != JOB_SCHEMA {
        return Answer::refused(
            holger_errcode::SANDBOX_CONFIG.code,
            holger_errcode::SANDBOX_CONFIG.tag(format!(
                "the job's schema is {:?}, not {JOB_SCHEMA}",
                job.schema
            )),
        );
    }
    match job.program() {
        super::verify_bundle::PROGRAM => super::verify_bundle::run(job, dirs),
        #[cfg(feature = "import-door")]
        super::intel_import::PROGRAM => super::intel_import::run(job, dirs),
        #[cfg(feature = "scanners")]
        crate::sandbox::SCAN_PROGRAM => crate::sandbox::scan_program(job, dirs),
        // SEC-D3 (lane HOL-312-HARDEN): the manifests of a pull.
        #[cfg(feature = "jobs")]
        crate::pull_intake::manifest_job::MAVEN_CLOSURE => {
            crate::pull_intake::manifest_job::run_closure(job, dirs)
        }
        #[cfg(feature = "jobs")]
        crate::pull_intake::manifest_job::MAVEN_METADATA => {
            crate::pull_intake::manifest_job::run_metadata(job, dirs)
        }
        #[cfg(feature = "jobs")]
        crate::pull_intake::manifest_job::WHEEL_REQUIRES => {
            crate::pull_intake::manifest_job::run_wheel(job, dirs)
        }
        other => Answer::refused(
            holger_errcode::SANDBOX_CONFIG.code,
            holger_errcode::SANDBOX_CONFIG.tag(format!("this worker has no program {other:?}")),
        ),
    }
}