pub struct Runner { /* private fields */ }
Expand description

Runner for gitlab

The runner is responsible for communicating with gitlab to request new job and spawn them.

Implementations

Create a new Runner for the given server url and runner token, storing (temporary job files) in build_dir

The build_dir is used to store temporary files during a job run. This will also configure a default tracing subscriber if that’s not wanted use Runner::new_with_layer instead.

let dir = tempfile::tempdir().unwrap();
let runner = Runner::new(Url::parse("https://gitlab.com/").unwrap(),
    "RunnerToken".to_string(),
    dir.path().to_path_buf());
Panics

Panics if a default subscriber is already setup

Creates a new runner as per Runner::new and logging layer

The logging layer should attached to the current tracing subscriber while further runner calls are made otherwise job logging to gitlab will not work

let dir = tempfile::tempdir().unwrap();
let (runner, layer) = Runner::new_with_layer(Url::parse("https://gitlab.com/").unwrap(),
    "RunnerToken".to_string(),
    dir.path().to_path_buf());
let subscriber = Registry::default().with(layer).init();

The number of jobs currently running

Try to request a single job from gitlab

This does a single poll of gitlab for a new job. If a new job received a new asynchronous task is spawned for processing the job. The passed process function is called to create a the actual job handler. Returns whether or not a job was received or an error if polling gitlab failed.

Note that this function is not cancel save. If the future gets cancelled gitlab might have provided a job for which processing didn’t start yet.

Wait untill there are less then max jobs running

Wait untill there are no more jobs running

Run continously, processing at most maximum jobs concurrently

This essentially calls Runner::request_job requesting jobs until at most maximum jobs are running in parallel.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more