@@ -49,24 +49,25 @@ def make_selection(array):
49
49
class BuildParameters (models .Model ):
50
50
_name = 'runbot.build.params'
51
51
_description = "All information used by a build to run, should be unique and set on create only"
52
+ _inherit = ['runbot.public.model.mixin' ]
52
53
53
54
# on param or on build?
54
55
# execution parametter
55
56
commit_link_ids = fields .Many2many ('runbot.commit.link' , copy = True )
56
57
commit_ids = fields .Many2many ('runbot.commit' , compute = '_compute_commit_ids' )
57
58
version_id = fields .Many2one ('runbot.version' , required = True , index = True )
58
59
project_id = fields .Many2one ('runbot.project' , required = True , index = True ) # for access rights
59
- trigger_id = fields .Many2one ('runbot.trigger' , index = True ) # for access rights
60
- create_batch_id = fields .Many2one ('runbot.batch' , index = True )
61
- category = fields .Char ('Category' , index = True ) # normal vs nightly vs weekly, ...
60
+ trigger_id = fields .Many2one ('runbot.trigger' , index = True , public = True ) # for access rights
61
+ create_batch_id = fields .Many2one ('runbot.batch' , index = True , public = True )
62
+ category = fields .Char ('Category' , index = True , public = True ) # normal vs nightly vs weekly, ...
62
63
dockerfile_id = fields .Many2one ('runbot.dockerfile' , index = True , default = lambda self : self .env .ref ('runbot.docker_default' , raise_if_not_found = False ))
63
64
skip_requirements = fields .Boolean ('Skip requirements.txt auto install' )
64
65
# other informations
65
66
extra_params = fields .Char ('Extra cmd args' )
66
- config_id = fields .Many2one ('runbot.build.config' , 'Run Config' , required = True ,
67
+ config_id = fields .Many2one ('runbot.build.config' , 'Run Config' , required = True , public = True ,
67
68
default = lambda self : self .env .ref ('runbot.runbot_build_config_default' , raise_if_not_found = False ), index = True )
68
- config_data = JsonDictField ('Config Data' )
69
- used_custom_trigger = fields .Boolean ('Custom trigger was used to generate this build' )
69
+ config_data = JsonDictField ('Config Data' , public = True )
70
+ used_custom_trigger = fields .Boolean ('Custom trigger was used to generate this build' , public = True )
70
71
71
72
build_ids = fields .One2many ('runbot.build' , 'params_id' )
72
73
builds_reference_ids = fields .Many2many ('runbot.build' , relation = 'runbot_build_params_references' , copy = True )
@@ -84,6 +85,10 @@ class BuildParameters(models.Model):
84
85
('unique_fingerprint' , 'unique (fingerprint)' , 'avoid duplicate params' ),
85
86
]
86
87
88
+ @api .model
89
+ def _allow_direct_access (self ):
90
+ return False
91
+
87
92
# @api.depends('version_id', 'project_id', 'extra_params', 'config_id', 'config_data', 'modules', 'commit_link_ids', 'builds_reference_ids')
88
93
def _compute_fingerprint (self ):
89
94
for param in self :
@@ -141,6 +146,7 @@ class BuildResult(models.Model):
141
146
142
147
_name = 'runbot.build'
143
148
_description = "Build"
149
+ _inherit = ['runbot.public.model.mixin' ]
144
150
145
151
_parent_store = True
146
152
_order = 'id desc'
@@ -154,26 +160,26 @@ class BuildResult(models.Model):
154
160
no_auto_run = fields .Boolean ('No run' )
155
161
# could be a default value, but possible to change it to allow duplicate accros branches
156
162
157
- description = fields .Char ('Description' , help = 'Informative description' )
158
- md_description = fields .Html (compute = '_compute_md_description' , string = 'MD Parsed Description' , help = 'Informative description markdown parsed' , sanitize = False )
159
- display_name = fields .Char (compute = '_compute_display_name' )
163
+ description = fields .Char ('Description' , help = 'Informative description' , public = True )
164
+ md_description = fields .Html (compute = '_compute_md_description' , string = 'MD Parsed Description' , help = 'Informative description markdown parsed' , sanitize = False , public = True )
165
+ display_name = fields .Char (compute = '_compute_display_name' , public = True )
160
166
161
167
# Related fields for convenience
162
- version_id = fields .Many2one ('runbot.version' , related = 'params_id.version_id' , store = True , index = True )
163
- config_id = fields .Many2one ('runbot.build.config' , related = 'params_id.config_id' , store = True , index = True )
164
- trigger_id = fields .Many2one ('runbot.trigger' , related = 'params_id.trigger_id' , store = True , index = True )
165
- create_batch_id = fields .Many2one ('runbot.batch' , related = 'params_id.create_batch_id' , store = True , index = True )
168
+ version_id = fields .Many2one ('runbot.version' , related = 'params_id.version_id' , store = True , index = True , public = True )
169
+ config_id = fields .Many2one ('runbot.build.config' , related = 'params_id.config_id' , store = True , index = True , public = True )
170
+ trigger_id = fields .Many2one ('runbot.trigger' , related = 'params_id.trigger_id' , store = True , index = True , public = True )
171
+ create_batch_id = fields .Many2one ('runbot.batch' , related = 'params_id.create_batch_id' , store = True , index = True , public = True )
166
172
167
173
# state machine
168
- global_state = fields .Selection (make_selection (state_order ), string = 'Status' , compute = '_compute_global_state' , store = True , recursive = True )
169
- local_state = fields .Selection (make_selection (state_order ), string = 'Build Status' , default = 'pending' , required = True , index = True )
170
- global_result = fields .Selection (make_selection (result_order ), string = 'Result' , compute = '_compute_global_result' , store = True , recursive = True )
171
- local_result = fields .Selection (make_selection (result_order ), string = 'Build Result' , default = 'ok' )
174
+ global_state = fields .Selection (make_selection (state_order ), string = 'Status' , compute = '_compute_global_state' , store = True , recursive = True , public = True )
175
+ local_state = fields .Selection (make_selection (state_order ), string = 'Build Status' , default = 'pending' , required = True , index = True , public = True )
176
+ global_result = fields .Selection (make_selection (result_order ), string = 'Result' , compute = '_compute_global_result' , store = True , recursive = True , public = True )
177
+ local_result = fields .Selection (make_selection (result_order ), string = 'Build Result' , default = 'ok' , public = True )
172
178
173
- requested_action = fields .Selection ([('wake_up' , 'To wake up' ), ('deathrow' , 'To kill' )], string = 'Action requested' , index = True )
179
+ requested_action = fields .Selection ([('wake_up' , 'To wake up' ), ('deathrow' , 'To kill' )], string = 'Action requested' , index = True , public = True )
174
180
# web infos
175
- host = fields .Char ('Host name' )
176
- host_id = fields .Many2one ('runbot.host' , string = "Host" , compute = '_compute_host_id' )
181
+ host = fields .Char ('Host name' , public = True )
182
+ host_id = fields .Many2one ('runbot.host' , string = "Host" , compute = '_compute_host_id' , public = True )
177
183
keep_host = fields .Boolean ('Keep host on rebuild and for children' )
178
184
179
185
port = fields .Integer ('Port' )
@@ -183,7 +189,7 @@ class BuildResult(models.Model):
183
189
log_ids = fields .One2many ('ir.logging' , 'build_id' , string = 'Logs' )
184
190
error_log_ids = fields .One2many ('ir.logging' , 'build_id' , domain = [('level' , 'in' , ['WARNING' , 'ERROR' , 'CRITICAL' ])], string = 'Error Logs' )
185
191
stat_ids = fields .One2many ('runbot.build.stat' , 'build_id' , string = 'Statistics values' )
186
- log_list = fields .Char ('Comma separted list of step_ids names with logs' )
192
+ log_list = fields .Char ('Comma separted list of step_ids names with logs' , public = True )
187
193
188
194
active_step = fields .Many2one ('runbot.build.config.step' , 'Active step' )
189
195
job = fields .Char ('Active step display name' , compute = '_compute_job' )
@@ -234,13 +240,17 @@ class BuildResult(models.Model):
234
240
slot_ids = fields .One2many ('runbot.batch.slot' , 'build_id' )
235
241
killable = fields .Boolean ('Killable' )
236
242
237
- database_ids = fields .One2many ('runbot.database' , 'build_id' )
243
+ database_ids = fields .One2many ('runbot.database' , 'build_id' , public = True )
238
244
commit_export_ids = fields .One2many ('runbot.commit.export' , 'build_id' )
239
245
240
246
static_run = fields .Char ('Static run URL' )
241
247
242
248
access_token = fields .Char ('Token' , default = lambda self : uuid .uuid4 ().hex )
243
249
250
+ @api .model
251
+ def _project_id_field_path (self ):
252
+ return 'params_id.project_id'
253
+
244
254
@api .depends ('description' , 'params_id.config_id' )
245
255
def _compute_display_name (self ):
246
256
for build in self :
0 commit comments