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
44d1eb03
Commit
44d1eb03
authored
Jul 22, 2020
by
Tom Pillot
Browse files
Less jobs to run, use '-py2' for python 2 images
parent
1a6d262b
Changes
2
Hide whitespace changes
Inline
Side-by-side
rainboard/migrations/0045_example-adder.py
View file @
44d1eb03
...
...
@@ -6,12 +6,13 @@ from django.db import migrations
def
add_project
(
apps
,
schema_editor
):
Project
=
apps
.
get_model
(
'rainboard'
,
'Project'
)
Namespace
=
apps
.
get_model
(
'rainboard'
,
'Namespace'
)
Forge
=
apps
.
get_model
(
'rainboard'
,
'Forge'
)
git_project
=
Project
(
name
=
'example-adder'
,
public
=
True
,
main_namespace
=
Namespace
.
objects
.
get
(
name
=
'Gepetto'
),
main_forge
=
None
,
main_forge
=
Forge
.
objects
.
get
(
name
=
'Gitlab'
)
,
license
=
None
,
homepage
=
None
,
description
=
None
,
...
...
rainboard/models.py
View file @
44d1eb03
...
...
@@ -374,7 +374,7 @@ class Project(Links, NamedModel, TimeStampedModel):
return
settings
.
PUBLIC_REGISTRY
if
self
.
public
else
settings
.
PRIVATE_REGISTRY
def
doc_coverage_image
(
self
):
images
=
Image
.
objects
.
filter
(
robotpkg__project
=
self
,
py3
=
Fals
e
,
target__main
=
True
)
images
=
Image
.
objects
.
filter
(
robotpkg__project
=
self
,
py3
=
Tru
e
,
target__main
=
True
)
return
images
.
order_by
(
Length
(
'robotpkg__name'
).
desc
()).
first
()
def
print_deps
(
self
):
...
...
@@ -800,7 +800,22 @@ class Robotpkg(NamedModel):
self
.
save
()
def
valid_images
(
self
):
return
self
.
image_set
.
filter
(
created__isnull
=
False
,
target__active
=
True
).
order_by
(
'target__name'
)
images
=
self
.
image_set
.
filter
(
created__isnull
=
False
,
target__active
=
True
).
order_by
(
'target__name'
)
valid
=
[]
for
image
in
images
:
target
=
image
.
target
.
name
py3
=
image
.
py3
debug
=
image
.
debug
if
(
target
,
py3
,
debug
)
in
(
(
'18.04'
,
True
,
False
),
# 18.04 / python 3 / Release
(
'16.04'
,
True
,
False
),
# 16.04 / python 3 / Release
(
'20.04'
,
True
,
False
),
# 20.04 / python 3 / Release
(
'18.04'
,
False
,
False
),
# 18.04 / python 2 / Release and 18.04 / no python / Release
(
'18.04'
,
True
,
True
),
# 18.04 / python 3 / Debug
):
print
(
target
,
py3
,
debug
)
valid
.
append
(
image
)
return
valid
def
without_py
(
self
):
if
'py-'
in
self
.
name
and
self
.
same_py
:
...
...
@@ -826,7 +841,12 @@ class Image(models.Model):
unique_together
=
(
'robotpkg'
,
'target'
,
'py3'
,
'debug'
)
def
__str__
(
self
):
py
=
'-py3'
if
self
.
py3
else
''
if
self
.
py3
:
py
=
'-py3'
elif
self
.
robotpkg
.
name
.
startswith
(
'py-'
):
py
=
'-py2'
else
:
py
=
''
return
f
'
{
self
.
robotpkg
}{
py
}
:
{
self
.
target
}
'
def
get_build_args
(
self
):
...
...
@@ -878,11 +898,17 @@ class Image(models.Model):
},
auth
=
(
'gsaurel'
,
self
.
robotpkg
.
project
.
main_forge
.
token
)).
json
()[
'token'
]
headers
[
'Authorization'
]
=
f
'Bearer
{
token
}
'
r
=
requests
.
get
(
self
.
get_image_url
(),
headers
=
headers
)
if
r
.
status_code
==
200
:
self
.
image
=
r
.
json
()[
'fsLayers'
][
0
][
'blobSum'
].
split
(
':'
)[
1
][:
12
]
self
.
created
=
parse_datetime
(
json
.
loads
(
r
.
json
()[
'history'
][
0
][
'v1Compatibility'
])[
'created'
])
self
.
save
()
url
=
self
.
get_image_url
()
# r = requests.get(self.get_image_url(), headers=headers)
# if r.status_code == 200:
# self.image = r.json()['fsLayers'][0]['blobSum'].split(':')[1][:12]
# self.created = parse_datetime(json.loads(r.json()['history'][0]['v1Compatibility'])['created'])
# self.save()
self
.
image
=
'7db86b55ec14'
self
.
created
=
parse_datetime
(
'2020-07-20T04:27:31.857218193+02:00'
)
self
.
save
()
if
not
self
.
allow_failure
and
self
.
created
and
(
timezone
.
now
()
-
self
.
created
).
days
>
7
:
self
.
allow_failure
=
True
self
.
save
()
...
...
@@ -896,7 +922,7 @@ class CIBuild(models.Model):
branch
=
models
.
ForeignKey
(
Branch
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
ordering
=
(
'-started'
,
)
ordering
=
(
'-started'
,)
def
url
(
self
):
if
self
.
repo
.
forge
.
source
==
SOURCES
.
github
:
...
...
@@ -913,7 +939,7 @@ class CIJob(models.Model):
branch
=
models
.
ForeignKey
(
Branch
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
ordering
=
(
'-started'
,
)
ordering
=
(
'-started'
,)
class
Tag
(
models
.
Model
):
...
...
@@ -922,7 +948,7 @@ class Tag(models.Model):
project
=
models
.
ForeignKey
(
Project
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
ordering
=
(
'name'
,
)
ordering
=
(
'name'
,)
unique_together
=
(
'name'
,
'project'
)
def
__str__
(
self
):
...
...
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