pub enum RunsOn {
Single(String),
Many(Vec<String>),
Grouped {
group: Option<String>,
labels: RunsOnLabels,
},
}Expand description
A queued job’s runs-on, in each documented form.
GitHub’s “List jobs for a workflow run” response gives a job’s labels as a
flat array, so in practice c4 will build RunsOn::Many. The string and
map forms are supported because they are what a workflow file contains and
what b1’s Definition of Done enumerates.
Variants§
Single(String)
runs-on: ubuntu-latest
Many(Vec<String>)
runs-on: [self-hosted, linux]
Grouped
runs-on: {group: g, labels: [a, b]}
Implementations§
Source§impl RunsOn
impl RunsOn
Sourcepub fn from_job_labels(
labels: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn from_job_labels( labels: impl IntoIterator<Item = impl Into<String>>, ) -> Self
The array form, which is what the jobs API returns.
Sourcepub fn runner_group(&self) -> Option<&str>
pub fn runner_group(&self) -> Option<&str>
The runner group the map form named, if any.
Sourcepub fn required_labels(&self) -> Result<Vec<Label>, UnresolvableRunsOn>
pub fn required_labels(&self) -> Result<Vec<Label>, UnresolvableRunsOn>
The normalised labels this job requires.
Whitespace-only array elements are dropped, not rejected. A
runs-on: ["self-hosted", "", "linux"] is a workflow that GitHub itself
accepts, and the empty element carries no routing meaning, so treating it
as an UnresolvableRunsOn::InvalidLabel would report a job as
unresolvable — and so exclude it from demand and surface it to an
operator — over a stray comma in someone’s YAML. The elements that
remain are what the job actually requires. If every element is
whitespace the array resolves to nothing at all, and that is
reported, as UnresolvableRunsOn::NoLabels or
UnresolvableRunsOn::RunnerGroupWithoutLabels.
§Errors
Every reason the value cannot be turned into a label set — each of which the caller reports rather than treating as “no demand”.