Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
e6a71eac
Commit
e6a71eac
authored
May 31, 2021
by
Guilhem Saurel
Browse files
limit number of ci jobs fetch
parent
2319683f
Pipeline
#14763
failed with stage
in 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rainboard/models.py
View file @
e6a71eac
...
...
@@ -95,7 +95,7 @@ class Forge(Links, NamedModel):
req
=
self
.
api_req
(
url
)
return
req
.
json
()
if
req
.
status_code
==
200
else
[]
# TODO
def
api_list
(
self
,
url
=
''
,
name
=
None
):
def
api_list
(
self
,
url
=
''
,
name
=
None
,
limit
=
None
):
page
=
1
while
page
:
req
=
self
.
api_req
(
url
,
name
,
page
)
...
...
@@ -106,6 +106,8 @@ class Forge(Links, NamedModel):
data
=
data
[
name
]
yield
from
data
page
=
api_next
(
self
.
source
,
req
)
if
limit
is
not
None
and
page
>
limit
:
break
def
headers
(
self
):
return
{
...
...
@@ -608,7 +610,7 @@ class Repo(TimeStampedModel):
ci_build
.
save
()
def
get_jobs_gitlab
(
self
):
for
data
in
self
.
api_list
(
'/jobs'
):
for
data
in
self
.
api_list
(
'/jobs'
,
limit
=
4
):
branch_name
=
f
'
{
self
.
forge
.
slug
}
/
{
self
.
namespace
.
slug
}
/
{
data
[
"ref"
]
}
'
branch
,
created
=
Branch
.
objects
.
get_or_create
(
name
=
branch_name
,
project
=
self
.
project
,
repo
=
self
)
if
created
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment