Struct Pipeline

Source
pub struct Pipeline { /* private fields */ }

Implementations§

Source§

impl Pipeline

Source

pub fn new() -> Pipeline

Source

pub fn inject_all_jobs_with( &mut self, cb: impl for<'a> Fn(PipelineJob<'a>) -> PipelineJob<'a> + 'static, ) -> &mut Self

Inject all pipeline jobs with some common logic. (e.g: to resolve common configuration requirements shared by all jobs).

Can only be invoked once per pipeline.

Source

pub fn ado_set_flowey_bootstrap_template( &mut self, template: String, ) -> &mut Self

(ADO only) Provide a YAML template used to bootstrap flowey at the start of an ADO pipeline.

The template has access to the following vars, which will be statically interpolated into the template’s text:

  • {{FLOWEY_OUTDIR}}
    • Directory to copy artifacts into.
    • NOTE: this var will include \ on Windows, and / on linux!
  • {{FLOWEY_BIN_EXTENSION}}
    • Extension of the expected flowey bin (either “”, or “.exe”)
  • {{FLOWEY_CRATE}}
    • Name of the project-specific flowey crate to be built
  • {{FLOWEY_TARGET}}
    • The target-triple flowey is being built for
  • {{FLOWEY_PIPELINE_PATH}}
    • Repo-root relative path to the pipeline (as provided when generating the pipeline via the flowey CLI)

The template’s sole responsibility is to copy 3 files into the {{FLOWEY_OUTDIR}}:

  1. The bootstrapped flowey binary, with the file name flowey{{FLOWEY_BIN_EXTENSION}}
  2. Two files called pipeline.yaml and pipeline.json, which are copied of the pipeline YAML and pipeline JSON currently being run. {{FLOWEY_PIPELINE_PATH}} is provided as a way to disambiguate in cases where the same template is being for multiple pipelines (e.g: a debug vs. release pipeline).
Source

pub fn ado_post_process_yaml( &mut self, cb: impl FnOnce(Value) -> Value + 'static, ) -> &mut Self

(ADO only) Provide a callback function which will be used to post-process any YAML flowey generates for the pipeline.

Until flowey defines a stable API for maintaining out-of-tree backends, this method can be used to integrate the output from the generic ADO backend with any organization-specific templates that one may be required to use (e.g: for compliance reasons).

Source

pub fn ado_add_schedule_trigger( &mut self, triggers: AdoScheduleTriggers, ) -> &mut Self

(ADO only) Add a new scheduled CI trigger. Can be called multiple times to set up multiple schedules runs.

Source

pub fn ado_set_pr_triggers(&mut self, triggers: AdoPrTriggers) -> &mut Self

(ADO only) Set a PR trigger. Calling this method multiple times will overwrite any previously set triggers.

Source

pub fn ado_set_ci_triggers(&mut self, triggers: AdoCiTriggers) -> &mut Self

(ADO only) Set a CI trigger. Calling this method multiple times will overwrite any previously set triggers.

Source

pub fn ado_add_resources_repository( &mut self, repo: AdoResourcesRepository, ) -> AdoResourcesRepositoryId

(ADO only) Declare a new repository resource, returning a type-safe handle which downstream ADO steps are able to consume via AdoStepServices::resolve_repository_id.

Source

pub fn gh_set_name(&mut self, name: impl AsRef<str>) -> &mut Self

Source

pub fn gh_set_flowey_bootstrap_template( &mut self, template: String, ) -> &mut Self

Provide a YAML template used to bootstrap flowey at the start of an GitHub pipeline.

The template has access to the following vars, which will be statically interpolated into the template’s text:

  • {{FLOWEY_OUTDIR}}
    • Directory to copy artifacts into.
    • NOTE: this var will include \ on Windows, and / on linux!
  • {{FLOWEY_BIN_EXTENSION}}
    • Extension of the expected flowey bin (either “”, or “.exe”)
  • {{FLOWEY_CRATE}}
    • Name of the project-specific flowey crate to be built
  • {{FLOWEY_TARGET}}
    • The target-triple flowey is being built for
  • {{FLOWEY_PIPELINE_PATH}}
    • Repo-root relative path to the pipeline (as provided when generating the pipeline via the flowey CLI)

The template’s sole responsibility is to copy 3 files into the {{FLOWEY_OUTDIR}}:

  1. The bootstrapped flowey binary, with the file name flowey{{FLOWEY_BIN_EXTENSION}}
  2. Two files called pipeline.yaml and pipeline.json, which are copied of the pipeline YAML and pipeline JSON currently being run. {{FLOWEY_PIPELINE_PATH}} is provided as a way to disambiguate in cases where the same template is being for multiple pipelines (e.g: a debug vs. release pipeline).
Source

pub fn gh_add_schedule_trigger( &mut self, triggers: GhScheduleTriggers, ) -> &mut Self

(GitHub Actions only) Add a new scheduled CI trigger. Can be called multiple times to set up multiple schedules runs.

Source

pub fn gh_set_pr_triggers(&mut self, triggers: GhPrTriggers) -> &mut Self

(GitHub Actions only) Set a PR trigger. Calling this method multiple times will overwrite any previously set triggers.

Source

pub fn gh_set_ci_triggers(&mut self, triggers: GhCiTriggers) -> &mut Self

(GitHub Actions only) Set a CI trigger. Calling this method multiple times will overwrite any previously set triggers.

Source

pub fn gh_use_secret(&mut self, secret_name: impl AsRef<str>) -> GhUserSecretVar

(GitHub Actions only) Use a pre-defined GitHub Actions secret variable.

For more information on defining secrets for use in GitHub Actions, see https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions

Source

pub fn new_job( &mut self, platform: FlowPlatform, arch: FlowArch, label: impl AsRef<str>, ) -> PipelineJob<'_>

Source

pub fn non_artifact_dep( &mut self, job: &PipelineJobHandle, depends_on_job: &PipelineJobHandle, ) -> &mut Self

Declare a dependency between two jobs that does is not a result of an artifact.

Source

pub fn new_artifact( &mut self, name: impl AsRef<str>, ) -> (PublishArtifact, UseArtifact)

Source

pub fn ado_add_name(&mut self, name: String) -> &mut Self

Source

pub fn ado_new_named_variable( &mut self, name: impl AsRef<str>, value: impl AsRef<str>, ) -> AdoRuntimeVar

(ADO only) Declare a pipeline-level, named, read-only ADO variable.

name and value are both arbitrary strings.

Returns an instance of AdoRuntimeVar, which, if need be, can be converted into a ReadVar<String> using NodeCtx::get_ado_variable.

NOTE: Unless required by some particular third-party task, it’s strongly recommended to avoid using this method, and to simply use ReadVar::from_static to get a obtain a static variable.

Source

pub fn ado_new_named_variables<K, V>( &mut self, vars: impl IntoIterator<Item = (K, V)>, ) -> &mut Self
where K: AsRef<str>, V: AsRef<str>,

(ADO only) Declare multiple pipeline-level, named, read-only ADO variables at once.

This is a convenience method to streamline invoking Self::ado_new_named_variable multiple times.

NOTE: Unless required by some particular third-party task, it’s strongly recommended to avoid using this method, and to simply use ReadVar::from_static to get a obtain a static variable.

DEVNOTE: In the future, this API may be updated to return a handle that will allow resolving the resulting AdoRuntimeVar, but for implementation expediency, this API does not currently do this. If you need to read the value of this variable at runtime, you may need to invoke AdoRuntimeVar::dangerous_from_global manually.

Source

pub fn new_parameter_bool( &mut self, name: impl AsRef<str>, description: impl AsRef<str>, kind: ParameterKind, default: Option<bool>, ) -> UseParameter<bool>

Declare a pipeline-level runtime parameter with type bool.

To obtain a ReadVar<bool> that can be used within a node, use the PipelineJobCtx::use_parameter method.

name is the name of the parameter.

description is an arbitrary string, which will be be shown to users.

kind is the type of parameter and if it should be treated as a stable external API to callers of the pipeline.

default is the default value for the parameter. If none is provided, the parameter must be specified in order for the pipeline to run.

possible_values can be used to limit the set of valid values the parameter accepts.

Source

pub fn new_parameter_num( &mut self, name: impl AsRef<str>, description: impl AsRef<str>, kind: ParameterKind, default: Option<i64>, possible_values: Option<Vec<i64>>, ) -> UseParameter<i64>

Declare a pipeline-level runtime parameter with type i64.

To obtain a ReadVar<i64> that can be used within a node, use the PipelineJobCtx::use_parameter method.

name is the name of the parameter.

description is an arbitrary string, which will be be shown to users.

kind is the type of parameter and if it should be treated as a stable external API to callers of the pipeline.

default is the default value for the parameter. If none is provided, the parameter must be specified in order for the pipeline to run.

possible_values can be used to limit the set of valid values the parameter accepts.

Source

pub fn new_parameter_string( &mut self, name: impl AsRef<str>, description: impl AsRef<str>, kind: ParameterKind, default: Option<impl AsRef<str>>, possible_values: Option<Vec<String>>, ) -> UseParameter<String>

Declare a pipeline-level runtime parameter with type String.

To obtain a ReadVar<String> that can be used within a node, use the PipelineJobCtx::use_parameter method.

name is the name of the parameter.

description is an arbitrary string, which will be be shown to users.

kind is the type of parameter and if it should be treated as a stable external API to callers of the pipeline.

default is the default value for the parameter. If none is provided, the parameter must be specified in order for the pipeline to run.

possible_values allows restricting inputs to a set of possible values. Depending on the backend, these options may be presented as a set of radio buttons, a dropdown menu, or something in that vein. If None, then any string is allowed.

Trait Implementations§

Source§

impl Default for Pipeline

Source§

fn default() -> Pipeline

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.