• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 17951223221

23 Sep 2025 03:32PM UTC coverage: 75.688% (+2.3%) from 73.342%
17951223221

Pull #233

github

web-flow
Merge d4c950f2b into dd8ffa1f6
Pull Request #233: V2.0.0 : Refactoring importers

2367 of 2678 new or added lines in 33 files covered. (88.39%)

51 existing lines in 6 files now uncovered.

20812 of 27497 relevant lines covered (75.69%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.97
/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st
1
Class {
2
        #name : #GitlabModelImporter,
3
        #superclass : #GitModelImporter,
4
        #instVars : [
5
                'withInitialCommits',
6
                'withInitialMergeRequest'
7
        ],
8
        #category : #'GitLabHealth-Model-Importer'
9
}
10

11
{ #category : #private }
12
GitlabModelImporter >> addCommits: commitsList toRepository: aProjectRepository [
×
13
        "I take a list of GLHCommit. But some might have been parsed but are already on the model..."
×
14

×
15
        "I return the list of added commits"
×
16

×
17
        | existingCommits newlyFoundCommit |
×
18
        existingCommits := aProjectRepository mooseModel allWithType:
×
19
                                   GLHCommit.
×
20
        newlyFoundCommit := commitsList reject: [ :commitParsed |
×
21
                                    existingCommits anySatisfy: [ :existingCommit |
×
22
                                            existingCommit id = commitParsed id ] ].
×
23
        aProjectRepository mooseModel addAll: newlyFoundCommit.
×
24
        aProjectRepository commits addAll: newlyFoundCommit.
×
25
        ^ newlyFoundCommit
×
26
]
×
27

28
{ #category : #private }
29
GitlabModelImporter >> addGroupResultToModel: groupResult [
1✔
30
        |group|
1✔
31
        group := self glhModel add: groupResult unless: self blockOnIdEquality.
1✔
32
        self glhModel
1✔
33
                addAll: group projects
1✔
34
                unless: self blockOnIdEquality.
1✔
35
        ^ group 
1✔
36
]
1✔
37

38
{ #category : #'import - pipelines' }
39
GitlabModelImporter >> allPipelinesOf: aProjectID [
×
40

×
41
        | result |
×
42
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
43
        result := self repoApi pipelines getAllInProject: aProjectID.
×
44
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
×
45

×
46
        ^ (result collect: [ :pipelinesJson |
×
47
                           self parsePipelinesResult: pipelinesJson ]) flattened
×
48
]
×
49

50
{ #category : #'import - commits' }
UNCOV
51
GitlabModelImporter >> commitsOfProject: aGLHProject forRefName: refName until: toDate [
×
52

×
53
        | params results allCommits |
×
54
        
×
55
        params := { 
×
56
                #ref_name -> refName.
×
57
                #until -> (toDate ifNotNil: [ toDate asDateAndTime asString ] ifNil: [ '' ]) 
×
58
        } asDictionary.
×
59
        results := self repoApi commits getAllInProject: aGLHProject id withParams: params.
×
60
        allCommits := (results collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
×
61
        
×
62
        self glhModel addAll: allCommits unless: self blockOnIdEquality.
×
63
        aGLHProject repository commits addAll: allCommits unless: self blockOnIdEquality.
×
64

×
65
        self withCommitDiffs ifTrue: [
×
66
                aGLHProject repository commits do: [ :commit |
×
67
                        self importDiffOfCommit: commit ] ].
×
68
        
×
69
        ^allCommits
×
70
]
×
71

72
{ #category : #'import - projects' }
73
GitlabModelImporter >> completeImportProject: aGLHProject [
×
74

×
75
        | importedProject |
×
76
        ('Complete import of project: ' , aGLHProject id printString)
×
77
                recordInfo.
×
78
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
×
79

×
80
        importedProject := self glhModel
×
81
                                   add: aGLHProject
×
82
                                   unless: self blockOnIdEquality.
×
83

×
84
        self importLatestPipelinesOfProject: importedProject.
×
85

×
86
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
×
87

×
88
        (self importUser: importedProject creator_id) addCreatedProject:
×
89
                importedProject.
×
90

×
91

×
92
        importedProject repository: GLHRepository new.
×
93
        self glhModel add: importedProject repository.
×
NEW
94
        self completeImportsOfRepository: importedProject repository.
×
95

×
96

×
97
        withInitialMergeRequest ifTrue: [
×
98
                self
×
NEW
99
                        importMergeRequestsOfProject: importedProject
×
100
                        since: DateAndTime today
×
101
                        until: DateAndTime now ].
×
102

×
103
        ^ importedProject
×
104
        
×
105

×
106
]
×
107

108
{ #category : #'import - commits' }
109
GitlabModelImporter >> completeImportedCommit: aCommit [
1✔
110

1✔
111
        ('completing commit: ' , aCommit short_id printString) recordInfo.
1✔
112
        self importCreatorOfCommit: aCommit.
1✔
113

1✔
114
        self withCommitDiffs ifTrue: [
1✔
115
                | diffs |
1✔
116
                aCommit diffs ifEmpty: [
1✔
117
                        diffs := self importDiffOfCommit: aCommit.
1✔
118
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
1✔
119

1✔
120
        ^ aCommit
1✔
121
]
1✔
122

123
{ #category : #'import - jobs' }
124
GitlabModelImporter >> completeImportedJob: aGLHJob [
1✔
125
        
1✔
126
        aGLHJob commit ifNil: [ 
1✔
127
                |commit|
1✔
128
                commit := self
1✔
129
                          importCommit:
1✔
130
                          (aGLHJob cacheAt: #commitID ifAbsent: [ '' ])
1✔
131
                          ofProject: aGLHJob pipeline project.
1✔
132
                aGLHJob commit: commit. ].
1✔
133
        
1✔
134
        aGLHJob user ifNil: [ 
1✔
135
                |user|
1✔
136
                user := self importUser: (aGLHJob cacheAt: #userID ifAbsent: [ '' ]).
1✔
137
        aGLHJob user: user.
1✔
138
                 ]. 
1✔
139
        
1✔
140
        
1✔
141
        ^ aGLHJob
1✔
142
]
1✔
143

144
{ #category : #'import - pipelines' }
145
GitlabModelImporter >> completeImportedPipeline: aGLHPipeline [ 
1✔
146
        |result parsedResult|
1✔
147
        
1✔
148
        aGLHPipeline duration ifNotNil: [ ^ aGLHPipeline ].
1✔
149
        
1✔
150
        result := self repoApi pipelines get: aGLHPipeline id inProject: aGLHPipeline project id. 
1✔
151
        parsedResult := self parsePipelineResult: result. 
1✔
152
        
1✔
153
        "aGLHPipeline methods".
1✔
154
        { #'created_at:' . #'status:' . #'finished_at:' . #'duration:' . #'started_at:' . #'updated_at:' . #'ref:' } do: [ :m |
1✔
155
                aGLHPipeline perform: m asSymbol with: (parsedResult perform: (m withoutSuffix: ':') asSymbol )
1✔
156
                 ].
1✔
157
        
1✔
158
        parsedResult cacheAt: #userID ifPresent: [:id |
1✔
159
                aGLHPipeline user: (self importUser: id). 
1✔
160
                ].
1✔
161
        
1✔
162
        ^ aGLHPipeline. 
1✔
163
]
1✔
164

165
{ #category : #'import - pipelines' }
166
GitlabModelImporter >> completeImportedPipelines: aCollectionOfGLHPipeline [
×
167
        ^ aCollectionOfGLHPipeline collect: [ :pipeline | self completeImportedPipeline: pipeline ].  
×
168
]
×
169

170
{ #category : #'import - projects' }
171
GitlabModelImporter >> completeImportedProject: aGLHProject [
1✔
172

1✔
173
        | importedProject |
1✔
174
        ('Complete import of project: ' , aGLHProject id printString)
1✔
175
                recordInfo.
1✔
176
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
1✔
177

1✔
178
        importedProject := self glhModel
1✔
179
                                   add: aGLHProject
1✔
180
                                   unless: self blockOnIdEquality.
1✔
181

1✔
182
        self importLatestPipelinesOfProject: importedProject.
1✔
183

1✔
184
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
1✔
185

1✔
186
        (self importUser: importedProject creator_id) addCreatedProject:
1✔
187
                importedProject.
1✔
188

1✔
189
        
1✔
190
        importedProject repository: GLHRepository new.
1✔
191
        self glhModel add: importedProject repository.
1✔
192
        self completeImportsOfRepository: importedProject repository.
1✔
193
        
1✔
194

1✔
195
        withInitialMergeRequest ifTrue: [
1✔
196
                self
1✔
197
                        importMergeRequestsOfProject: importedProject
1✔
198
                        since: DateAndTime today
1✔
199
                        until: DateAndTime now ].
1✔
200

1✔
201
        ^ importedProject
1✔
202
        
1✔
203

1✔
204
]
1✔
205

206
{ #category : #'import - repositories' }
207
GitlabModelImporter >> completeImportsOfRepository: aGLHRepository [
1✔
208

1✔
209
        | branches |
1✔
210
        [
1✔
211
        ('import the repository of project ' , aGLHRepository project name)
1✔
212
                recordInfo.
1✔
213
        branches := self importBranchesOf: aGLHRepository project.
1✔
214
        self withFiles ifTrue: [
1✔
215
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
216
                on: NeoJSONParseError
1✔
217
                do: [
1✔
218
                self inform: aGLHRepository project name , ' has no repository' ].
1✔
219

1✔
220
        withInitialCommits ifTrue: [
1✔
221
                aGLHRepository branches do: [ :branch |
1✔
222
                        self importCommitsOfBranch: branch ] ].
1✔
223
        
1✔
224
        ^ aGLHRepository 
1✔
225
]
1✔
226

227
{ #category : #'private - configure reader' }
228
GitlabModelImporter >> configureReaderForBranch: reader [
1✔
229

1✔
230
        super configureReaderForBranch: reader.
1✔
231
        
1✔
232
                reader for: GLHBranch do: [ :mapping |
1✔
233
                mapping
1✔
234
                        mapProperty: #commit
1✔
235
                        getter: [  ]
1✔
236
                        setter: [ :branch :rawCommit | branch sha: (rawCommit at: #id) ] ].
1✔
237
]
1✔
238

239
{ #category : #'private - configure reader' }
240
GitlabModelImporter >> configureReaderForCommit: reader [
1✔
241

1✔
242
        super configureReaderForCommit: reader.
1✔
243

1✔
244
        reader for: GLHCommit do: [ :mapping |
1✔
245

1✔
246
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
247
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
248
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
249
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
250
                mapping
1✔
251
                        mapProperty: 'stats'
1✔
252
                        getter: [ :el | "Not used" ]
1✔
253
                        setter: [ :commit :value |
1✔
254
                                commit deletions: (value at: #deletions).
1✔
255
                                commit additions: (value at: #additions) ] ].
1✔
256

1✔
257
        reader
1✔
258
                for: #ArrayOfIds
1✔
259
                customDo: [ :mapping | mapping decoder: [ :string | string ] ]
1✔
260
]
1✔
261

262
{ #category : #'private - configure reader' }
263
GitlabModelImporter >> configureReaderForDiff: reader [
1✔
264

1✔
265
        super configureReaderForDiff: reader.
1✔
266
        reader
1✔
267
                for: GLHDiff
1✔
268
                do: [ :mapping | 
1✔
269
                        "mapping mapInstVars:
1✔
270
                        #( deleted_file new_file new_path old_path renamed_file )."
1✔
271
                        mapping mapInstVar: #diffString to: #diff ].
1✔
272

1✔
273
        ^ reader
1✔
274
]
1✔
275

276
{ #category : #'private - configure reader' }
277
GitlabModelImporter >> configureReaderForGroup: reader [
1✔
278

1✔
279
        super configureReaderForGroup: reader.
1✔
280

1✔
281
        reader for: GLHGroup do: [ :mapping |
1✔
282
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProject ]
1✔
283
]
1✔
284

285
{ #category : #'private - configure reader' }
286
GitlabModelImporter >> configureReaderForJob: reader [
1✔
287

1✔
288
        super configureReaderForJob: reader.
1✔
289

1✔
290
        reader
1✔
291
                for: GLHJob
1✔
292
                do: [ :mapping | "(mapping mapInstVar: #user) valueSchema: GLHUser.
1✔
293
                (mapping mapInstVar: #pipeline) valueSchema: GLHPipeline."
1✔
294
                        mapping
1✔
295
                                mapProperty: #user
1✔
296
                                getter: [  ]
1✔
297
                                setter: [ :job :rawUser |
1✔
298
                                job cacheAt: #userID put: (rawUser at: #id) ].
1✔
299

1✔
300
                        mapping
1✔
301
                                mapProperty: #pipeline
1✔
302
                                getter: [  ]
1✔
303
                                setter: [ :job :rawPipeline |
1✔
304
                                        job cacheAt: #pipelineID put: (rawPipeline at: #id) ].
1✔
305
                                
1✔
306
                        mapping
1✔
307
                                mapProperty: #commit
1✔
308
                                getter: [  ]
1✔
309
                                setter: [ :job :rawCommit |
1✔
310
                                        job cacheAt: #commitID put: (rawCommit at: #id) ].
1✔
311

1✔
312
                        "mapping
1✔
313
                        mapProperty: #user
1✔
314
                        getter: [ :object | #ignore ]
1✔
315
                        setter: [ :object :value |
1✔
316
                        object user: (self importUser: (value at: #id)) ]."
1✔
317

1✔
318
                        mapping
1✔
319
                                mapProperty: #duration
1✔
320
                                getter: [ :object | #ignore ]
1✔
321
                                setter: [ :object :value |
1✔
322
                                value ifNotNil: [ object duration: value seconds ] ] ]
1✔
323
]
1✔
324

325
{ #category : #'private - configure reader' }
326
GitlabModelImporter >> configureReaderForMergeRequest: reader [
1✔
327
        "declare quil y a un array a mapper"
1✔
328
        self flag: 'assignee.s must be parsed with nil condition'.
1✔
329
        super configureReaderForMergeRequest: reader.
1✔
330

1✔
331
        "declare la liste des properties"
1✔
332
        reader
1✔
333
                for: GLHMergeRequest
1✔
334
                do: [ :mapping | 
1✔
335
                         
1✔
336
                        "(mapping mapInstVar: #assignee) valueSchema: GLHUser."
1✔
337
                        "(mapping mapInstVar: #assignees) valueSchema: #ArrayOfUser."
1✔
338
                        (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
339
                        (mapping mapInstVar: #updated_at) valueSchema: DateAndTime.
1✔
340
                        (mapping mapInstVar: #merged_at) valueSchema: DateAndTime.
1✔
341
                        (mapping mapInstVar: #closed_at) valueSchema: DateAndTime.
1✔
342

1✔
343
                        mapping
1✔
344
                                mapProperty: #author
1✔
345
                                getter: [  ]
1✔
346
                                setter: [ :object :value |
1✔
347
                                object cacheAt: #authorID put: (value at: #id) ].
1✔
348
                        mapping
1✔
349
                                mapProperty: #merge_user
1✔
350
                                getter: [  ]
1✔
351
                                setter: [ :object :value |
1✔
352
                                        value ifNotNil: [
1✔
353
                                                object cacheAt: #mergeUserID put: (value at: #id) ] ] ]
1✔
354
]
1✔
355

356
{ #category : #'private - parsing' }
357
GitlabModelImporter >> configureReaderForNote: reader [
1✔
358

1✔
359
        super configureReaderForNote: reader.
1✔
360

1✔
361
        reader for: GLHNote do: [ :mapping |
1✔
362
                
1✔
363
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
364
                (mapping mapInstVar: #updated_at) valueSchema: DateAndTime ]
1✔
365
]
1✔
366

367
{ #category : #'private - configure reader' }
368
GitlabModelImporter >> configureReaderForPipeline: reader [
1✔
369

1✔
370
        super configureReaderForPipeline: reader.
1✔
371

1✔
372
        reader for: GLHPipeline do: [ :mapping |
1✔
373
                mapping
1✔
374
                        mapProperty: #created_at
1✔
375
                        getter: [ :object | #ignore ]
1✔
376
                        setter: [ :object :value |
1✔
377
                                object created_at:
1✔
378
                                        (value ifNotNil: [ DateAndTime fromString: value ]).
1✔
379
                                object runDate:
1✔
380
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
381

1✔
382
                mapping
1✔
383
                        mapProperty: #updated_at
1✔
384
                        getter: [ :object | #ignore ]
1✔
385
                        setter: [ :object :value |
1✔
386
                                object updated_at:
1✔
387
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
388

1✔
389
                mapping
1✔
390
                        mapProperty: #finished_at
1✔
391
                        getter: [ :object | #ignore ]
1✔
392
                        setter: [ :object :value |
1✔
393
                                object finished_at:
1✔
394
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
395

1✔
396
                mapping
1✔
397
                        mapProperty: #started_at
1✔
398
                        getter: [ :object | #ignore ]
1✔
399
                        setter: [ :object :value |
1✔
400
                                object started_at:
1✔
401
                                        (value ifNotNil: [ DateAndTime fromString: value ]) ].
1✔
402

1✔
403
                mapping
1✔
404
                        mapProperty: #source
1✔
405
                        getter: [ :object | #ignore ]
1✔
406
                        setter: [ :object :value | object sourceEvent: value ].
1✔
407

1✔
408
                mapping
1✔
409
                        mapProperty: #duration
1✔
410
                        getter: [ :object | #ignore ]
1✔
411
                        setter: [ :object :value |
1✔
412
                                object duration: (value ifNotNil: [ value asDuration ]) ].
1✔
413

1✔
414
                mapping
1✔
415
                        mapProperty: #user
1✔
416
                        getter: [ :object | #ignore ]
1✔
417
                        setter: [ :object :value |
1✔
418
                                value ifNotNil: [ object cacheAt: #userID put: (value at: #id) ] ] ].
1✔
419

1✔
420
]
1✔
421

422
{ #category : #'private - configure reader' }
423
GitlabModelImporter >> configureReaderForProject: reader [
1✔
424

1✔
425
        super configureReaderForProject: reader.
1✔
426
        
1✔
427
        reader for: GLHProject do: [ :mapping |
1✔
428
                mapping mapInstVar: #web_url to: #html_url.
1✔
429
                ].
1✔
430
]
1✔
431

432
{ #category : #'private - configure reader' }
433
GitlabModelImporter >> configureReaderForRelease: reader [
1✔
434

1✔
435
        super configureReaderForRelease: reader.
1✔
436

1✔
437

1✔
438
        reader
1✔
439
                for: GLHRelease
1✔
440
                do: [ :mapping | (mapping mapInstVar: #author) valueSchema: GLHUser ].
1✔
441

1✔
442
]
1✔
443

444
{ #category : #'private - configure reader' }
445
GitlabModelImporter >> configureReaderForTag: reader [
1✔
446

1✔
447
        reader mapInstVarsFor: GLHTag .
1✔
448
        
1✔
449
        reader for: GLHTag do: [ :mapping |
1✔
450
                
1✔
451
                (mapping mapInstVar: #commit) valueSchema: GLHCommit .
1✔
452
"                (mapping mapInstVar: #release) valueSchema: GLHRelease ."
1✔
453
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime .
1✔
454
                
1✔
455
                mapping
1✔
456
                        mapProperty: #release
1✔
457
                        getter: [ :object | #ignore ]
1✔
458
                        setter: [ :object :value |
1✔
459
                        object release: (value ifNotNil: [ GLHRelease new description: (value at:#description); tag_name: (value at: #tag_name); yourself ]).
1✔
460
                        ].
1✔
461
                 ].
1✔
462
        
1✔
463
        reader
1✔
464
                for: #ArrayOfTags
1✔
465
                customDo: [ :customMappting |
1✔
466
                customMappting listOfElementSchema: GLHTag ].
1✔
467
]
1✔
468

1✔
469
{ #category : #'private - configure reader' }
1✔
470
GitlabModelImporter >> configureReaderForUser: reader [
1✔
471

1✔
472
        super configureReaderForUser: reader
1✔
473
        
1✔
474
]
1✔
475

1✔
476
{ #category : #private }
1✔
477
GitlabModelImporter >> convertApiFileAsFile: aAPIFile [
1✔
478

1✔
479
        aAPIFile type = 'tree' ifTrue: [ 
1✔
480
                ^ GLHFileDirectory new
1✔
481
                          name: aAPIFile name;
1✔
482
                          yourself ].
1✔
483
        ^ GLHFileBlob new
1✔
484
                  name: aAPIFile name;
1✔
485
                  yourself
1✔
486
]
1✔
487

1✔
488
{ #category : #private }
1✔
489
GitlabModelImporter >> detectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
490

1✔
491
        ^ (self glhModel allWithType: aType) detect: [ :entity |
1✔
492
                  (entity perform: aSelector) = value ] ifNone: [ nil ]. 
1✔
493
]
1✔
494

1✔
495
{ #category : #accessing }
1✔
496
GitlabModelImporter >> glhApi [
1✔
497

1✔
498
        self
1✔
499
                deprecated: 'Use #repoApi instead'
1✔
500
                on: '7 October 2024'
1✔
501
                in:
1✔
502
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
503

1✔
504
        ^ repoApi
1✔
505
]
1✔
506

1✔
507
{ #category : #accessing }
1✔
508
GitlabModelImporter >> glhApi: anObject [
1✔
509

1✔
510
        self
1✔
511
                deprecated: 'Use #repoApi: instead'
1✔
512
                on: '7 October 2024'
1✔
513
                in:
1✔
514
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
515

1✔
516
        repoApi := anObject
1✔
517
]
1✔
518

1✔
519
{ #category : #accessing }
1✔
520
GitlabModelImporter >> glhModel [
1✔
521

1✔
522
        ^ glhModel
1✔
523
]
1✔
524

1✔
525
{ #category : #accessing }
1✔
526
GitlabModelImporter >> glhModel: anObject [
1✔
527

1✔
528
        glhModel := anObject
1✔
529
]
1✔
530

1✔
531
{ #category : #'import - users' }
1✔
532
GitlabModelImporter >> importActiveHumanUsers [
1✔
533

1✔
534
        | params result users |
1✔
535
        params := { 
1✔
536
                #humans -> 'true'.
1✔
537
                #active -> 'true'.
1✔
538
                #without_project_bots -> 'true'
1✔
539
        } asDictionary.
1✔
540
        result := self repoApi users allWithParams: params.
1✔
541
        users := (result collect: [ :usersJson | self parseUsersResult: usersJson ]) flattened.
1✔
542
        
1✔
543
        self glhModel
1✔
544
                                 addAll: users
1✔
545
                                 unless: self blockOnIdEquality.
1✔
546

1✔
547
        ^ users
1✔
548
]
1✔
549

1✔
550
{ #category : #'import - groups' }
1✔
551
GitlabModelImporter >> importAllGroups [
1✔
552

1✔
553
        | params results groups |
1✔
554
        
1✔
555
        params := { 
1✔
556
                        #top_level_only -> 'true'
1✔
557
        } asDictionary.
1✔
558
        results := self repoApi groups getAllWithParams: params.
1✔
559
        
1✔
560
        groups := (results collect: [ :groupsJson | generalReader
1✔
561
                                            on: groupsJson readStream;
1✔
562
                                            nextAs: #ArrayOfGroups. ]) flattened.
1✔
563
        ^ groups
1✔
564
]
1✔
565

1✔
566
{ #category : #'import - pipelines' }
1✔
567
GitlabModelImporter >> importAllPipelinesOfProject: aGLHProject [
1✔
568
        
1✔
569
        (self allPipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
570
                | pip |
1✔
571
                pip := self glhModel add: pipeline unless: self blockOnIdEquality.
1✔
572
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
573
                self completeImportedPipeline: pip ].
1✔
574

1✔
575
        ^ aGLHProject pipelines
1✔
576
]
1✔
577

1✔
578
{ #category : #'import - commits' }
1✔
579
GitlabModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
1✔
580

1✔
581
        | commits completedProject |
1✔
582
        completedProject := self completeImportedProject: aGLHProject.
1✔
583
        commits := self importLatestCommitsOfProject: completedProject.
1✔
584
        commits do: [ :commit | self completeImportedCommit: commit ].
1✔
585
        self chainsCommitsFrom: commits.
1✔
586
        ^ commits
1✔
587
]
1✔
588

1✔
589
{ #category : #'import - users' }
1✔
590
GitlabModelImporter >> importAuthorOfCommit: aGLHCommit [
1✔
591

1✔
592
        | user |
1✔
593
                self
1✔
594
                deprecated: 'Use importCreatorOfCommit: instead of current one'
1✔
595
                on: '19 September 2025'
1✔
596
                in:
1✔
597
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
598

1✔
599
        
1✔
600
        user := self importUserByUsername: aGLHCommit author_name.
1✔
601
        aGLHCommit commitCreator: user.
1✔
602
        ^ user
1✔
603
]
1✔
604

1✔
605
{ #category : #'import - branches' }
1✔
606
GitlabModelImporter >> importBranchesOf: aGLHProject [
1✔
607

1✔
608
        | resultBranches branches foundBranches |
1✔
609
        "aGLHProject repository branches removeAll "
1✔
610
        resultBranches := self repoApi branches getAllFromProject:
1✔
611
                                  aGLHProject id.
1✔
612

1✔
613
        foundBranches := (resultBranches collect: [ :branchesJson |
1✔
614
                                  self
1✔
615
                                          parseBranchesResult: branchesJson
1✔
616
                                           ]) flattened.
1✔
617

1✔
618
        'import the branches of project ' recordInfo.
1✔
619

1✔
620
        "WARNING: always add branch first into repository, than into model !"
1✔
621
        branches := aGLHProject repository branches
1✔
622
                            addAll: foundBranches
1✔
623
                            unless: self blockOnNameEquality.
1✔
624

1✔
625

1✔
626
        branches := self glhModel
1✔
627
                            addAll: branches
1✔
628
                            unless: self blockForBranchEquality.
1✔
629

1✔
630
        "WARNING : branch must load its HEAD commit (ref) in a second time "
1✔
631
        ^ branches
1✔
632
]
1✔
633

1✔
634
{ #category : #'import - commits' }
1✔
635
GitlabModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
1✔
636

1✔
637
        | result parsedResult |
1✔
638
        (self glhModel allWithType: GLHCommit) asOrderedCollection
1✔
639
                detect: [ :commit | commit id = aCommitID ]
1✔
640
                ifFound: [ :commit | ^ commit ].
1✔
641

1✔
642
        result := self repoApi commits
1✔
643
                          get: aCommitID
1✔
644
                          inProject: aGLHProject id.
1✔
645

1✔
646
        parsedResult := self parseCommitResult: result.
1✔
647

1✔
648
        parsedResult := self glhModel
1✔
649
                                add: parsedResult
1✔
650
                                unless: self blockOnIdEquality.
1✔
651
        parsedResult := aGLHProject repository commits
1✔
652
                                add: parsedResult
1✔
653
                                unless: self blockOnIdEquality.
1✔
654

1✔
655
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: parsedResult ].
1✔
656

1✔
657
        ^ parsedResult
1✔
658
]
1✔
659

1✔
660
{ #category : #'import - commits' }
1✔
661
GitlabModelImporter >> importCommitOfProject: anProject withId: anID [
1✔
662

1✔
663
        | commit result |
1✔
664
self
1✔
665
                deprecated: 'Use importCommit:ofProject: instead of current one'
1✔
666
                on: '27 August 2025'
1✔
667
                in: 'MSR 1.3.0 '
1✔
668
                transformWith: '`@rcv importCommitOfProject: `arg1 withId: `arg2' -> '`@rcv importCommit: `arg2 ofProject: `arg1'.
1✔
669
        anID ifNil: [ ^ nil ].
1✔
670

1✔
671
        ('looking for commit ' , anID printString , ' in project : '
1✔
672
         , anProject id printString) recordInfo.
1✔
673

1✔
674
        commit := (self
1✔
675
                           detectEntityType: GLHCommit
1✔
676
                           overAttribut: #id
1✔
677
                           equalTo: anID) ifNil: [
1✔
678
                          result := self repoApi commits
1✔
679
                                            get: anID
1✔
680
                                            inProject: anProject id.
1✔
681
                          commit := (self parseCommitsResult: '[' , result , ']')
1✔
682
                                            first.
1✔
683

1✔
684
                          commit := self glhModel
1✔
685
                                            add: commit
1✔
686
                                            unless: self blockOnIdEquality.
1✔
687
                          commit repository: anProject repository.
1✔
688

1✔
689
                          commit ].
1✔
690

1✔
691
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
1✔
692

1✔
693
        ^ commit
1✔
694
]
1✔
695

1✔
696
{ #category : #'import - commits' }
1✔
697
GitlabModelImporter >> importCommits: aGLHProject [
1✔
698
        "limited to the last 20 commits"
1✔
699

1✔
700
        | results parsedResults params |
1✔
701
        self
1✔
702
                deprecated:
1✔
703
                'Use importLatestCommitsOfProject: instead of current one'
1✔
704
                on: '19 September 2025'
1✔
705
                in:
1✔
706
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
707
                
1✔
708
        params := { (#with_stats -> 'true') } asDictionary.
1✔
709
        results := self repoApi commits
1✔
710
                           getByPage: 1
1✔
711
                           perPage: 20
1✔
712
                           inProject: aGLHProject id
1✔
713
                           withParams: params.
1✔
714

1✔
715
        parsedResults := self parseCommitsResult: results.
1✔
716
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
717

1✔
718
        parsedResults do: [ :commit |
1✔
719
                commit repository: aGLHProject repository ].
1✔
720

1✔
721
        self withCommitDiffs ifTrue: [
1✔
722
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
723

1✔
724
        ^ parsedResults
1✔
725
]
1✔
726

1✔
727
{ #category : #'import - commits' }
1✔
728
GitlabModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
1✔
729
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
1✔
730
        Lazy import does not import the entities inside the model"
1✔
731

1✔
732
        | date |
1✔
733
        date := aCommit created_at asDateAndTime.
1✔
734

1✔
735
        ^ self
1✔
736
                  importCommitsOfBranch: aCommit branch
1✔
737
                  since: date
1✔
738
                  until: date + aNumberOfDay day
1✔
739
]
1✔
740

1✔
741
{ #category : #'import - commits' }
1✔
742
GitlabModelImporter >> importCommitsFromTag: fromTag toTag: toTag [ 
1✔
743
        | results commits project|
1✔
744
                
1✔
745
        (fromTag isNil or: [ toTag isNil ] ) ifTrue: [ ^ OrderedCollection new.  ] .
1✔
746

1✔
747
        project := fromTag repository project.
1✔
748
        results := self repoApi repositories compareInProject: (project id) from: fromTag name to: toTag name.
1✔
749
        
1✔
750
        commits := (NeoJSONReader fromString: results ) at: #commits ifAbsent: ['[]'].
1✔
751
        
1✔
752
        
1✔
753
        commits := self parseCommitsResult: (NeoJSONWriter toString: commits).
1✔
754
         commits := glhModel addAll: commits unless: self blockOnIdEquality.
1✔
755
        commits := project repository commits addAll: commits unless: self blockOnIdEquality.
1✔
756
        
1✔
757
        self chainsCommitsFrom: commits. 
1✔
758
        
1✔
759
        ^ commits. 
1✔
760
        
1✔
761
]
1✔
762

1✔
763
{ #category : #'import - commits' }
1✔
764
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch [
1✔
765

1✔
766
        | commits |
1✔
767
        "        result := self glhApi
1✔
768
                          commitsOfProject: aGLHBranch repository project id
1✔
769
                          forRefName: aGLHBranch name."
1✔
770
        commits := self
1✔
771
                           importCommitsOfBranch: aGLHBranch
1✔
772
                           since: withCommitsSince.
1✔
773

1✔
774
        self chainsCommitsFrom: commits.
1✔
775

1✔
776
        commits do: [ :aCommit |
1✔
777
                aCommit repository: aGLHBranch repository.
1✔
778
                self completeImportedCommit: aCommit ].
1✔
779
        ^ commits
1✔
780
]
1✔
781

1✔
782
{ #category : #'import - commits' }
1✔
783
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch fromCommit: anInitialCommit [
1✔
784

1✔
785
        | commits |
1✔
786
        "        result := self glhApi
1✔
787
                          commitsOfProject: aGLHBranch repository project id
1✔
788
                          forRefName: aGLHBranch name."
1✔
789
        commits := self
1✔
790
                           importCommitsOfBranch: aGLHBranch
1✔
791
                           since: anInitialCommit committed_date.
1✔
792

1✔
793
        commits do: [ :aCommit |
1✔
794
                aCommit repository: aGLHBranch repository.
1✔
795
                self completeImportedCommit: aCommit ].
1✔
796
        ^ commits
1✔
797
]
1✔
798

1✔
799
{ #category : #'import - commits' }
1✔
800
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate [
1✔
801

1✔
802
        ^ self importCommitsOfBranch: aGLHBranch since: fromDate until: nil
1✔
803
]
1✔
804

1✔
805
{ #category : #'import - commits' }
1✔
806
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch since: fromDate until: toDate [
1✔
807

1✔
808
        | params result allCommits |
1✔
809
        params := {
1✔
810
                          (#ref_name -> aGLHBranch name).
1✔
811
                          (#since -> (fromDate
1✔
812
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
813
                                    ifNil: [ '' ])).
1✔
814
                          (#until -> (toDate
1✔
815
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
816
                                    ifNil: [ '' ])).
1✔
817
                          (#with_stats -> 'true') } asDictionary.
1✔
818
        result := self repoApi commits
1✔
819
                          getAllInProject: aGLHBranch repository project id
1✔
820
                          withParams: params.
1✔
821

1✔
822
        allCommits := (result collect: [ :commitsJson |
1✔
823
                               self parseCommitsResult: commitsJson ]) flattened.
1✔
824

1✔
825
        aGLHBranch commits addAll: allCommits unless: self blockOnIdEquality.
1✔
826

1✔
827
        self glhModel
1✔
828
                addAll: aGLHBranch commits
1✔
829
                unless: self blockOnIdEquality.
1✔
830

1✔
831
        self chainsCommitsFrom: allCommits.
1✔
832

1✔
833
        ^ allCommits
1✔
834
]
1✔
835

1✔
836
{ #category : #'import - commits' }
1✔
837
GitlabModelImporter >> importCommitsOfBranch: aGLHBranch until: toDate [
1✔
838

1✔
839
        ^ self importCommitsOfBranch: aGLHBranch since: nil until: toDate
1✔
840
]
1✔
841

1✔
842
{ #category : #'import - commits' }
1✔
843
GitlabModelImporter >> importCommitsOfProject: aProject since: fromDate until: toDate [
1✔
844

1✔
845
        | params results allCommits |
1✔
846
        params := {
1✔
847
                          (#since
1✔
848
                           ->
1✔
849
                           (fromDate
1✔
850
                                    ifNotNil: [ fromDate asDate asDateAndTime asString ]
1✔
851
                                    ifNil: [ '' ])).
1✔
852
                          (#until
1✔
853
                           ->
1✔
854
                           (toDate
1✔
855
                                    ifNotNil: [ toDate asDate asDateAndTime asString ]
1✔
856
                                    ifNil: [ '' ])).
1✔
857
                          (#with_stats -> 'true').
1✔
858
                          (#all -> 'true') } asDictionary.
1✔
859
        results := self repoApi commits
1✔
860
                           getAllInProject: aProject id
1✔
861
                           withParams: params.
1✔
862

1✔
863
        allCommits := (results collect: [ :commitsJson |
1✔
864
                               self parseCommitsResult: commitsJson ]) flattened.
1✔
865

1✔
866
        allCommits:= aProject repository commits
1✔
867
                addAll: allCommits
1✔
868
                unless: self blockOnIdEquality.
1✔
869

1✔
870
        ^ self glhModel addAll: allCommits unless: self blockOnIdEquality
1✔
871
]
1✔
872

1✔
873
{ #category : #'import - commits' }
1✔
874
GitlabModelImporter >> importCommitsOfTag: aGLHTag [
1✔
875

1✔
876
        | taggedCommit tags commits date |
1✔
877
        self
1✔
878
                deprecated: 'Use importCommitsFromTag:toTag: instead of current one'
1✔
879
                on: '21 July 2025'
1✔
880
                in:
1✔
881
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
882
        
1✔
883
        
1✔
884
        tags := self importTagsForProject: aGLHTag repository project.
1✔
885

1✔
886

1✔
887
        taggedCommit := aGLHTag commit ifNil: [
1✔
888
                                self
1✔
889
                                        importCommit: aGLHTag target
1✔
890
                                        ofProject: aGLHTag repository project ].
1✔
891

1✔
892
        date := (tags isEmptyOrNil and: [ tags size < 2 ])
1✔
893
                        ifTrue: [ aGLHTag created_at ]
1✔
894
                        ifFalse: [ tags second commit committed_date ].
1✔
895

1✔
896
        commits := self
1✔
897
                           importParentCommitsOfCommit: taggedCommit
1✔
898
                           since: tags third created_at.
1✔
899
        commits add: taggedCommit.
1✔
900
        self chainsCommitsFrom: commits.
1✔
901

1✔
902
        ^ commits
1✔
903
]
1✔
904

1✔
905
{ #category : #'import - projects' }
1✔
906
GitlabModelImporter >> importContributedProjectsOfUser: aGLHUser [
1✔
907

1✔
908
        | remaningProjects params results projects projectsIds |
1✔
909
        params := {
1✔
910
                          (#order_by -> 'last_activity_at').
1✔
911
                          (#simple -> 'true') } asDictionary.
1✔
912
        results := self repoApi projects
1✔
913
                           contributedProjectsOfUser: aGLHUser id
1✔
914
                           withParams: params.
1✔
915

1✔
916
        projectsIds := (results collect: [ :projectsJson |
1✔
917
                             (NeoJSONReader fromString: projectsJson) collect: [:projectJson | projectJson at: #id ] ]) flattened.
1✔
918
        
1✔
919
        projects := self importProjects: projectsIds.
1✔
920
        remaningProjects := self importProjects:
1✔
921
                                    ((projects collect: #id) difference:
1✔
922
                                             ((self userCatalogue atId: aGLHUser id) at:
1✔
923
                                                      #contributedProjects)).
1✔
924

1✔
925

1✔
926
        aGLHUser contributedProjects
1✔
927
                addAll: projects , remaningProjects
1✔
928
                unless: self blockOnIdEquality.
1✔
929

1✔
930
        self userCatalogue
1✔
931
                addUser: aGLHUser
1✔
932
                withProjects: (aGLHUser contributedProjects collect: #id).
1✔
933

1✔
934
        ^ projects
1✔
935
]
1✔
936

1✔
937
{ #category : #'import - users' }
1✔
938
GitlabModelImporter >> importCreatorOfCommit: aCommit [
1✔
939

1✔
940
        aCommit commitCreator ifNil: [
1✔
941
                aCommit commitCreator:
1✔
942
                        (self importUserByUsername: aCommit author_name) ].
1✔
943
        self userCatalogue
1✔
944
                addUser: aCommit commitCreator
1✔
945
                withProject: aCommit repository project id.
1✔
946
        ^ aCommit commitCreator
1✔
947
]
1✔
948

1✔
949
{ #category : #'import - commits' }
1✔
950
GitlabModelImporter >> importDiffOfCommit: aCommit [
1✔
951

1✔
952
        | result diffsResult |
1✔
953
        aCommit diffs ifNotEmpty: [
1✔
954
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
955
                ^ aCommit diffs ].
1✔
956
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
957

1✔
958
        result := self repoApi commits
1✔
959
                          diffOf: aCommit id
1✔
960
                          inProject: aCommit repository project id
1✔
961
                          uniDiff: true.
1✔
962

1✔
963
        (self isServerError: result) ifTrue: [ ^ {  } ].
1✔
964
        diffsResult := self newParseDiffResult: result.
1✔
965

1✔
966
        aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
967
        
1✔
968
        "changes are added into the model during the import"
1✔
969
        aCommit diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
970

1✔
971
        ^ aCommit diffs
1✔
972
]
1✔
973

1✔
974
{ #category : #'import - merge-requests' }
1✔
975
GitlabModelImporter >> importDiffOfMergeRequest: aMergeRequest [
1✔
976

1✔
977
        | result diffsResult |
1✔
978
        aMergeRequest diffs ifNotEmpty: [
1✔
979
                'Diff of already importer: '
1✔
980
                , aMergeRequest iid printString recordInfo.
1✔
981
                ^ aMergeRequest diffs ].
1✔
982
        ('Import diff commits of MR ' , aMergeRequest iid printString)
1✔
983
                recordInfo.
1✔
984
        result := self repoApi mergeRequests
1✔
985
                          diffsOf: aMergeRequest iid
1✔
986
                          inProject: aMergeRequest project_id.
1✔
987
        diffsResult := result flatCollect: [ :aResult |
1✔
988
                               self newParseDiffResult: aResult ].
1✔
989

1✔
990

1✔
991
        aMergeRequest diffs
1✔
992
                addAll: diffsResult
1✔
993
                unless: self blockForDiffEquality.
1✔
994
        self glhModel
1✔
995
                addAll: aMergeRequest diffs
1✔
996
                unless: self blockForDiffEquality.
1✔
997

1✔
998
        aMergeRequest diffs do: [ :diff | self importDiffRangesForDiff: diff ].
1✔
999

1✔
1000
        ^ aMergeRequest diffs
1✔
1001
]
1✔
1002

1✔
1003
{ #category : #'import - repositories' }
1✔
1004
GitlabModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
1✔
1005

1✔
1006
        | result files apiFiles params |
1✔
1007
        params := { 
1✔
1008
                #ref -> aBranch name.
1✔
1009
                #path -> (aDirectoryFile path , '/')
1✔
1010
        } asDictionary.
1✔
1011
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
1012
                         " treeOfRepository: aBranch repository project id
1✔
1013
                          ofBranch: aBranch name
1✔
1014
                          andPath: aDirectoryFile path , '/'."
1✔
1015
        apiFiles := (result collect: [ :treeJson | self parseFileTreeResult: treeJson ]) flattened.
1✔
1016
        files := apiFiles collect: [ :apiFile |
1✔
1017
                         self convertApiFileAsFile: apiFile ].
1✔
1018
        
1✔
1019
        files do: [ :file |
1✔
1020
                self glhModel add: file.
1✔
1021
                aDirectoryFile addFile: file ].
1✔
1022
        
1✔
1023
        files
1✔
1024
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
1025
                thenCollect: [ :file |
1✔
1026
                self importDirectoryFiles: file OfBranch: aBranch ]
1✔
1027
]
1✔
1028

1✔
1029
{ #category : #'import - file' }
1✔
1030
GitlabModelImporter >> importFileWithPath: aPath ofProject: aGLHProject inBranch: aBranch [ 
1✔
1031
        self flag: 'imported file need need to be store inside the model'.
1✔
1032
        ^ self repoApi repositories getRawFile: aPath ofProject: aGLHProject id withParams: {#ref -> aBranch name} asDictionary .
1✔
1033
]
1✔
1034

1✔
1035
{ #category : #'import - repositories' }
1✔
1036
GitlabModelImporter >> importFilesOfBranch: aBranch [
1✔
1037

1✔
1038
        | result files apiFiles params |
1✔
1039
        params := { 
1✔
1040
                #ref -> aBranch name.
1✔
1041
        } asDictionary.
1✔
1042
        
1✔
1043
        result := self repoApi repositories repositoryTreeOfProject: aBranch repository project id withParams: params.
1✔
1044
        
1✔
1045
                          "treeOfRepository: aBranch repository project id
1✔
1046
                          ofBranch: aBranch name
1✔
1047
                          andPath: nil."
1✔
1048
        apiFiles := (result collect: [ :filesJson | self parseFileTreeResult: filesJson  ]) flattened.
1✔
1049
        files := apiFiles collect: [ :apiFile | 
1✔
1050
                         self convertApiFileAsFile: apiFile ].
1✔
1051
        files do: [ :file | 
1✔
1052
                self glhModel add: file.
1✔
1053
                aBranch addFile: file ].
1✔
1054
        files
1✔
1055
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
1056
                thenCollect: [ :file | 
1✔
1057
                self importDirectoryFiles: file OfBranch: aBranch ].
1✔
1058
        
1✔
1059
   ^files. 
1✔
1060
]
1✔
1061

1✔
1062
{ #category : #'import - groups' }
1✔
1063
GitlabModelImporter >> importGroup: aGroupID [
1✔
1064

1✔
1065
        | result groupResult |
1✔
1066
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
1067

1✔
1068
        result := self repoApi groups get: aGroupID.
1✔
1069
        
1✔
1070
        "group: aGroupID."
1✔
1071
        groupResult := self parseGroupResult: result.
1✔
1072
        groupResult := self addGroupResultToModel: groupResult.
1✔
1073

1✔
1074
        groupResult projects do: [ :project |
1✔
1075
                self completeImportedProject: project ].
1✔
1076

1✔
1077
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
1078
                
1✔
1079
                groupResult subGroups
1✔
1080
                        add: (self importGroup: subGroup id)
1✔
1081
                        unless: self blockOnIdEquality ].
1✔
1082
        ^ groupResult
1✔
1083
]
1✔
1084

1✔
1085
{ #category : #'import - jobs' }
1✔
1086
GitlabModelImporter >> importJobsOf: aPipeline [
1✔
1087

1✔
1088
        | jobs results |
1✔
1089
        results := self repoApi jobs
1✔
1090
                           getAllForPipeline: aPipeline id
1✔
1091
                           inProject: aPipeline project id.
1✔
1092
        "jobsOfProject: aPipeline project id
1✔
1093
                          ofPipelines: aPipeline id."
1✔
1094
        jobs := (results collect: [ :jobsJson |
1✔
1095
                         self parseJobsResult: jobsJson ]) flattened.
1✔
1096

1✔
1097

1✔
1098
        jobs := self glhModel addAll: jobs unless: self blockOnIdEquality.
1✔
1099
        jobs := aPipeline jobs addAll: jobs unless: self blockOnIdEquality.
1✔
1100

1✔
1101

1✔
1102
        jobs do: [ :job |
1✔
1103
                self completeImportedJob: job ].
1✔
1104

1✔
1105
        ^ jobs
1✔
1106
]
1✔
1107

1✔
1108
{ #category : #'import - commits' }
1✔
1109
GitlabModelImporter >> importLatestCommitsOfProject: aGLHProject [
1✔
1110
        "limited to the last 50 commits"
1✔
1111

1✔
1112
        | results parsedResults params |
1✔
1113
        params := { 
1✔
1114
                #with_stats -> 'true'.
1✔
1115
                #all -> true
1✔
1116
         } asDictionary.
1✔
1117
        results := self repoApi commits getByPage: 1 perPage: 50 inProject: aGLHProject id withParams: params.
1✔
1118

1✔
1119
        parsedResults := self parseCommitsResult: results.
1✔
1120
        parsedResults := self glhModel
1✔
1121
                                 addAll: parsedResults
1✔
1122
                                 unless: self blockOnIdEquality.
1✔
1123

1✔
1124
        aGLHProject repository commits
1✔
1125
                addAll: parsedResults
1✔
1126
                unless: self blockOnIdEquality.
1✔
1127

1✔
1128
        self withCommitDiffs ifTrue: [
1✔
1129
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
1130

1✔
1131
        ^ parsedResults
1✔
1132
]
1✔
1133

1✔
1134
{ #category : #'import - merge-requests' }
1✔
1135
GitlabModelImporter >> importLatestMergeRequestsOfProject: aGLHProject [ 
1✔
1136
        
1✔
1137
        |results parsedResults|
1✔
1138
        results := self repoApi mergeRequests getByPage: 1 perPage: 20  inProject: aGLHProject id. 
1✔
1139
        parsedResults := self parseMergeRequestsResult: results. 
1✔
1140
        
1✔
1141
        parsedResults := glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
1142
        parsedResults := aGLHProject mergeRequests addAll: parsedResults unless: self blockOnIdEquality.
1✔
1143
        ^ parsedResults.
1✔
1144
]
1✔
1145

1✔
1146
{ #category : #'import - pipelines' }
1✔
1147
GitlabModelImporter >> importLatestPipelinesOfProject: aGLHProject [ 
1✔
1148
        (self pipelinesOf: aGLHProject id withLimit:20) do: [ :pipeline |
1✔
1149
                |pip|
1✔
1150
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1151
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1152
                self completeImportedPipeline: pip. 
1✔
1153
                ].
1✔
1154
        
1✔
1155
        ^ aGLHProject pipelines 
1✔
1156
]
1✔
1157

1✔
1158
{ #category : #'import - releases' }
1✔
1159
GitlabModelImporter >> importLatestReleaseOfProject: aGLHProject [ 
1✔
1160
        
1✔
1161
        |result foundRelease|
1✔
1162
        result := repoApi releases getLatestOfProject: aGLHProject id.
1✔
1163
        foundRelease := self parseReleaseResult: result. 
1✔
1164

1✔
1165
        foundRelease := glhModel add: foundRelease unless: self blockOnNameEquality.
1✔
1166
        foundRelease := aGLHProject releases add: foundRelease unless: self blockOnNameEquality.
1✔
1167

1✔
1168
        foundRelease author: (self importUser: foundRelease author id). 
1✔
1169
        
1✔
1170
        ^ foundRelease.
1✔
1171
]
1✔
1172

1✔
1173
{ #category : #'import - commits' }
1✔
1174
GitlabModelImporter >> importMergeRequestCommits: aGLPHEMergeRequest [
1✔
1175

1✔
1176
        | commits result |
1✔
1177
        aGLPHEMergeRequest commits ifNotNil: [ ^ aGLPHEMergeRequest commits ].
1✔
1178
        
1✔
1179
        result := self repoApi mergeRequests commitsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1180
        
1✔
1181
        commits := (result collect: [ :commitsJson | self parseCommitsResult: commitsJson ]) flattened.
1✔
1182
        commits := commits collect: [ :commit | self importCommit: commit id ofProject: aGLPHEMergeRequest project ].
1✔
1183
        aGLPHEMergeRequest commits: commits.
1✔
1184

1✔
1185

1✔
1186
        ^ commits
1✔
1187
]
1✔
1188

1✔
1189
{ #category : #'import - commits' }
1✔
1190
GitlabModelImporter >> importMergeRequestMergeCommits: aGLPHEMergeRequest [
1✔
1191

1✔
1192
        | foundCommits |
1✔
1193
        foundCommits := OrderedCollection new.
1✔
1194

1✔
1195
        ('Import commit sha of MR:  ' , aGLPHEMergeRequest iid printString)
1✔
1196
                recordInfo.
1✔
1197
        "the founds commits are added to the model during their respective import"
1✔
1198
        aGLPHEMergeRequest mergeRequestCommit: ((self
1✔
1199
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1200
                          withId: aGLPHEMergeRequest sha) ifNotNil: [ :commit |
1✔
1201
                         foundCommits add: commit ]).
1✔
1202

1✔
1203
        ('Import commit merge_commit_sha of MR:  '
1✔
1204
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1205
        aGLPHEMergeRequest mergedCommit: ((self
1✔
1206
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1207
                          withId: aGLPHEMergeRequest merge_commit_sha) ifNotNil: [ :commit |
1✔
1208
                         foundCommits add: commit ]).
1✔
1209

1✔
1210
        ('Import commit squash_commit_sha of MR:  '
1✔
1211
         , aGLPHEMergeRequest iid printString) recordInfo.
1✔
1212
        aGLPHEMergeRequest squashCommit: ((self
1✔
1213
                          importCommitOfProject: aGLPHEMergeRequest project
1✔
1214
                          withId: aGLPHEMergeRequest squash_commit_sha) ifNotNil: [ :commit |
1✔
1215
                         foundCommits add: commit ]).
1✔
1216

1✔
1217

1✔
1218
        self chainsCommitsFrom: foundCommits.
1✔
1219
        ^ foundCommits
1✔
1220
]
1✔
1221

1✔
1222
{ #category : #'import - pipelines' }
1✔
1223
GitlabModelImporter >> importMergeRequestPipelines: aGLHMergeRequest [
1✔
1224
        "default limit to one page with last 100 pipelines"
1✔
1225

1✔
1226
        | results parseResults |
1✔
1227
        self
1✔
1228
                deprecated:
1✔
1229
                'Use importPipelinesOfMergeRequest: instead of current one'
1✔
1230
                on: '23 September 2025'
1✔
1231
                in:
1✔
1232
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
1233

1✔
1234
        ^ self importPipelinesOfMergeRequest: aGLHMergeRequest. 
1✔
1235
]
1✔
1236

1✔
1237
{ #category : #'import - merge-requests' }
1✔
1238
GitlabModelImporter >> importMergeRequestsOfProject: aGLHProject [
1✔
1239

1✔
1240
        | results parsedResults mrs |
1✔
1241
        ('Import merge request of Project: ' , aGLHProject id printString)
1✔
1242
                recordInfo.
1✔
1243

1✔
1244
        results := self repoApi mergeRequests getAllOfProject: aGLHProject id.
1✔
1245
        parsedResults := (results collect: [ :projectsJson | self parseMergeRequestsResult: projectsJson ]) flattened. 
1✔
1246

1✔
1247
        aGLHProject mergeRequests
1✔
1248
                addAll: parsedResults
1✔
1249
                unless: self blockOnIdEquality.
1✔
1250

1✔
1251
        mrs := self glhModel
1✔
1252
                       addAll: aGLHProject mergeRequests
1✔
1253
                       unless: self blockOnIdEquality.
1✔
1254

1✔
1255

1✔
1256
        "gets it related commits"
1✔
1257
        aGLHProject mergeRequests do: [ :mr |
1✔
1258
                self importMergeRequestMergeCommits: mr ].
1✔
1259

1✔
1260

1✔
1261
        self withCommitDiffs ifTrue: [
1✔
1262
                aGLHProject mergeRequests do: [ :mr |
1✔
1263
                        self importDiffOfMergeRequest: mr ] ].
1✔
1264

1✔
1265
        ^ mrs
1✔
1266
]
1✔
1267

1✔
1268
{ #category : #'import - merge-requests' }
1✔
1269
GitlabModelImporter >> importMergeRequestsOfProject: aGLHProject since: fromDate until: toDate [
1✔
1270

1✔
1271
        | params result mergeRequests |
1✔
1272
        ('import MR of Project ' , aGLHProject name) recordInfo.
1✔
1273
        params := {
1✔
1274
                          (#created_after
1✔
1275
                           ->
1✔
1276
                           (fromDate
1✔
1277
                                    ifNotNil: [ fromDate asDateAndTime asString ]
1✔
1278
                                    ifNil: [ '' ])).
1✔
1279
                          (#created_before
1✔
1280
                           ->
1✔
1281
                           (toDate
1✔
1282
                                    ifNotNil: [ toDate asDateAndTime asString ]
1✔
1283
                                    ifNil: [ '' ])).
1✔
1284
                          (#scope -> 'all') } asDictionary.
1✔
1285

1✔
1286
        result := self repoApi mergeRequests
1✔
1287
                          getAllOfProject: aGLHProject id
1✔
1288
                          withParams: params.
1✔
1289
        mergeRequests := (result collect: [ :mergeRequestsJson |
1✔
1290
                                  self parseMergeRequestsResult: mergeRequestsJson ])
1✔
1291
                                 flattened.
1✔
1292

1✔
1293
        aGLHProject mergeRequests
1✔
1294
                addAll: mergeRequests
1✔
1295
                unless: self blockOnIdEquality.
1✔
1296

1✔
1297
        "gets it related commits"
1✔
1298
        aGLHProject mergeRequests do: [ :mr |
1✔
1299
                self importMergeRequestMergeCommits: mr ].
1✔
1300

1✔
1301
        self withCommitDiffs ifTrue: [
1✔
1302
                aGLHProject mergeRequests do: [ :mr |
1✔
1303
                        self importDiffOfMergeRequest: mr ] ].
1✔
1304

1✔
1305
        self glhModel
1✔
1306
                addAll: mergeRequests
1✔
1307
                unless: (self blockEqualityOn: #iid).
1✔
1308

1✔
1309
        ^ mergeRequests
1✔
1310
]
1✔
1311

1✔
1312
{ #category : #'import - merge-requests' }
1✔
1313
GitlabModelImporter >> importMergeResquestApprovals: aGLPHEMergeRequest [
1✔
1314

1✔
1315
        | results parsedResult |
1✔
1316
        (String streamContents: [ :str |
1✔
1317
                 str << 'Check approvals of '.
1✔
1318
                 aGLPHEMergeRequest printOn: str ]) recordInfo.
1✔
1319
        results := self repoApi mergeRequests approvalsOf: aGLPHEMergeRequest iid inProject: aGLPHEMergeRequest project id.
1✔
1320

1✔
1321
        parsedResult := generalReader
1✔
1322
                                on: results readStream;
1✔
1323
                                next.
1✔
1324

1✔
1325
        (parsedResult at: #approved_by) do: [ :approvedUser |
1✔
1326
                aGLPHEMergeRequest addApproved_by:
1✔
1327
                        (self importUser: ((approvedUser at: #user) at: #id)) ].
1✔
1328
        aGLPHEMergeRequest approved: (parsedResult at: #approved).
1✔
1329
        ^ aGLPHEMergeRequest
1✔
1330
]
1✔
1331

1✔
1332
{ #category : #'import - merge-requests' }
1✔
1333
GitlabModelImporter >> importMergeResquestAuthor: aGLPHEMergeRequest [
1✔
1334

1✔
1335
        | authorID |
1✔
1336
        aGLPHEMergeRequest author ifNotNil: [ ^ aGLPHEMergeRequest author ].
1✔
1337
        authorID := aGLPHEMergeRequest cacheAt: #authorID ifAbsent: [
1✔
1338
                            | result |
1✔
1339
                            result := self repoApi mergeRequests
1✔
1340
                                              get: aGLPHEMergeRequest iid
1✔
1341
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1342

1✔
1343
                            (generalReader
1✔
1344
                                     on: result readStream;
1✔
1345
                                     next) at: #author at: #id ].
1✔
1346
        ^aGLPHEMergeRequest author: (self importUser: authorID)
1✔
1347
]
1✔
1348

1✔
1349
{ #category : #'import - merge-requests' }
1✔
1350
GitlabModelImporter >> importMergeResquestMerger: aGLPHEMergeRequest [
1✔
1351

1✔
1352
        | authorID |
1✔
1353
        aGLPHEMergeRequest merge_user ifNotNil: [
1✔
1354
                ^ aGLPHEMergeRequest merge_user ].
1✔
1355
        authorID := aGLPHEMergeRequest cacheAt: #mergeUserID ifAbsent: [
1✔
1356
                            | result |
1✔
1357
                            result := self repoApi mergeRequests
1✔
1358
                                              get: aGLPHEMergeRequest iid
1✔
1359
                                              inProject: aGLPHEMergeRequest project_id.
1✔
1360
                            (generalReader
1✔
1361
                                     on: result readStream;
1✔
1362
                                     next)
1✔
1363
                                    at: #merge_user
1✔
1364
                                    ifPresent: [ :mergeUser |
1✔
1365
                                    mergeUser ifNotNil: [ :mruser | mruser at: #id ] ] ].
1✔
1366
        ^aGLPHEMergeRequest merge_user: (self importUser: authorID)
1✔
1367
]
1✔
1368

1✔
1369
{ #category : #'import - notes' }
1✔
1370
GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [
1✔
1371
        | results notes |
1✔
1372
        
1✔
1373
        results := self repoApi notes allInMergeRequest: mergeRequest iid ofProject: mergeRequest project id.
1✔
1374
        
1✔
1375
        notes := results collect: [ :note | 
1✔
1376
                self parseNoteJson: note ].
1✔
1377
        "notes := self parseNoteJson: results."
1✔
1378
        notes do: [ :tabNotes | tabNotes do: [ :note |
1✔
1379
                        note author: (self importUser: (note author at: #id)).
1✔
1380
                        note name: note id asString]. ].
1✔
1381
        notes := notes flattened.
1✔
1382
        notes := self glhModel addAll: notes unless: self blockOnIdEquality. 
1✔
1383
        notes := mergeRequest note addAll: notes unless: self blockOnIdEquality. 
1✔
1384
        ^notes
1✔
1385
        
1✔
1386
]
1✔
1387

1✔
1388
{ #category : #'import - commits' }
1✔
1389
GitlabModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
1✔
1390

1✔
1391
        | parentsIds commits |
1✔
1392
        commits := Set new.
1✔
1393
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
1✔
1394
                 
1✔
1395
                ^ commits
1✔
1396
                          add: aGLHCommit;
1✔
1397
                          yourself ].
1✔
1398

1✔
1399
        parentsIds := aGLHCommit parent_ids.
1✔
1400

1✔
1401
        commits addAll: (parentsIds collect: [ :id |
1✔
1402
                         self
1✔
1403
                                 importCommit: id ofProject: aGLHCommit repository project  ]).
1✔
1404

1✔
1405
        
1✔
1406
        commits addAll: (commits collect: [ :parentCommit |
1✔
1407
                   self importParentCommitsOfCommit: parentCommit since: aDate ]).
1✔
1408

1✔
1409
        ^ commits flattened asSet. 
1✔
1410
]
1✔
1411

1✔
1412
{ #category : #'import - pipelines' }
1✔
1413
GitlabModelImporter >> importPipeline: pipelineId OfProject: aGLHProject [
1✔
1414

1✔
1415
        
1✔
1416
        | result pipeline|
1✔
1417
        
1✔
1418
        aGLHProject pipelines detect: [ :pip | pip id = pipelineId ] ifOne: [ :pip| ^pip ].
1✔
1419
        
1✔
1420
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1421
        result := self repoApi pipelines get: pipelineId inProject: aGLHProject id.
1✔
1422
        
1✔
1423
        pipeline :=  self parsePipelineResult: result.
1✔
1424

1✔
1425
        pipeline := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1426
        pipeline := aGLHProject pipelines add: pipeline unless: self blockOnIdEquality.
1✔
1427
        
1✔
1428
        ^ self completeImportedPipeline: pipeline. 
1✔
1429
]
1✔
1430

1✔
1431
{ #category : #'import - pipelines' }
1✔
1432
GitlabModelImporter >> importPipelinesOfMergeRequest: aGLHMergeRequest [
1✔
1433
        "default limit to one page with last 100 pipelines"
1✔
1434

1✔
1435
        | results parseResults |
1✔
1436
        results := self repoApi pipelines
1✔
1437
                           getByPage: 1
1✔
1438
                           perPage: 100
1✔
1439
                           inProject: aGLHMergeRequest project id
1✔
1440
                           forMergerRequestIid: aGLHMergeRequest iid.
1✔
1441

1✔
1442
        parseResults := self parsePipelinesResult: results.
1✔
1443

1✔
1444
        parseResults do: [ :pipeline |
1✔
1445
                pipeline project: aGLHMergeRequest project.
1✔
1446
                ].
1✔
1447

1✔
1448
        parseResults := glhModel
1✔
1449
                                addAll: parseResults
1✔
1450
                                unless: self blockOnIdEquality.
1✔
1451
        parseResults := aGLHMergeRequest pipelines
1✔
1452
                                addAll: parseResults
1✔
1453
                                unless: self blockOnIdEquality.
1✔
1454
                
1✔
1455
                
1✔
1456
        ^ parseResults collect: [ :pip | self completeImportedPipeline: pip ]
1✔
1457
]
1✔
1458

1✔
1459
{ #category : #'import - pipelines' }
1✔
1460
GitlabModelImporter >> importPipelinesOfProject: aGLHProject [
1✔
1461

1✔
1462
        self
1✔
1463
                deprecated:
1✔
1464
                'Use importAllPipelinesOfProject: instead of current one'
1✔
1465
                on: '23 September 2025'
1✔
1466
                in:
1✔
1467
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
1468

1✔
1469
        self flag:
1✔
1470
                'WARNING: this import ALL the pipelines at ones. Prefered ImportLatestPipleinesOfProject: for faster performance (if possible)'.
1✔
1471
        ^ self importAllPipelinesOfProject: aGLHProject
1✔
1472
]
1✔
1473

1✔
1474
{ #category : #'import - pipelines' }
1✔
1475
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before [
1✔
1476
        ^ (self pipelinesOf: aGLHProject id after: after andBefore: before) collect: [ :pipeline |
1✔
1477
                |pip|
1✔
1478
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1479
                pip := aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1480
                
1✔
1481
                ].
1✔
1482
        
1✔
1483
]
1✔
1484

1✔
1485
{ #category : #'import - pipelines' }
1✔
1486
GitlabModelImporter >> importPipelinesOfProject: aGLHProject after: after andBefore: before onBranch: aBranch [
1✔
1487
        | result parsedResults|
1✔
1488
        ('Search pipelines of: ' , aGLHProject id printString) recordInfo.
1✔
1489
        
1✔
1490
        result := self repoApi pipelines getAllInProject: aGLHProject id 
1✔
1491
                                                                                                withParams: {        #updated_before -> before.
1✔
1492
                                                                                                                                        #updated_after -> after.
1✔
1493
                                                                                                                                        #ref -> aBranch name} asDictionary .
1✔
1494
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
1495

1✔
1496
        parsedResults := (result collect: [ :pipelinesJson |
1✔
1497
                           self parsePipelinesResult: pipelinesJson ]) flattened.
1✔
1498
        
1✔
1499

1✔
1500
        ^ parsedResults collect: [ :pipeline |
1✔
1501
                |pip|
1✔
1502
                pip := self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
1503
                aGLHProject pipelines add: pip unless: self blockOnIdEquality.
1✔
1504
                ].
1✔
1505
        
1✔
1506
]
1✔
1507

1✔
1508
{ #category : #'import - projects' }
1✔
1509
GitlabModelImporter >> importProject: aProjectID [
1✔
1510

1✔
1511
        | result projectResult |
1✔
1512
        ('Import project with id:  ' , aProjectID printString) recordInfo.
1✔
1513

1✔
1514
        (glhModel allWithType: GLHProject)
1✔
1515
                detect: [ :project | project id = aProjectID ]
1✔
1516
                ifFound: [ :project | ^ project ].
1✔
1517

1✔
1518
        result := self repoApi projects get: aProjectID.
1✔
1519
        projectResult := self parseProjectResult: result.
1✔
1520

1✔
1521
        ^ self completeImportedProject: projectResult
1✔
1522
]
1✔
1523

1✔
1524
{ #category : #'import - projects' }
1✔
1525
GitlabModelImporter >> importProjects [
1✔
1526

1✔
1527
        | result projects |
1✔
1528
        ('import all Projects') recordInfo.
1✔
1529

1✔
1530

1✔
1531
        result := self repoApi projects all.
1✔
1532
        projects := (result collect: [ :projectsJson | self parseArrayOfProject: projectsJson ]) flattened.
1✔
1533
        
1✔
1534
        self glhModel addAll: projects unless: self blockOnIdEquality.
1✔
1535

1✔
1536
        ^ projects
1✔
1537
]
1✔
1538

1✔
1539
{ #category : #'import - projects' }
1✔
1540
GitlabModelImporter >> importProjectsSince: since [
1✔
1541
        "heavy import of all projects"
1✔
1542

1✔
1543
        "copy import from commits"
1✔
1544

1✔
1545
        | newlyFoundProjects page foundProject amount |
1✔
1546
        ('import all Projects since: ' , since printString) recordInfo.
1✔
1547

1✔
1548
        "number of projects per page"
1✔
1549
        amount := 100.
1✔
1550
        page := 0.
1✔
1551
        foundProject := OrderedCollection new.
1✔
1552
        newlyFoundProjects := { true }.
1✔
1553
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
1✔
1554
                | results |
1✔
1555
                page := page + 1.
1✔
1556
                ('import projects page #' , page printString) recordInfo.
1✔
1557

1✔
1558
                results := self repoApi projects allWithParams: {#since -> since} asDictionary .
1✔
1559

1✔
1560
                newlyFoundProjects := self glhModel
1✔
1561
                                              addAll: (self parseArrayOfProject: results)
1✔
1562
                                              unless: self blockOnIdEquality.
1✔
1563
                foundProject addAll: newlyFoundProjects ].
1✔
1564
]
1✔
1565

1✔
1566
{ #category : #'import - commits' }
1✔
1567
GitlabModelImporter >> importSZZFromCommit: aCommit [
1✔
1568

1✔
1569
        | diffRanges diffs szzCommits |
1✔
1570
        szzCommits := Set new.
1✔
1571
        diffs := self importDiffOfCommit: aCommit.
1✔
1572
        diffRanges := diffs flatCollect: #diffRanges.
1✔
1573
        diffRanges do: [ :range |
1✔
1574
                | blames |
1✔
1575
                blames := NeoJSONReader fromString: (self repoApi repositories
1✔
1576
                                           getBlameOf: range diff new_path
1✔
1577
                                           inRef: aCommit id
1✔
1578
                                           start: range start
1✔
1579
                                           end: range end
1✔
1580
                                           ofProject: aCommit repository project id).
1✔
1581
                blames collect: [ :blame |
1✔
1582
                        blame isDictionary ifTrue: [
1✔
1583
                                szzCommits add: (self
1✔
1584
                                                 importCommit: (blame at: #commit at: #id)
1✔
1585
                                                 ofProject: aCommit repository project) ] ] ].
1✔
1586
        ^ szzCommits
1✔
1587
]
1✔
1588

1✔
1589
{ #category : #'import - tags' }
1✔
1590
GitlabModelImporter >> importTagsForProject: aProject [ 
1✔
1591
        |results tags |
1✔
1592
        results  := repoApi tags getAllOfProject: aProject id.
1✔
1593
        "get a group of tags"
1✔
1594
        tags := results flatCollect: [ :result |
1✔
1595
                        self parseTagsResult: result. 
1✔
1596
                 ].
1✔
1597

1✔
1598
        "add the tags inside the model"
1✔
1599
        tags := glhModel addAll: tags unless: self blockOnNameEquality.
1✔
1600
        tags := aProject repository tags addAll: tags unless: self blockOnNameEquality.
1✔
1601
        
1✔
1602
        "update tag's commit if already imported"
1✔
1603
        tags do: [ :tag |
1✔
1604
                tag commit: (self importCommit: tag commit id ofProject: aProject).
1✔
1605
                 ].
1✔
1606
        
1✔
1607
        "update tag's release if already imported"
1✔
1608
        tags do: [ :tag |
1✔
1609
                |release|
1✔
1610
                tag release ifNotNil: [ 
1✔
1611
                        release := glhModel add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1612
                        release := aProject releases add: tag release unless: (self blockEqualityOn: #tag_name).
1✔
1613
                        tag release: release. 
1✔
1614
                         ].
1✔
1615
                 ].
1✔
1616
        
1✔
1617
        ^ tags
1✔
1618
]
1✔
1619

1✔
1620
{ #category : #'import - users' }
1✔
1621
GitlabModelImporter >> importUser: aUserID [
1✔
1622

1✔
1623
        | result userResult |
1✔
1624
        (self glhModel allWithType: GLHUser)
1✔
1625
                detect: [ :user | user id = aUserID ]
1✔
1626
                ifFound: [ :user | ^ user ].
1✔
1627
        ('Import user: ' , aUserID printString) recordInfo.
1✔
1628
        
1✔
1629
        result := self repoApi users get: aUserID.
1✔
1630
        userResult := self parseUserResult: result.
1✔
1631
        
1✔
1632
        userResult := self glhModel add: userResult unless: self blockOnIdEquality.
1✔
1633
        userCatalogue addUser: userResult.
1✔
1634
        ^ userResult 
1✔
1635
]
1✔
1636

1✔
1637
{ #category : #'import - users' }
1✔
1638
GitlabModelImporter >> importUserByUsername: anUsername [
1✔
1639

1✔
1640
        | dicUsername resultUser |
1✔
1641
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
1✔
1642
                                user username -> user ]) asSet asDictionary.
1✔
1643

1✔
1644
        dicUsername addAll: self userCatalogue collectUsernames.
1✔
1645

1✔
1646

1✔
1647
        resultUser := dicUsername
1✔
1648
                              at: anUsername
1✔
1649
                              ifAbsent: [ "thus we have to import this new user"
1✔
1650
                                      | result userId searchResult params |
1✔
1651
                                      ('Import user with username: '
1✔
1652
                                       , anUsername printString) recordInfo.
1✔
1653
                                      params := { (#search -> anUsername) } asDictionary.
1✔
1654
                                      result := self repoApi users allWithParams: params.
1✔
1655
                                                        
1✔
1656
                                                         "when result is an error"
1✔
1657
                                                         (result isString) ifTrue: [ result := { result } ].
1✔
1658
                                                        
1✔
1659
                                      searchResult := result ifEmpty: [ result ] ifNotEmpty: [(result collect: [ :usersJson |
1✔
1660
                                                               NeoJSONReader fromString: usersJson ]) first].
1✔
1661
                                                         
1✔
1662
                                      (searchResult class = Dictionary and: [
1✔
1663
                                               (searchResult at: #message) includesSubstring:
1✔
1664
                                                       '403 Forbidden' ])
1✔
1665
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
1✔
1666
                                                      self glhModel
1✔
1667
                                                              add: (GLHUser new
1✔
1668
                                                                               username: anUsername;
1✔
1669
                                                                               name: anUsername;
1✔
1670
                                                                               yourself)
1✔
1671
                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1672
                                              ifFalse: [
1✔
1673
                                                      searchResult
1✔
1674
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
1✔
1675
                                                                      self glhModel
1✔
1676
                                                                              add: (GLHUser new
1✔
1677
                                                                                               username: anUsername;
1✔
1678
                                                                                               name: anUsername;
1✔
1679
                                                                                               yourself)
1✔
1680
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
1✔
1681
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
1✔
1682
                                                                      userId := searchResult first at: #id.
1✔
1683
                                                                      (self glhModel allWithType: GLHUser)
1✔
1684
                                                                              detect: [ :user | user id = userId ]
1✔
1685
                                                                              ifNone: [ self importUser: userId ] ] ] ].
1✔
1686

1✔
1687
        self userCatalogue addUser: resultUser withName: anUsername.
1✔
1688

1✔
1689
        ^ resultUser
1✔
1690
]
1✔
1691

1✔
1692
{ #category : #initialization }
1✔
1693
GitlabModelImporter >> initReader [
1✔
1694
        
1✔
1695
        "add specific reader for this importer here"
1✔
1696
        super initReader
1✔
1697
]
1✔
1698

1✔
1699
{ #category : #initialization }
1✔
1700
GitlabModelImporter >> initialize [
1✔
1701

1✔
1702
        super initialize.
1✔
1703
        withCommitDiffs := true.
1✔
1704
        withInitialCommits := false.
1✔
1705
        withInitialMergeRequest := false.
1✔
1706

1✔
1707
        self withCommitsSince: 1 week.
1✔
1708

1✔
1709
        
1✔
1710
]
1✔
1711

1✔
1712
{ #category : #private }
1✔
1713
GitlabModelImporter >> isServerError: aString [
1✔
1714
        ^ aString = '{"message":"500 Internal Server Error"}'
1✔
1715
]
1✔
1716

1✔
1717
{ #category : #'import - projects' }
1✔
1718
GitlabModelImporter >> loadAllProjectsFromRepositorySoftware [
1✔
1719
        "heavy import that load all the active project inside the model. Only import the project entities"
1✔
1720
        |projects|
1✔
1721
        
1✔
1722
        projects := self repoApi projects. 
1✔
1723
]
1✔
1724

1✔
1725
{ #category : #'private - parsing' }
1✔
1726
GitlabModelImporter >> newParseCommitResult: result [
1✔
1727

1✔
1728
        generalReader  on: result readStream.
1✔
1729

1✔
1730
        ^ generalReader nextAs: GLHCommit
1✔
1731
]
1✔
1732

1✔
1733
{ #category : #'private - parsing' }
1✔
1734
GitlabModelImporter >> newParseDiffResult: result [
1✔
1735

1✔
1736
        generalReader on: result readStream.
1✔
1737
        ^ generalReader nextAs: #ArrayOfDiff
1✔
1738
]
1✔
1739

1✔
1740
{ #category : #'private - parsing' }
1✔
1741
GitlabModelImporter >> parseArrayOfProject: arrayOfProjects [
1✔
1742

1✔
1743
        | reader |
1✔
1744
        reader := generalReader on: arrayOfProjects readStream.
1✔
1745
        
1✔
1746
        ^ reader nextAs: #ArrayOfProject
1✔
1747
]
1✔
1748

1✔
1749
{ #category : #'private - parsing' }
1✔
1750
GitlabModelImporter >> parseBranchesResult: result [
1✔
1751

1✔
1752
        | reader |
1✔
1753
        reader := generalReader on: result readStream.
1✔
1754

1✔
1755
        ^ reader nextAs: #ArrayOfBranch
1✔
1756
]
1✔
1757

1✔
1758
{ #category : #'private - parsing' }
1✔
1759
GitlabModelImporter >> parseBranchesResult: result ofProject: aGLHProject [
1✔
1760

1✔
1761
        | reader |
1✔
1762
        self flag: 'WARNING: do not use the importer inside a parsing process. do it after using a object cached on the sub elemnt id'.
1✔
1763
        self
1✔
1764
                deprecated: 'Use parseBranchesResult: instead of current one'
1✔
1765
                on: '23 September 2025'
1✔
1766
                in:
1✔
1767
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
1768

1✔
1769

1✔
1770
        reader := NeoJSONReader on: result readStream.
1✔
1771
        reader mapInstVarsFor: GLHBranch.
1✔
1772

1✔
1773
        reader for: GLHBranch do: [ :mapping |
1✔
1774
                mapping
1✔
1775
                        mapProperty: #commit
1✔
1776
                        getter: [  ]
1✔
1777
                        setter: [ :branch :rawCommit |
1✔
1778
                                branch sha: (rawCommit at: #id)
1✔
1779
                                "commit := self
1✔
1780
                                                  importCommit: (rawCommit at: #id)
1✔
1781
                                                  ofProject: aGLHProject.
1✔
1782
                                branch commits add: commit unless: self blockOnIdEquality " ] ].
1✔
1783

1✔
1784
        reader
1✔
1785
                for: #ArrayOfBranch
1✔
1786
                customDo: [ :customMappting |
1✔
1787
                customMappting listOfElementSchema: GLHBranch ].
1✔
1788

1✔
1789
        ^ reader nextAs: #ArrayOfBranch
1✔
1790
]
1✔
1791

1✔
1792
{ #category : #'private - parsing' }
1✔
1793
GitlabModelImporter >> parseCommitResult: result [
1✔
1794

1✔
1795
        | reader |
1✔
1796
        reader := generalReader on: result readStream.
1✔
1797

1✔
1798
        ^ reader nextAs: GLHCommit
1✔
1799
]
1✔
1800

1✔
1801
{ #category : #'private - parsing' }
1✔
1802
GitlabModelImporter >> parseCommitsResult: result [
1✔
1803

1✔
1804
        | reader |
1✔
1805
        reader := generalReader on: result readStream.
1✔
1806

1✔
1807
        ^ reader nextAs: #ArrayOfCommit
1✔
1808
]
1✔
1809

1✔
1810
{ #category : #private }
1✔
1811
GitlabModelImporter >> parseDiffResult: result [
1✔
1812

1✔
1813
        | reader |
1✔
1814
        self
1✔
1815
                deprecated: 'Use #newParseDiffResult: instead'
1✔
1816
                on: '28 June 2024'
1✔
1817
                in:
1✔
1818
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
1✔
1819
        reader := NeoJSONReader on: result readStream.
1✔
1820
        reader for: GLHDiff do: [ :mapping |
1✔
1821
                mapping mapInstVars:
1✔
1822
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
1823
                mapping mapInstVar: #diffString to: #diff ].
1✔
1824

1✔
1825
        reader
1✔
1826
                for: #ArrayOfDiffs
1✔
1827
                customDo: [ :customMappting |
1✔
1828
                customMappting listOfElementSchema: GLHDiff ].
1✔
1829
        ^ reader nextAs: #ArrayOfDiffs
1✔
1830
]
1✔
1831

1✔
1832
{ #category : #'private - parsing' }
1✔
1833
GitlabModelImporter >> parseFileTreeResult: aResult [
1✔
1834

1✔
1835
        | reader |
1✔
1836
        reader := NeoJSONReader on: aResult readStream.
1✔
1837
        reader mapInstVarsFor: GLHApiFile.
1✔
1838
        reader
1✔
1839
                for: #ArrayOfFile
1✔
1840
                customDo: [ :customMappting | 
1✔
1841
                customMappting listOfElementSchema: GLHApiFile ].
1✔
1842
        ^ reader nextAs: #ArrayOfFile
1✔
1843
]
1✔
1844

1✔
1845
{ #category : #'private - parsing' }
1✔
1846
GitlabModelImporter >> parseGroupResult: aResult [
1✔
1847

1✔
1848
        | reader |
1✔
1849
        reader := generalReader on: aResult readStream.
1✔
1850

1✔
1851
        ^ reader nextAs: GLHGroup
1✔
1852
]
1✔
1853

1✔
1854
{ #category : #'private - parsing' }
1✔
1855
GitlabModelImporter >> parseJobsResult: result [ 
1✔
1856
        | reader |
1✔
1857
        reader := generalReader on: result readStream.
1✔
1858

1✔
1859
        ^ reader nextAs: #ArrayOfJob
1✔
1860
]
1✔
1861

1✔
1862
{ #category : #'private - parsing' }
1✔
1863
GitlabModelImporter >> parseJobsResult: result ofProject: aProject [
1✔
1864

1✔
1865
        | reader |
1✔
1866
        self
1✔
1867
                deprecated: 'Use parseJobsResult: instead of current one'
1✔
1868
                on: '23 September 2025'
1✔
1869
                in:
1✔
1870
                'Pharo-12.0.0+SNAPSHOT.build.1571.sha.cf5fcd22e66957962c97dffc58b0393b7f368147 (64 Bit)'.
1✔
1871
                
1✔
1872
        reader := generalReader on: result readStream.
1✔
1873
        reader for: GLHJob do: [ :mapping |
1✔
1874
                mapping
1✔
1875
                        mapProperty: #commit
1✔
1876
                        getter: [ :object | #ignore ]
1✔
1877
                        setter: [ :object :value |
1✔
1878
                                value ifNotNil: [
1✔
1879
                                        object commit:
1✔
1880
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ] ].
1✔
1881

1✔
1882

1✔
1883
        ^ reader nextAs: #ArrayOfJob
1✔
1884
]
1✔
1885

1✔
1886
{ #category : #'private - parsing' }
1✔
1887
GitlabModelImporter >> parseMergeRequestsResult: result [
1✔
1888

1✔
1889
        generalReader on: result readStream.
1✔
1890
        ^ generalReader nextAs: #ArrayOfMergeRequest
1✔
1891
]
1✔
1892

1✔
1893
{ #category : #'private - parsing' }
1✔
1894
GitlabModelImporter >> parseNoteJson: results [
1✔
1895

1✔
1896
        | reader |
1✔
1897
        "Créer un lecteur JSON"
1✔
1898
        reader := generalReader on: results readStream.
1✔
1899

1✔
1900
        "Corriger la conversion des dates"
1✔
1901
        "reader for: DateAndTime customDo: [ :mapping |
1✔
1902
                mapping decoder: [ :string |
1✔
1903
                        DateAndTime readFrom: string readStream ] ]."
1✔
1904

1✔
1905
        
1✔
1906
        ^ reader nextAs: #ArrayOfNote
1✔
1907
]
1✔
1908

1✔
1909
{ #category : #'private - parsing' }
1✔
1910
GitlabModelImporter >> parsePipelineResult: result [
1✔
1911

1✔
1912
        | reader |
1✔
1913
        
1✔
1914
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1915
        
1✔
1916
        reader := generalReader on: result readStream.
1✔
1917
        
1✔
1918
        ^ reader nextAs: GLHPipeline
1✔
1919
]
1✔
1920

1✔
1921
{ #category : #'private - parsing' }
1✔
1922
GitlabModelImporter >> parsePipelinesResult: result [
1✔
1923

1✔
1924
        | reader |
1✔
1925
        (result includesSubstring: '{"message":"40') ifTrue: [ ^ {  } ].
1✔
1926

1✔
1927
        reader := generalReader on: result readStream.
1✔
1928

1✔
1929
        ^ reader nextAs: #ArrayOfPipeline
1✔
1930
]
1✔
1931

1✔
1932
{ #category : #'private - parsing' }
1✔
1933
GitlabModelImporter >> parseProjectResult: aResult [
1✔
1934

1✔
1935
        | reader |
1✔
1936
        reader := generalReader on: aResult readStream.
1✔
1937

1✔
1938
        ^ reader nextAs: GLHProject
1✔
1939
]
1✔
1940

1✔
1941
{ #category : #'private - parsing' }
1✔
1942
GitlabModelImporter >> parseReleaseResult: result [
1✔
1943
        |reader|
1✔
1944
        reader := generalReader on: result readStream.
1✔
1945
        
1✔
1946
        ^ reader nextAs: GLHRelease 
1✔
1947
]
1✔
1948

1✔
1949
{ #category : #'private - parsing' }
1✔
1950
GitlabModelImporter >> parseReleasesResult: result [
1✔
1951

1✔
1952
        | reader |
1✔
1953
        reader := generalReader on: result readStream.
1✔
1954

1✔
1955
        ^ reader nextAs: #ArrayOfRelease
1✔
1956
]
1✔
1957

1✔
1958
{ #category : #'private - parsing' }
1✔
1959
GitlabModelImporter >> parseSubGroupResult: aResult [
1✔
1960

1✔
1961
        | reader |
1✔
1962
        reader := generalReader on: aResult readStream.
1✔
1963
        
1✔
1964
        ^ reader nextAs: #ArrayOfGroup
1✔
1965
]
1✔
1966

1✔
1967
{ #category : #'private - parsing' }
1✔
1968
GitlabModelImporter >> parseTagsResult: result [
1✔
1969
        |reader|
1✔
1970
        reader := generalReader on: result readStream.
1✔
1971
        
1✔
1972
        ^ reader nextAs: #ArrayOfTags
1✔
1973
]
1✔
1974

1✔
1975
{ #category : #'private - parsing' }
1✔
1976
GitlabModelImporter >> parseUserResult: result [
1✔
1977

1✔
1978
        | reader |
1✔
1979
        
1✔
1980
        reader := generalReader on: result readStream.
1✔
1981
        
1✔
1982
        ^ reader nextAs: GLHUser
1✔
1983

1✔
1984
        
1✔
1985

1✔
1986
]
1✔
1987

1✔
1988
{ #category : #'private - parsing' }
1✔
1989
GitlabModelImporter >> parseUsersResult: result [
1✔
1990

1✔
1991
        | reader |
1✔
1992
        
1✔
1993
        reader := generalReader on: result readStream.
1✔
1994
        
1✔
1995
        ^ reader nextAs: #ArrayOfUser
1✔
1996
        
1✔
1997
]
1✔
1998

1✔
1999
{ #category : #'import - projects' }
1✔
2000
GitlabModelImporter >> partiallyImportProject: aProjectID [
1✔
2001

1✔
2002
        | result projectResult |
1✔
2003
        ('Import project with id:  ' , aProjectID printString) recordInfo.
1✔
2004

1✔
2005
        (glhModel allWithType: GLHProject)
1✔
2006
                detect: [ :project | project id = aProjectID ]
1✔
2007
                ifFound: [ :project | ^ project ].
1✔
2008

1✔
2009
        result := self repoApi projects get: aProjectID.
1✔
2010
        projectResult := self parseProjectResult: result.
1✔
2011

1✔
2012
        projectResult repository: GLHRepository new.
1✔
2013
        self glhModel add: projectResult repository.
1✔
2014
        self completeImportsOfRepository: projectResult repository.
1✔
2015

1✔
2016
        ^ projectResult
1✔
2017
]
1✔
2018

1✔
2019
{ #category : #'import - pipelines' }
1✔
2020
GitlabModelImporter >> pipelinesOf: aProjectID after: after andBefore: before [
1✔
2021

1✔
2022
        | result |
1✔
2023
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
1✔
2024
        
1✔
2025
        result := self repoApi pipelines getAllInProject: aProjectID 
1✔
2026
                                                                                                withParams: {        #updated_before -> before.
1✔
2027
                                                                                                                                        #updated_after -> after} asDictionary .
1✔
2028
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
2029

1✔
2030
        ^ (result collect: [ :pipelinesJson |
1✔
2031
                           self parsePipelinesResult: pipelinesJson ]) flattened
1✔
2032
]
1✔
2033

1✔
2034
{ #category : #'import - pipelines' }
1✔
2035
GitlabModelImporter >> pipelinesOf: aProjectID withLimit: aLimit [
1✔
2036

1✔
2037
        | result |
1✔
2038
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
1✔
2039
        result := self repoApi pipelines getByPage: 1 perPage: aLimit inProject: aProjectID.
1✔
2040
        result isString ifTrue: [ ^ self parsePipelinesResult: result ].
1✔
2041

1✔
2042
        ^ (result collect: [ :pipelinesJson |
1✔
2043
                           self parsePipelinesResult: pipelinesJson ]) flattened
1✔
2044
]
1✔
2045

1✔
2046
{ #category : #accessing }
1✔
2047
GitlabModelImporter >> repoApi: anObject [
1✔
2048
        super repoApi: anObject.
1✔
2049
        self repoApi output: 'json'
1✔
2050
]
1✔
2051

1✔
2052
{ #category : #'search - merge request' }
1✔
2053
GitlabModelImporter >> searchMergeRequestMentionning: aString [ 
1✔
2054
        |mergeRequests results|
1✔
2055
        results := repoApi mergeRequests search: aString.
1✔
2056
        mergeRequests := self parseMergeRequestsResult: results.
1✔
2057
        mergeRequests :=        mergeRequests collect: [ :mr |
1✔
2058
                mr project: (self importProject: mr project_id).
1✔
2059
                mr
1✔
2060
                 ].
1✔
2061
        
1✔
2062
        ^ glhModel addAll: mergeRequests unless: self blockOnIdEquality. 
1✔
2063
]
1✔
2064

1✔
2065
{ #category : #private }
1✔
2066
GitlabModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
1✔
2067

1✔
2068
        ^ (self glhModel allWithType: aType)
1✔
2069
                select: [ :entity | (entity perform: aSelector) = value ]
1✔
2070
]
1✔
2071

1✔
2072
{ #category : #'import - groups' }
1✔
2073
GitlabModelImporter >> subGroupsOf: aGroupID [
1✔
2074

1✔
2075
        | results subgroups |
1✔
2076
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
1✔
2077
        results := self repoApi groups subgroupsOf: aGroupID.
1✔
2078
        subgroups := (results collect: [ :subgroupsJson | self parseSubGroupResult: subgroupsJson ]) flattened.
1✔
2079
        
1✔
2080
        ^ subgroups
1✔
2081
]
1✔
2082

1✔
2083
{ #category : #accessing }
1✔
2084
GitlabModelImporter >> withInitialCommits: boolean [
1✔
2085
        withInitialCommits := boolean 
1✔
2086
]
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc