1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use failure::Error;
use client::{self, Jenkins, Path};
use helpers::Class;
use super::{Job, ShortJob};
use action::CommonAction;
use build::ShortBuild;
use property::CommonProperty;
use queue::ShortQueueItem;
use scm::CommonSCM;
use super::{BallColor, HealthReport, JobBuilder};
job_build_with_common_fields_and_impl!(
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct MavenModuleSet {
pub description: String,
pub concurrent_build: bool,
pub scm: CommonSCM,
pub modules: Vec<ShortJob>,
pub upstream_projects: Vec<ShortJob>,
pub downstream_projects: Vec<ShortJob>,
pub label_expression: Option<String>,
});
register_class!("hudson.maven.MavenModuleSet" => MavenModuleSet);
impl MavenModuleSet {
pub fn build(&self, jenkins_client: &Jenkins) -> Result<ShortQueueItem, Error> {
self.builder(jenkins_client)?.send()
}
pub fn builder<'a, 'b, 'c, 'd>(
&'a self,
jenkins_client: &'b Jenkins,
) -> Result<JobBuilder<'a, 'b, 'c, 'd>, Error> {
JobBuilder::new(self, jenkins_client)
}
pub fn poll_scm(&self, jenkins_client: &Jenkins) -> Result<(), Error> {
let path = jenkins_client.url_to_path(&self.url());
if let Path::Job {
name,
configuration: None,
} = path
{
jenkins_client.post(&Path::PollSCMJob { name })?;
Ok(())
} else {
Err(client::Error::InvalidUrl {
url: self.url().to_string(),
expected: client::error::ExpectedType::Job,
}.into())
}
}
}
job_build_with_common_fields_and_impl!(
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct MavenModule {
pub description: Option<String>,
pub concurrent_build: bool,
pub scm: CommonSCM,
pub upstream_projects: Vec<ShortJob>,
pub downstream_projects: Vec<ShortJob>,
pub label_expression: Option<String>,
});
register_class!("hudson.maven.MavenModule" => MavenModule);
impl MavenModule {}