Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
dc34060c
Unverified
Commit
dc34060c
authored
3 years ago
by
Sergei Zharinov
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(onboarding): warnings for external host errors (#15587)
Co-authored-by:
Rhys Arkins
<
rhys@arkins.net
>
parent
8ce54366
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/workers/repository/process/fetch.spec.ts
+66
-0
66 additions, 0 deletions
lib/workers/repository/process/fetch.spec.ts
lib/workers/repository/process/fetch.ts
+21
-4
21 additions, 4 deletions
lib/workers/repository/process/fetch.ts
with
87 additions
and
4 deletions
lib/workers/repository/process/fetch.spec.ts
+
66
−
0
View file @
dc34060c
import
{
RenovateConfig
,
getConfig
,
mocked
}
from
'
../../../../test/util
'
;
import
{
MavenDatasource
}
from
'
../../../modules/datasource/maven
'
;
import
type
{
PackageFile
}
from
'
../../../modules/manager/types
'
;
import
{
ExternalHostError
}
from
'
../../../types/errors/external-host-error
'
;
import
{
fetchUpdates
}
from
'
./fetch
'
;
import
*
as
lookup
from
'
./lookup
'
;
...
...
@@ -141,5 +142,70 @@ describe('workers/repository/process/fetch', () => {
await
fetchUpdates
(
config
,
packageFiles
);
expect
(
packageFiles
.
maven
[
0
].
deps
[
0
].
updates
).
toHaveLength
(
2
);
});
it
(
'
throws lookup errors for onboarded repos
'
,
async
()
=>
{
config
.
rangeStrategy
=
'
auto
'
;
const
packageFiles
:
any
=
{
maven
:
[
{
packageFile
:
'
pom.xml
'
,
deps
:
[{
datasource
:
MavenDatasource
.
id
,
depName
:
'
bbb
'
}],
},
],
};
lookupUpdates
.
mockRejectedValueOnce
(
new
Error
(
'
some error
'
));
await
expect
(
fetchUpdates
({
...
config
,
repoIsOnboarded
:
true
},
packageFiles
)
).
rejects
.
toThrow
();
});
it
(
'
throws lookup errors for not onboarded repos
'
,
async
()
=>
{
config
.
rangeStrategy
=
'
auto
'
;
const
packageFiles
:
any
=
{
maven
:
[
{
packageFile
:
'
pom.xml
'
,
deps
:
[{
datasource
:
MavenDatasource
.
id
,
depName
:
'
bbb
'
}],
},
],
};
lookupUpdates
.
mockRejectedValueOnce
(
new
Error
(
'
some error
'
));
await
expect
(
fetchUpdates
({
...
config
,
repoIsOnboarded
:
true
},
packageFiles
)
).
rejects
.
toThrow
();
});
it
(
'
produces external host warnings for not onboarded repos
'
,
async
()
=>
{
config
.
rangeStrategy
=
'
auto
'
;
const
packageFiles
:
any
=
{
maven
:
[
{
packageFile
:
'
pom.xml
'
,
deps
:
[{
datasource
:
MavenDatasource
.
id
,
depName
:
'
bbb
'
}],
},
],
};
const
err
=
new
ExternalHostError
(
new
Error
(
'
some error
'
));
lookupUpdates
.
mockRejectedValueOnce
(
err
);
await
fetchUpdates
({
...
config
,
repoIsOnboarded
:
false
},
packageFiles
);
expect
(
packageFiles
).
toMatchObject
({
maven
:
[
{
deps
:
[
{
depName
:
'
bbb
'
,
warnings
:
[
{
topic
:
'
Lookup Error
'
,
message
:
'
bbb: some error
'
},
],
},
],
},
],
});
});
});
});
This diff is collapsed.
Click to expand it.
lib/workers/repository/process/fetch.ts
+
21
−
4
View file @
dc34060c
...
...
@@ -9,6 +9,7 @@ import type {
PackageDependency
,
PackageFile
,
}
from
'
../../../modules/manager/types
'
;
import
{
ExternalHostError
}
from
'
../../../types/errors/external-host-error
'
;
import
{
clone
}
from
'
../../../util/clone
'
;
import
{
applyPackageRules
}
from
'
../../../util/package-rules
'
;
import
{
PackageFiles
}
from
'
../package-files
'
;
...
...
@@ -47,10 +48,26 @@ async function fetchDepUpdates(
dep
.
skipReason
=
'
disabled
'
;
}
else
{
if
(
depConfig
.
datasource
)
{
try
{
dep
=
{
...
dep
,
...(
await
lookupUpdates
(
depConfig
as
LookupUpdateConfig
)),
};
}
catch
(
err
)
{
if
(
packageFileConfig
.
repoIsOnboarded
||
!
(
err
instanceof
ExternalHostError
)
)
{
throw
err
;
}
const
cause
=
err
.
err
;
dep
.
warnings
??=
[];
dep
.
warnings
.
push
({
topic
:
'
Lookup Error
'
,
message
:
`
${
depName
}
:
${
cause
.
message
}
`
,
});
}
}
dep
.
updates
=
dep
.
updates
??
[];
}
...
...
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