pub struct CreatePipelineBuilder<'a> { /* private fields */ }Expand description
Builder for creating/triggering a new pipeline.
§Examples
use lmrc_gitlab::GitLabClient;
use std::collections::HashMap;
let client = GitLabClient::new("https://gitlab.com", "token")?;
// Trigger pipeline with variables
let mut vars = HashMap::new();
vars.insert("DEPLOY_ENV".to_string(), "staging".to_string());
let pipeline = client.project("myorg/myproject")
.create_pipeline()
.ref_name("main")
.variables(vars)
.trigger()
.await?;
println!("Created pipeline #{}", pipeline.id);Implementations§
Source§impl<'a> CreatePipelineBuilder<'a>
impl<'a> CreatePipelineBuilder<'a>
Sourcepub fn ref_name(self, ref_name: impl Into<String>) -> Self
pub fn ref_name(self, ref_name: impl Into<String>) -> Self
Set the git reference (branch or tag) to run the pipeline on.
§Examples
let pipeline = client.project("myorg/myproject")
.create_pipeline()
.ref_name("develop")
.trigger()
.await?;Sourcepub fn variables(self, variables: HashMap<String, String>) -> Self
pub fn variables(self, variables: HashMap<String, String>) -> Self
Set CI/CD variables for the pipeline.
§Examples
let mut vars = HashMap::new();
vars.insert("DEPLOY_TARGET".to_string(), "production".to_string());
let pipeline = client.project("myorg/myproject")
.create_pipeline()
.ref_name("main")
.variables(vars)
.trigger()
.await?;Sourcepub fn variable(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn variable(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single CI/CD variable for the pipeline.
§Examples
let pipeline = client.project("myorg/myproject")
.create_pipeline()
.ref_name("main")
.variable("ENVIRONMENT", "staging")
.variable("DEBUG", "true")
.trigger()
.await?;Sourcepub async fn trigger(self) -> Result<Pipeline>
pub async fn trigger(self) -> Result<Pipeline>
Trigger the pipeline.
§Errors
Returns GitLabError::InvalidInput if ref_name is not set.
Returns an error if the pipeline cannot be created.
§Examples
let pipeline = client.project("myorg/myproject")
.create_pipeline()
.ref_name("main")
.trigger()
.await?;Auto Trait Implementations§
impl<'a> Freeze for CreatePipelineBuilder<'a>
impl<'a> !RefUnwindSafe for CreatePipelineBuilder<'a>
impl<'a> Send for CreatePipelineBuilder<'a>
impl<'a> Sync for CreatePipelineBuilder<'a>
impl<'a> Unpin for CreatePipelineBuilder<'a>
impl<'a> !UnwindSafe for CreatePipelineBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more