gitlab-radiator 4.1.4 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +27 -24
- package/public/client.js +1 -1
- package/public/client.js.LICENSE.txt +4 -0
- package/public/client.less +32 -0
- package/src/app.js +4 -3
- package/src/auth.js +2 -2
- package/src/config.js +1 -0
- package/src/gitlab/client.js +1 -1
- package/src/gitlab/pipelines.js +4 -4
- package/src/gitlab/projects.js +1 -1
package/public/client.less
CHANGED
|
@@ -228,6 +228,38 @@ ol.jobs {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
.horizontal {
|
|
232
|
+
.stages {
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
flex-wrap: nowrap;
|
|
235
|
+
flex-grow: 1;
|
|
236
|
+
|
|
237
|
+
.stage {
|
|
238
|
+
flex-wrap: nowrap;
|
|
239
|
+
align-items: flex-start;
|
|
240
|
+
flex-direction: row;
|
|
241
|
+
|
|
242
|
+
.name {
|
|
243
|
+
min-width: 170px;
|
|
244
|
+
margin-top: 6px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.jobs {
|
|
248
|
+
flex-direction: row;
|
|
249
|
+
flex-wrap: wrap;
|
|
250
|
+
|
|
251
|
+
li {
|
|
252
|
+
margin-right: 5px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:last-child {
|
|
256
|
+
margin-bottom: 5px;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
231
263
|
ol.groups {
|
|
232
264
|
list-style: none;
|
|
233
265
|
width: 100vmax;
|
package/src/app.js
CHANGED
|
@@ -14,7 +14,7 @@ const httpServer = http.Server(app)
|
|
|
14
14
|
const socketIoServer = new Server(httpServer)
|
|
15
15
|
|
|
16
16
|
if (process.env.NODE_ENV !== 'production' && fs.existsSync('./src/dev-assets.js')) {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
const {bindDevAssets} = await import('./dev-assets.js')
|
|
19
19
|
bindDevAssets(app)
|
|
20
20
|
}
|
|
@@ -26,7 +26,7 @@ app.use(compression())
|
|
|
26
26
|
app.use(basicAuth(config.auth))
|
|
27
27
|
|
|
28
28
|
httpServer.listen(config.port, () => {
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
console.log(`Listening on port *:${config.port}`)
|
|
31
31
|
})
|
|
32
32
|
|
|
@@ -36,6 +36,7 @@ const globalState = {
|
|
|
36
36
|
zoom: config.zoom,
|
|
37
37
|
projectsOrder: config.projectsOrder,
|
|
38
38
|
columns: config.columns,
|
|
39
|
+
horizontal: config.horizontal,
|
|
39
40
|
groupSuccessfulProjects: config.groupSuccessfulProjects
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -49,7 +50,7 @@ async function runUpdate() {
|
|
|
49
50
|
globalState.error = await errorIfRunnerOffline()
|
|
50
51
|
socketIoServer.emit('state', withDate(globalState))
|
|
51
52
|
} catch (error) {
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
console.error(error.message)
|
|
54
55
|
globalState.error = `Failed to communicate with GitLab API: ${error.message}`
|
|
55
56
|
socketIoServer.emit('state', withDate(globalState))
|
package/src/auth.js
CHANGED
|
@@ -2,12 +2,12 @@ import authenticate from 'basic-auth'
|
|
|
2
2
|
|
|
3
3
|
export function basicAuth(auth) {
|
|
4
4
|
if (!auth || !auth.username || !auth.password) {
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
console.log('No authentication configured')
|
|
7
7
|
return (req, res, next) => next()
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
console.log('HTTP basic auth enabled')
|
|
12
12
|
return (req, res, next) => {
|
|
13
13
|
const {name, pass} = authenticate(req) || {}
|
package/src/config.js
CHANGED
|
@@ -11,6 +11,7 @@ config.interval = Number(config.interval || 10) * 1000
|
|
|
11
11
|
config.port = Number(config.port || 3000)
|
|
12
12
|
config.zoom = Number(config.zoom || 1.0)
|
|
13
13
|
config.columns = Number(config.columns || 1)
|
|
14
|
+
config.horizontal = config.horizontal || false
|
|
14
15
|
config.groupSuccessfulProjects = config.groupSuccessfulProjects || false
|
|
15
16
|
config.projectsOrder = config.projectsOrder || ['name']
|
|
16
17
|
config.gitlabs = config.gitlabs.map((gitlab) => {
|
package/src/gitlab/client.js
CHANGED
|
@@ -11,7 +11,7 @@ const clients = new Map()
|
|
|
11
11
|
function lazyClient(gitlab) {
|
|
12
12
|
const gitlabUrl = gitlab.url
|
|
13
13
|
if (gitlabUrl === undefined) {
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
console.log('Got undefined url for ' + JSON.stringify(gitlab))
|
|
16
16
|
}
|
|
17
17
|
if (!clients.get(gitlabUrl)) {
|
package/src/gitlab/pipelines.js
CHANGED
|
@@ -19,7 +19,7 @@ export async function fetchLatestPipelines(projectId, gitlab) {
|
|
|
19
19
|
return pipelinesWithStages
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
async function fetchLatestAndMasterPipeline(projectId, config) {
|
|
24
24
|
const pipelines = await fetchPipelines(projectId, config, {per_page: 100})
|
|
25
25
|
if (pipelines.length === 0) {
|
|
@@ -44,11 +44,11 @@ async function fetchPipelines(projectId, config, options) {
|
|
|
44
44
|
|
|
45
45
|
async function fetchDownstreamJobs(projectId, pipelineId, config) {
|
|
46
46
|
const {data: gitlabBridgeJobs} = await gitlabRequest(`/projects/${projectId}/pipelines/${pipelineId}/bridges`, {per_page: 100}, config)
|
|
47
|
-
const childPipelines = gitlabBridgeJobs.filter(bridge => bridge.downstream_pipeline.status !== 'skipped')
|
|
47
|
+
const childPipelines = gitlabBridgeJobs.filter(bridge => bridge.downstream_pipeline !== null && bridge.downstream_pipeline.status !== 'skipped')
|
|
48
48
|
|
|
49
49
|
const downstreamStages = []
|
|
50
50
|
for(const childPipeline of childPipelines) {
|
|
51
|
-
const {stages} = await fetchJobs(
|
|
51
|
+
const {stages} = await fetchJobs(childPipeline.downstream_pipeline.project_id, childPipeline.downstream_pipeline.id, config)
|
|
52
52
|
downstreamStages.push(stages.map(stage => ({
|
|
53
53
|
...stage,
|
|
54
54
|
name: `${childPipeline.stage}:${stage.name}`
|
|
@@ -60,7 +60,7 @@ async function fetchDownstreamJobs(projectId, pipelineId, config) {
|
|
|
60
60
|
async function fetchJobs(projectId, pipelineId, config) {
|
|
61
61
|
const {data: gitlabJobs} = await gitlabRequest(`/projects/${projectId}/pipelines/${pipelineId}/jobs?include_retried=true`, {per_page: 100}, config)
|
|
62
62
|
if (gitlabJobs.length === 0) {
|
|
63
|
-
return {}
|
|
63
|
+
return {commit: undefined, stages: []}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const commit = findCommit(gitlabJobs)
|
package/src/gitlab/projects.js
CHANGED
|
@@ -15,7 +15,7 @@ async function fetchOwnProjects(gitlab) {
|
|
|
15
15
|
const projects = []
|
|
16
16
|
const SAFETY_MAX_PAGE = 10
|
|
17
17
|
for (let page = 1; page <= SAFETY_MAX_PAGE; page += 1) {
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
const {data, headers} = await gitlabRequest('/projects', {page, per_page: 100, membership: true}, gitlab)
|
|
20
20
|
projects.push(data)
|
|
21
21
|
if (data.length === 0 || !headers['x-next-page']) {
|