gitlab-runner-tui 0.1.14

A terminal UI for monitoring GitLab CI runners
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
use crate::models::{
    manager::RunnerManager,
    runner::{Runner, RunnerGroup},
};

pub fn demo_runners() -> Vec<Runner> {
    vec![
        // --- ONLINE runners (6) ---
        Runner {
            id: 100001,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("prod-docker-01".to_string()),
            created_at: Some("2022-06-15T08:00:00.000Z".to_string()),
            ip_address: Some("10.0.1.10".to_string()),
            is_shared: false,
            status: "online".to_string(),
            version: Some("18.1.0".to_string()),
            revision: Some("a1b2c3d4".to_string()),
            tag_list: vec![
                "docker".to_string(),
                "linux".to_string(),
                "prod".to_string(),
            ],
            managers: vec![RunnerManager {
                id: 200001,
                system_id: "s_aabbccdd1122".to_string(),
                created_at: "2022-06-15T08:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T09:45:00.000Z".to_string()),
                ip_address: Some("10.0.1.10".to_string()),
                status: "online".to_string(),
                version: Some("18.1.0".to_string()),
                revision: Some("a1b2c3d4".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![RunnerGroup {
                id: 1,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        Runner {
            id: 100002,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("prod-docker-02".to_string()),
            created_at: Some("2022-06-15T08:00:00.000Z".to_string()),
            ip_address: Some("10.0.1.11".to_string()),
            is_shared: false,
            status: "online".to_string(),
            version: Some("18.1.0".to_string()),
            revision: Some("a1b2c3d4".to_string()),
            tag_list: vec![
                "docker".to_string(),
                "linux".to_string(),
                "prod".to_string(),
            ],
            managers: vec![RunnerManager {
                id: 200002,
                system_id: "s_bbccddee2233".to_string(),
                created_at: "2022-06-15T08:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T09:50:00.000Z".to_string()),
                ip_address: Some("10.0.1.11".to_string()),
                status: "online".to_string(),
                version: Some("18.1.0".to_string()),
                revision: Some("a1b2c3d4".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![RunnerGroup {
                id: 1,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        Runner {
            id: 100003,
            runner_type: "instance_type".to_string(),
            active: true,
            paused: false,
            description: Some("shared-k8s-runner".to_string()),
            created_at: Some("2023-01-10T12:00:00.000Z".to_string()),
            ip_address: Some("10.0.2.5".to_string()),
            is_shared: true,
            status: "online".to_string(),
            version: Some("17.9.0".to_string()),
            revision: Some("deadbeef".to_string()),
            tag_list: vec!["k8s".to_string(), "linux".to_string()],
            managers: vec![
                RunnerManager {
                    id: 200003,
                    system_id: "s_ccddee334455".to_string(),
                    created_at: "2023-01-10T12:00:00.000Z".to_string(),
                    contacted_at: Some("2026-03-19T09:30:00.000Z".to_string()),
                    ip_address: Some("10.0.2.5".to_string()),
                    status: "online".to_string(),
                    version: Some("17.9.0".to_string()),
                    revision: Some("deadbeef".to_string()),
                    platform: Some("linux".to_string()),
                    architecture: Some("amd64".to_string()),
                },
                RunnerManager {
                    id: 200004,
                    system_id: "s_ddeeff445566".to_string(),
                    created_at: "2023-01-10T12:00:00.000Z".to_string(),
                    contacted_at: Some("2026-03-19T08:00:00.000Z".to_string()),
                    ip_address: Some("10.0.2.6".to_string()),
                    status: "online".to_string(),
                    version: Some("17.9.0".to_string()),
                    revision: Some("deadbeef".to_string()),
                    platform: Some("linux".to_string()),
                    architecture: Some("arm64".to_string()),
                },
            ],
            groups: vec![],
        },
        Runner {
            id: 100004,
            runner_type: "group_type".to_string(),
            active: true,
            paused: true,
            description: Some("platform-core-runner-01".to_string()),
            created_at: Some("2023-03-20T09:00:00.000Z".to_string()),
            ip_address: Some("10.0.3.1".to_string()),
            is_shared: false,
            status: "online".to_string(),
            version: Some("17.8.2".to_string()),
            revision: Some("f1e2d3c4".to_string()),
            tag_list: vec![
                "runner:type:local".to_string(),
                "platform".to_string(),
                "linux".to_string(),
            ],
            managers: vec![RunnerManager {
                id: 200005,
                system_id: "s_eeff00556677".to_string(),
                created_at: "2023-03-20T09:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T09:55:00.000Z".to_string()),
                ip_address: Some("10.0.3.1".to_string()),
                status: "online".to_string(),
                version: Some("17.8.2".to_string()),
                revision: Some("f1e2d3c4".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![RunnerGroup {
                id: 2,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        Runner {
            id: 100005,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("preproduction-runner".to_string()),
            created_at: Some("2021-11-05T14:00:00.000Z".to_string()),
            ip_address: Some("10.0.4.2".to_string()),
            is_shared: false,
            status: "online".to_string(),
            version: Some("16.11.5".to_string()),
            revision: Some("aabbccdd".to_string()),
            tag_list: vec![
                "linux".to_string(),
                "preproduction".to_string(),
                "local".to_string(),
            ],
            managers: vec![RunnerManager {
                id: 200006,
                system_id: "s_ff0011667788".to_string(),
                created_at: "2021-11-05T14:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T07:22:00.000Z".to_string()),
                ip_address: Some("10.0.4.2".to_string()),
                status: "online".to_string(),
                version: Some("16.11.5".to_string()),
                revision: Some("aabbccdd".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        Runner {
            id: 100006,
            runner_type: "project_type".to_string(),
            active: true,
            paused: false,
            description: Some("windows-build-runner".to_string()),
            created_at: Some("2024-02-01T10:00:00.000Z".to_string()),
            ip_address: Some("10.0.5.10".to_string()),
            is_shared: false,
            status: "online".to_string(),
            version: Some("18.0.1".to_string()),
            revision: Some("11223344".to_string()),
            tag_list: vec!["windows".to_string(), "dotnet".to_string()],
            managers: vec![RunnerManager {
                id: 200007,
                system_id: "s_001122778899".to_string(),
                created_at: "2024-02-01T10:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T09:58:00.000Z".to_string()),
                ip_address: Some("10.0.5.10".to_string()),
                status: "online".to_string(),
                version: Some("18.0.1".to_string()),
                revision: Some("11223344".to_string()),
                platform: Some("windows".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        // --- OFFLINE runners (3) ---
        Runner {
            id: 100007,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("prod-docker-03".to_string()),
            created_at: Some("2022-08-01T08:00:00.000Z".to_string()),
            ip_address: Some("10.0.1.12".to_string()),
            is_shared: false,
            status: "offline".to_string(),
            version: Some("17.5.0".to_string()),
            revision: Some("55667788".to_string()),
            tag_list: vec![
                "docker".to_string(),
                "linux".to_string(),
                "prod".to_string(),
            ],
            managers: vec![RunnerManager {
                id: 200008,
                system_id: "s_112233889900".to_string(),
                created_at: "2022-08-01T08:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-18T22:10:00.000Z".to_string()),
                ip_address: Some("10.0.1.12".to_string()),
                status: "offline".to_string(),
                version: Some("17.5.0".to_string()),
                revision: Some("55667788".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![RunnerGroup {
                id: 1,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        Runner {
            id: 100008,
            runner_type: "instance_type".to_string(),
            active: true,
            paused: false,
            description: Some("shared-runner-legacy".to_string()),
            created_at: Some("2020-05-12T00:00:00.000Z".to_string()),
            ip_address: None,
            is_shared: true,
            status: "offline".to_string(),
            version: Some("15.4.0".to_string()),
            revision: Some("oldoldold".to_string()),
            tag_list: vec!["legacy".to_string()],
            managers: vec![RunnerManager {
                id: 200009,
                system_id: "s_223344990011".to_string(),
                created_at: "2020-05-12T00:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-17T14:00:00.000Z".to_string()),
                ip_address: None,
                status: "offline".to_string(),
                version: Some("15.4.0".to_string()),
                revision: Some("oldoldold".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        Runner {
            id: 100009,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("platform-runner-offline".to_string()),
            created_at: Some("2023-07-19T11:00:00.000Z".to_string()),
            ip_address: Some("10.0.3.5".to_string()),
            is_shared: false,
            status: "offline".to_string(),
            version: Some("17.2.1".to_string()),
            revision: Some("aabbddeeff".to_string()),
            tag_list: vec!["runner:type:local".to_string(), "linux".to_string()],
            managers: vec![RunnerManager {
                id: 200010,
                system_id: "s_334455001122".to_string(),
                created_at: "2023-07-19T11:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-19T04:30:00.000Z".to_string()),
                ip_address: Some("10.0.3.5".to_string()),
                status: "offline".to_string(),
                version: Some("17.2.1".to_string()),
                revision: Some("aabbddeeff".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![RunnerGroup {
                id: 2,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        // --- STALE runners (3) ---
        Runner {
            id: 100010,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("stale-runner-01".to_string()),
            created_at: Some("2022-04-01T00:00:00.000Z".to_string()),
            ip_address: Some("10.0.6.1".to_string()),
            is_shared: false,
            status: "stale".to_string(),
            version: Some("17.0.0".to_string()),
            revision: Some("stale001".to_string()),
            tag_list: vec!["linux".to_string(), "prod".to_string()],
            managers: vec![RunnerManager {
                id: 200011,
                system_id: "s_445566112233".to_string(),
                created_at: "2022-04-01T00:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-17T10:00:00.000Z".to_string()),
                ip_address: Some("10.0.6.1".to_string()),
                status: "offline".to_string(),
                version: Some("17.0.0".to_string()),
                revision: Some("stale001".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        Runner {
            id: 100011,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("stale-runner-02".to_string()),
            created_at: Some("2021-09-14T00:00:00.000Z".to_string()),
            ip_address: None,
            is_shared: false,
            status: "stale".to_string(),
            version: Some("16.8.0".to_string()),
            revision: Some("stale002".to_string()),
            tag_list: vec!["windows".to_string()],
            managers: vec![RunnerManager {
                id: 200012,
                system_id: "s_556677223344".to_string(),
                created_at: "2021-09-14T00:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-14T06:00:00.000Z".to_string()),
                ip_address: None,
                status: "offline".to_string(),
                version: Some("16.8.0".to_string()),
                revision: Some("stale002".to_string()),
                platform: Some("windows".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        Runner {
            id: 100012,
            runner_type: "instance_type".to_string(),
            active: true,
            paused: false,
            description: Some("stale-shared-runner".to_string()),
            created_at: Some("2020-11-30T00:00:00.000Z".to_string()),
            ip_address: Some("10.0.7.99".to_string()),
            is_shared: true,
            status: "stale".to_string(),
            version: Some("16.5.2".to_string()),
            revision: Some("stale003".to_string()),
            tag_list: vec!["linux".to_string(), "k8s".to_string()],
            managers: vec![RunnerManager {
                id: 200013,
                system_id: "s_667788334455".to_string(),
                created_at: "2020-11-30T00:00:00.000Z".to_string(),
                contacted_at: Some("2026-03-09T12:00:00.000Z".to_string()),
                ip_address: Some("10.0.7.99".to_string()),
                status: "offline".to_string(),
                version: Some("16.5.2".to_string()),
                revision: Some("stale003".to_string()),
                platform: Some("linux".to_string()),
                architecture: Some("amd64".to_string()),
            }],
            groups: vec![],
        },
        // --- NEVER CONTACTED runners (2) ---
        Runner {
            id: 100013,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: Some("new-runner-not-yet-started".to_string()),
            created_at: Some("2026-03-18T15:00:00.000Z".to_string()),
            ip_address: None,
            is_shared: false,
            status: "never_contacted".to_string(),
            version: None,
            revision: None,
            tag_list: vec!["linux".to_string(), "prod".to_string()],
            managers: vec![],
            groups: vec![RunnerGroup {
                id: 1,
                name: "platform".to_string(),
                web_url: "https://demo.gitlab.example.com/platform".to_string(),
            }],
        },
        Runner {
            id: 100014,
            runner_type: "group_type".to_string(),
            active: true,
            paused: false,
            description: None,
            created_at: Some("2026-03-10T09:00:00.000Z".to_string()),
            ip_address: None,
            is_shared: false,
            status: "never_contacted".to_string(),
            version: None,
            revision: None,
            tag_list: vec![],
            managers: vec![],
            groups: vec![],
        },
    ]
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn demo_runners_covers_all_statuses() {
        let runners = demo_runners();
        assert_eq!(
            runners.len(),
            14,
            "fixture set must contain exactly 14 runners"
        );

        let statuses: Vec<&str> = runners.iter().map(|r| r.status.as_str()).collect();
        assert!(statuses.contains(&"online"), "need online runners");
        assert!(statuses.contains(&"offline"), "need offline runners");
        assert!(statuses.contains(&"stale"), "need stale runners");
        assert!(
            statuses.contains(&"never_contacted"),
            "need never_contacted runners"
        );

        let has_paused = runners.iter().any(|r| r.paused);
        assert!(has_paused, "need at least one paused runner");

        let has_groups = runners.iter().any(|r| !r.groups.is_empty());
        assert!(has_groups, "need at least one runner with a group");

        let has_managers = runners.iter().any(|r| !r.managers.is_empty());
        assert!(has_managers, "need runners with managers");
    }
}