diff --git a/scripts/deploy_gitlab_ci.py b/scripts/deploy_gitlab_ci.py index 931a29b3f382a5d76846e7b71b8bffc357be05fd..daa1c7cfec71f76d5f9bec9be3375063532cf909 100755 --- a/scripts/deploy_gitlab_ci.py +++ b/scripts/deploy_gitlab_ci.py @@ -202,19 +202,23 @@ def main(): # Create integration branches and commits with updates # submodule in all projects # ======================================================= - integration_sources = [] + integration_sources = {} + all_integration_sources = [] for manifest_branch in manifest_branches: print( "Searching for projects in %s that are configured for automatic integration into %s:%s" % (args.group, args.manifest_project, manifest_branch) ) - for s in get_integration_sources(args.manifest_project, manifest_branch, group): - if s not in integration_sources: - integration_sources.append(s) + integration_sources[manifest_branch] = get_integration_sources( + args.manifest_project, manifest_branch, group + ) + for s in integration_sources[manifest_branch]: + if s not in all_integration_sources: + all_integration_sources.append(s) # Update submodule in all integration sources project_integrations = [] - for s in integration_sources: + for s in all_integration_sources: print("Create integration commit in %s:%s" % (s["project"], s["branch"])) integration = integrate_submodule_into( @@ -317,42 +321,51 @@ def main(): logging.debug(srcrev) for project_integration in project_integrations: - logging.debug( - "Update %s to %s", - project_integration["project"].name, - project_integration["commit"], - ) - - new_manifest = update_manifest( - manifest, project_integration["project"], project_integration["commit"] - ) - if new_manifest is not None: - manifest = new_manifest - logging.debug(manifest) - continue - - # get BB_RECIPE_NAME from the projects .gitlab-ci.yml - # Use direct read from gitlab as we have not checked out - # the repo if the branch is already up to date - - gitlab_ci_yml = common.get_repository_file_raw( - project_integration["project"], - ".gitlab-ci.yml", - ref=project_integration["integration_branch"], - ) - project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml) - - new_srcrev = update_srcrev( - srcrev, project_keys["recipe"], project_integration["commit"] - ) - if new_srcrev is not None: - srcrev = new_srcrev - logging.debug(srcrev) - else: - logging.debug( - "Project %s not found in xml or srcrev file", - project_integration["project"], - ) + # Check if project integration belongs to this manifest branch + for source in integration_sources[manifest_integration["master_branch"]]: + if ( + source["project"] + == project_integration["project"].path_with_namespace + and source["branch"] == project_integration["master_branch"] + ): + logging.debug( + "Update %s to %s", + project_integration["project"].name, + project_integration["commit"], + ) + + new_manifest = update_manifest( + manifest, + project_integration["project"], + project_integration["commit"], + ) + if new_manifest is not None: + manifest = new_manifest + logging.debug(manifest) + continue + + # get BB_RECIPE_NAME from the projects .gitlab-ci.yml + # Use direct read from gitlab as we have not checked out + # the repo if the branch is already up to date + + gitlab_ci_yml = common.get_repository_file_raw( + project_integration["project"], + ".gitlab-ci.yml", + ref=project_integration["integration_branch"], + ) + project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml) + + new_srcrev = update_srcrev( + srcrev, project_keys["recipe"], project_integration["commit"] + ) + if new_srcrev is not None: + srcrev = new_srcrev + logging.debug(srcrev) + else: + logging.debug( + "Project %s not found in xml or srcrev file", + project_integration["project"], + ) # Write manifest with open(manifest_file_abs, "w", encoding="utf8") as fp: