Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui-middleware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
OX App Suite
Core
ui-middleware
Commits
fb0a2f4c
Commit
fb0a2f4c
authored
10 months ago
by
andree.klattenhoff
Browse files
Options
Downloads
Patches
Plain Diff
Improve logging if fetch for manifest.json/meta.json failed
parent
b9a3881e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/version.js
+20
-5
20 additions, 5 deletions
src/version.js
with
20 additions
and
5 deletions
src/version.js
+
20
−
5
View file @
fb0a2f4c
...
@@ -45,8 +45,15 @@ export const versionUpdateGauge = new Gauge({
...
@@ -45,8 +45,15 @@ export const versionUpdateGauge = new Gauge({
export
async
function
fetchVersionInfo
()
{
export
async
function
fetchVersionInfo
()
{
const
versions
=
await
Promise
.
all
(
configMap
.
urls
.
map
(
async
baseUrl
=>
{
const
versions
=
await
Promise
.
all
(
configMap
.
urls
.
map
(
async
baseUrl
=>
{
try
{
try
{
const
response
=
await
fetch
(
new
URL
(
'
meta.json
'
,
baseUrl
),
{
cache
:
'
no-store
'
})
const
response
=
await
fetch
(
new
URL
(
'
meta.json
'
,
baseUrl
),
{
cache
:
'
no-store
'
}).
catch
((
err
)
=>
{
if
(
!
response
.
ok
)
throw
new
Error
()
logger
.
error
(
err
)
logger
.
warn
(
`[Version] Failed to load meta.json from UI container at
${
baseUrl
}
.`
)
throw
new
Error
()
})
if
(
!
response
.
ok
)
{
logger
.
warn
(
`[Version] Failed to load meta.json from
${
response
.
url
}
(Status:
${
response
.
status
}
:
${
response
.
statusText
}
)`
)
throw
new
Error
()
}
if
(
response
.
headers
.
get
(
'
version
'
))
return
response
.
headers
.
get
(
'
version
'
)
if
(
response
.
headers
.
get
(
'
version
'
))
return
response
.
headers
.
get
(
'
version
'
)
...
@@ -55,10 +62,18 @@ export async function fetchVersionInfo () {
...
@@ -55,10 +62,18 @@ export async function fetchVersionInfo () {
if
(
!
version
)
throw
new
Error
()
if
(
!
version
)
throw
new
Error
()
return
version
return
version
}
catch
(
err
)
{
}
catch
(
err
)
{
logger
.
warn
(
`[Version] UI container at
${
baseUrl
}
does not have meta.json. Fall back to version hash based on manifest.`
)
logger
.
warn
(
'
[Version] Fall back to version hash based on manifest.
'
)
}
const
response
=
await
fetch
(
new
URL
(
'
manifest.json
'
,
baseUrl
),
{
cache
:
'
no-store
'
}).
catch
((
err
)
=>
{
logger
.
error
(
err
)
logger
.
warn
(
`[Version] Failed to load manifest.json from UI container at
${
baseUrl
}
.`
)
throw
new
Error
(
`Cannot fetch manifest.json from
${
baseUrl
}
`
)
})
if
(
!
response
.
ok
)
{
logger
.
warn
(
`[Version] Failed to load manifest.json from
${
response
.
url
}
(Status:
${
response
.
status
}
:
${
response
.
statusText
}
)`
)
throw
new
Error
(
`Cannot fetch manifest.json from
${
baseUrl
}
`
)
}
}
const
response
=
await
fetch
(
new
URL
(
'
manifest.json
'
,
baseUrl
),
{
cache
:
'
no-store
'
})
if
(
!
response
.
ok
)
throw
new
Error
(
`Cannot fetch manifest.json from
${
baseUrl
}
`
)
const
manifest
=
await
response
.
json
()
const
manifest
=
await
response
.
json
()
return
hash
(
manifest
)
return
hash
(
manifest
)
}))
}))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment