mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: create a broken symlink in all server sources
As the --upgrade-paths options does not work as expected in Odoo, a symbolic link has to be created in odoo/addons/base/maintenance pointing to the migration scripts. The runbot uses Docker read-only volumes to access the sources that are shared between builds, preventing the creation of such a link. With this commit, a symbolic link is created right after the export of a commit only when the repo is a "server" repo. This link is broken outside of the Docker volumes but uses the mount points of the sources inside the container. Two ir.config_parameter's are used to enable and configure this feature: * runbot_migration_ln: the relative path where the link should be placed (typically odoo/addons/base/maintenance) * runbot_migration_repo_id: the id of the migration scripts repo, used to determine the name of the mount point inside the Docker container A change is also made in the "reverse dependcy build" to avoid the creation of a build in the migration repo for each push in its dependency. Simply set the no_build field on this migration repo.
This commit is contained in:
parent
8d20c2ce79
commit
5552c16102
@ -212,6 +212,14 @@ class runbot_repo(models.Model):
|
||||
if err:
|
||||
raise RunbotException("Archive %s failed. Did you force push the branch since build creation? (%s)" % (sha, err))
|
||||
|
||||
# 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.server_files:
|
||||
scripts_dir = self.env['runbot.repo'].browse(migration_repo_id)._get_repo_name_part()
|
||||
os.symlink('/data/build/%s' % scripts_dir, self._source_path(sha, ln_param))
|
||||
|
||||
# TODO get result and fallback on cleaing in case of problem
|
||||
return export_path
|
||||
|
||||
@ -368,7 +376,7 @@ class runbot_repo(models.Model):
|
||||
new_build = Build.create(build_info)
|
||||
# create a reverse dependency build if needed
|
||||
if branch.sticky:
|
||||
for rev_repo in self.search([('dependency_ids', 'in', self.id)]):
|
||||
for rev_repo in self.search([('dependency_ids', 'in', self.id), ('no_build', '=', False)]):
|
||||
# find the latest build with the same branch name
|
||||
latest_rev_build = Build.search([('build_type', '=', 'normal'), ('hidden', '=', 'False'), ('repo_id.id', '=', rev_repo.id), ('branch_id.branch_name', '=', branch.branch_name)], order='id desc', limit=1)
|
||||
if latest_rev_build:
|
||||
|
Loading…
Reference in New Issue
Block a user