pub struct Pipeline { /* private fields */ }
Implementations§
Source§impl Pipeline
impl Pipeline
pub fn new() -> Pipeline
Sourcepub fn inject_all_jobs_with(
&mut self,
cb: impl for<'a> Fn(PipelineJob<'a>) -> PipelineJob<'a> + 'static,
) -> &mut Self
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.
Sourcepub fn ado_set_flowey_bootstrap_template(
&mut self,
template: String,
) -> &mut Self
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}}
:
- The bootstrapped flowey binary, with the file name
flowey{{FLOWEY_BIN_EXTENSION}}
- Two files called
pipeline.yaml
andpipeline.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).
Sourcepub fn ado_post_process_yaml(
&mut self,
cb: impl FnOnce(Value) -> Value + 'static,
) -> &mut Self
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).
Sourcepub fn ado_add_schedule_trigger(
&mut self,
triggers: AdoScheduleTriggers,
) -> &mut Self
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.
Sourcepub fn ado_set_pr_triggers(&mut self, triggers: AdoPrTriggers) -> &mut Self
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.
Sourcepub fn ado_set_ci_triggers(&mut self, triggers: AdoCiTriggers) -> &mut Self
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.
Sourcepub fn ado_add_resources_repository(
&mut self,
repo: AdoResourcesRepository,
) -> AdoResourcesRepositoryId
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
.
Sourcepub fn gh_set_name(&mut self, name: impl AsRef<str>) -> &mut Self
pub fn gh_set_name(&mut self, name: impl AsRef<str>) -> &mut Self
(GitHub Actions only) Set the pipeline-level name.
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#name
Sourcepub fn gh_set_flowey_bootstrap_template(
&mut self,
template: String,
) -> &mut Self
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}}
:
- The bootstrapped flowey binary, with the file name
flowey{{FLOWEY_BIN_EXTENSION}}
- Two files called
pipeline.yaml
andpipeline.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).
Sourcepub fn gh_add_schedule_trigger(
&mut self,
triggers: GhScheduleTriggers,
) -> &mut Self
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.
Sourcepub fn gh_set_pr_triggers(&mut self, triggers: GhPrTriggers) -> &mut Self
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.
Sourcepub fn gh_set_ci_triggers(&mut self, triggers: GhCiTriggers) -> &mut Self
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.
Sourcepub fn gh_use_secret(&mut self, secret_name: impl AsRef<str>) -> GhUserSecretVar
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
pub fn new_job( &mut self, platform: FlowPlatform, arch: FlowArch, label: impl AsRef<str>, ) -> PipelineJob<'_>
Sourcepub fn non_artifact_dep(
&mut self,
job: &PipelineJobHandle,
depends_on_job: &PipelineJobHandle,
) -> &mut Self
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.
pub fn new_artifact( &mut self, name: impl AsRef<str>, ) -> (PublishArtifact, UseArtifact)
Sourcepub fn ado_add_name(&mut self, name: String) -> &mut Self
pub fn ado_add_name(&mut self, name: String) -> &mut Self
(ADO only) Set the pipeline-level name.
Sourcepub fn ado_new_named_variable(
&mut self,
name: impl AsRef<str>,
value: impl AsRef<str>,
) -> AdoRuntimeVar
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.
Sourcepub fn ado_new_named_variables<K, V>(
&mut self,
vars: impl IntoIterator<Item = (K, V)>,
) -> &mut Self
pub fn ado_new_named_variables<K, V>( &mut self, vars: impl IntoIterator<Item = (K, V)>, ) -> &mut Self
(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.
Sourcepub fn new_parameter_bool(
&mut self,
name: impl AsRef<str>,
description: impl AsRef<str>,
kind: ParameterKind,
default: Option<bool>,
) -> UseParameter<bool>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.