File tree 5 files changed +24
-13
lines changed
5 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ pub mod test {
99
99
id : 456 ,
100
100
name : "name" . to_string ( ) ,
101
101
web_url : "web_url" . to_string ( ) ,
102
- default_branch : "default_branch" . to_string ( ) ,
102
+ default_branch : Some ( "default_branch" . to_string ( ) ) ,
103
103
topics : vec ! [ "topic" . to_string( ) ] ,
104
104
}
105
105
}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ pub struct Project {
7
7
pub id : u64 ,
8
8
pub name : String ,
9
9
pub web_url : String ,
10
- pub default_branch : String ,
10
+ pub default_branch : Option < String > ,
11
11
pub topics : Vec < String > ,
12
12
}
13
13
Original file line number Diff line number Diff line change @@ -44,10 +44,14 @@ impl PipelineAggregator {
44
44
projects : Vec < Project > ,
45
45
) -> Result < Vec < ProjectPipeline > , ApiError > {
46
46
try_collect_with_buffer ( projects, |project| async move {
47
- let pipeline = self
48
- . pipeline_service
49
- . get_latest_pipeline ( project. id , project. default_branch . clone ( ) )
50
- . await ?;
47
+ let pipeline = if let Some ( default_branch) = project. clone ( ) . default_branch {
48
+ self . pipeline_service
49
+ . get_latest_pipeline ( project. id , default_branch)
50
+ . await ?
51
+ } else {
52
+ None
53
+ } ;
54
+
51
55
Ok ( ProjectPipeline {
52
56
group_id,
53
57
project,
@@ -75,10 +79,13 @@ impl PipelineAggregator {
75
79
projects : Vec < Project > ,
76
80
) -> Result < Vec < ProjectPipelines > , ApiError > {
77
81
try_collect_with_buffer ( projects, |project| async move {
78
- let pipelines = self
79
- . pipeline_service
80
- . get_pipelines ( project. id , None )
81
- . await ?;
82
+ let pipelines = if project. default_branch . is_some ( ) {
83
+ self . pipeline_service
84
+ . get_pipelines ( project. id , None )
85
+ . await ?
86
+ } else {
87
+ Vec :: default ( )
88
+ } ;
82
89
Ok ( ProjectPipelines {
83
90
group_id,
84
91
project,
Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ impl PipelineAggregator {
49
49
projects : Vec < Project > ,
50
50
) -> Result < Vec < ScheduleProjectPipeline > , ApiError > {
51
51
let result = try_collect_with_buffer ( projects, |project| async move {
52
- let schedules = self . schedule_service . get_schedules ( project. id ) . await ?;
52
+ let schedules = if project. default_branch . is_some ( ) {
53
+ self . schedule_service . get_schedules ( project. id ) . await ?
54
+ } else {
55
+ Vec :: default ( )
56
+ } ;
53
57
let result = self
54
58
. with_latest_pipeline ( group_id, & project, schedules)
55
59
. await ?;
Original file line number Diff line number Diff line change 1
- const target = 'https://gitlab-ci-dashboard.larscom.nl'
2
- // const target = 'http://localhost:8080'
1
+ // const target = 'https://gitlab-ci-dashboard.larscom.nl'
2
+ const target = 'http://localhost:8080'
3
3
4
4
module . exports = {
5
5
'/api/**' : {
You can’t perform that action at this time.
0 commit comments