[IMP] runbot: use upgrade path

This commit will replace the symlink used for upgrade by the
upgrade-path.

The symlink was used before because old version does not support upgrade
path, but the decision was taken to now limit the testing to version
suporting upgrade paths in order to be able to support utils in another
repository latter.
This commit is contained in:
Xavier-Do 2023-09-15 09:27:28 +02:00 committed by Christophe Monniez
parent f50c099d93
commit 9923b18429
4 changed files with 5 additions and 12 deletions

View File

@ -725,7 +725,9 @@ class ConfigStep(models.Model):
migrate_cmd += ['-d', migrate_db_name]
migrate_cmd += ['--stop-after-init']
migrate_cmd += ['--max-cron-threads=0']
# migrate_cmd += ['--upgrades-paths', '/%s' % migration_scripts] upgrades-paths is broken, ln is created automatically in sources
migration_scripts = ','.join([repo.name + repo.upgrade_paths.replace(' ', '') for repo in target_commit_ids.mapped('repo_id') if repo.upgrade_paths])
if migration_scripts:
migrate_cmd += ['--upgrades-paths', migration_scripts]
build._log('run', 'Start migration build %s' % build.dest)
timeout = self.cpu_limit

View File

@ -104,17 +104,6 @@ class Commit(models.Model):
shutil.rmtree(export_path)
raise RunbotException("Apply patch failed for %s...%s with error code %s+%s. (%s)" % (export_sha, self.name, p1.returncode, p2.returncode, message))
# migration scripts link if necessary
icp = self.env['ir.config_parameter']
ln_param = icp.get_param('runbot_migration_ln', default='')
migration_repo_id = int(icp.get_param('runbot_migration_repo_id', default=0))
if ln_param and migration_repo_id and self.repo_id.server_files:
scripts_dir = self.env['runbot.repo'].browse(migration_repo_id).name
try:
os.symlink('/data/build/%s' % scripts_dir, self._source_path(ln_param))
except FileNotFoundError:
_logger.warning('Impossible to create migration symlink')
return export_path
def read_source(self, file, mode='r'):

View File

@ -284,6 +284,7 @@ class Repo(models.Model):
server_files = fields.Char('Server files', help='Comma separated list of possible server files', tracking=True) # odoo-bin,openerp-server,openerp-server.py
manifest_files = fields.Char('Manifest files', help='Comma separated list of possible manifest files', default='__manifest__.py', tracking=True)
addons_paths = fields.Char('Addons paths', help='Comma separated list of possible addons path', default='', tracking=True)
upgrade_paths = fields.Char('Upgrade paths', help='Comma separated list of possible upgrade path', default='', tracking=True)
sequence = fields.Integer('Sequence', tracking=True)
path = fields.Char(compute='_get_path', string='Directory', readonly=True)

View File

@ -116,6 +116,7 @@
<field name="server_files"/>
<field name="manifest_files"/>
<field name="addons_paths"/>
<field name="upgrade_paths"/>
</group>
<group colspan="4">
<field name="remote_ids">