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
e469cf1a
Commit
e469cf1a
authored
Sep 2, 2018
by
Hutson Betts
Committed by
Rhys Arkins
Sep 2, 2018
Browse files
Options
Downloads
Patches
Plain Diff
feat(gitlab): ignore archived repositories (#2461)
Ignore archived GitLab repositories. Closes #2437
parent
61466b71
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/platform/gitlab/index.js
+16
-2
16 additions, 2 deletions
lib/platform/gitlab/index.js
test/platform/gitlab/index.spec.js
+10
-0
10 additions, 0 deletions
test/platform/gitlab/index.spec.js
with
26 additions
and
2 deletions
lib/platform/gitlab/index.js
+
16
−
2
View file @
e469cf1a
...
@@ -106,8 +106,15 @@ async function initRepo({ repository, token, endpoint, gitAuthor }) {
...
@@ -106,8 +106,15 @@ async function initRepo({ repository, token, endpoint, gitAuthor }) {
throw
new
Error
(
'
Invalid gitAuthor
'
);
throw
new
Error
(
'
Invalid gitAuthor
'
);
}
}
}
}
let
res
;
try
{
try
{
const
res
=
await
get
(
`projects/
${
config
.
repository
}
`
);
res
=
await
get
(
`projects/
${
config
.
repository
}
`
);
if
(
res
.
body
.
archived
)
{
logger
.
info
(
'
Repository is archived - throwing error to abort renovation
'
);
throw
new
Error
(
'
archived
'
);
}
config
.
defaultBranch
=
res
.
body
.
default_branch
;
config
.
defaultBranch
=
res
.
body
.
default_branch
;
config
.
baseBranch
=
config
.
defaultBranch
;
config
.
baseBranch
=
config
.
defaultBranch
;
logger
.
debug
(
`
${
repository
}
default branch =
${
config
.
baseBranch
}
`
);
logger
.
debug
(
`
${
repository
}
default branch =
${
config
.
baseBranch
}
`
);
...
@@ -117,7 +124,14 @@ async function initRepo({ repository, token, endpoint, gitAuthor }) {
...
@@ -117,7 +124,14 @@ async function initRepo({ repository, token, endpoint, gitAuthor }) {
delete
config
.
fileList
;
delete
config
.
fileList
;
await
Promise
.
all
([
getPrList
(),
getFileList
()]);
await
Promise
.
all
([
getPrList
(),
getFileList
()]);
}
catch
(
err
)
{
}
catch
(
err
)
{
logger
.
error
({
err
},
`GitLab init error`
);
logger
.
debug
(
'
Caught initRepo error
'
);
if
(
err
.
message
===
'
archived
'
)
{
throw
err
;
}
logger
.
info
(
{
err
,
message
:
err
.
message
,
body
:
res
?
res
.
body
:
undefined
},
'
Unknown GitLab initRepo error
'
);
throw
err
;
throw
err
;
}
}
return
{};
return
{};
...
...
This diff is collapsed.
Click to expand it.
test/platform/gitlab/index.spec.js
+
10
−
0
View file @
e469cf1a
...
@@ -142,6 +142,16 @@ describe('platform/gitlab', () => {
...
@@ -142,6 +142,16 @@ describe('platform/gitlab', () => {
}
}
expect
(
err
.
message
).
toBe
(
'
always error
'
);
expect
(
err
.
message
).
toBe
(
'
always error
'
);
});
});
it
(
'
should throw an error if repository is archived
'
,
async
()
=>
{
get
.
mockReturnValue
({
body
:
{
archived
:
true
}
});
let
err
;
try
{
await
gitlab
.
initRepo
({
repository
:
'
some/repo
'
,
token
:
'
sometoken
'
});
}
catch
(
e
)
{
err
=
e
;
}
expect
(
err
.
message
).
toBe
(
'
archived
'
);
});
});
});
describe
(
'
getRepoForceRebase
'
,
()
=>
{
describe
(
'
getRepoForceRebase
'
,
()
=>
{
it
(
'
should return false
'
,
()
=>
{
it
(
'
should return false
'
,
()
=>
{
...
...
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