Skip to content
Snippets Groups Projects
Commit 3eef782e authored by Tim Jaacks's avatar Tim Jaacks
Browse files

deploy_gitlab_ci: integrate only correct projects into the manifest

Previously we integrated all projects into the manifest, even those that
belonged to a different manifest branch. That led to all manifests
having the same project revisions, even if they should be different due
to different intgrated project branches.

Save a list of integration sources for each manifest branch separately
now, so that we can check which project belongs to which manifest branch
later.
parent 2b851ac6
No related branches found
No related tags found
1 merge request!201deploy_gitlab_ci: integrate only correct projects into the manifest
Pipeline #28791 waiting for manual action with stages
in 20 minutes and 35 seconds
...@@ -202,19 +202,23 @@ def main(): ...@@ -202,19 +202,23 @@ def main():
# Create integration branches and commits with updates # Create integration branches and commits with updates
# submodule in all projects # submodule in all projects
# ======================================================= # =======================================================
integration_sources = [] integration_sources = {}
all_integration_sources = []
for manifest_branch in manifest_branches: for manifest_branch in manifest_branches:
print( print(
"Searching for projects in %s that are configured for automatic integration into %s:%s" "Searching for projects in %s that are configured for automatic integration into %s:%s"
% (args.group, args.manifest_project, manifest_branch) % (args.group, args.manifest_project, manifest_branch)
) )
for s in get_integration_sources(args.manifest_project, manifest_branch, group): integration_sources[manifest_branch] = get_integration_sources(
if s not in integration_sources: args.manifest_project, manifest_branch, group
integration_sources.append(s) )
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 # Update submodule in all integration sources
project_integrations = [] project_integrations = []
for s in integration_sources: for s in all_integration_sources:
print("Create integration commit in %s:%s" % (s["project"], s["branch"])) print("Create integration commit in %s:%s" % (s["project"], s["branch"]))
integration = integrate_submodule_into( integration = integrate_submodule_into(
...@@ -317,42 +321,51 @@ def main(): ...@@ -317,42 +321,51 @@ def main():
logging.debug(srcrev) logging.debug(srcrev)
for project_integration in project_integrations: for project_integration in project_integrations:
logging.debug( # Check if project integration belongs to this manifest branch
"Update %s to %s", for source in integration_sources[manifest_integration["master_branch"]]:
project_integration["project"].name, if (
project_integration["commit"], source["project"]
) == project_integration["project"].path_with_namespace
and source["branch"] == project_integration["master_branch"]
new_manifest = update_manifest( ):
manifest, project_integration["project"], project_integration["commit"] logging.debug(
) "Update %s to %s",
if new_manifest is not None: project_integration["project"].name,
manifest = new_manifest project_integration["commit"],
logging.debug(manifest) )
continue
new_manifest = update_manifest(
# get BB_RECIPE_NAME from the projects .gitlab-ci.yml manifest,
# Use direct read from gitlab as we have not checked out project_integration["project"],
# the repo if the branch is already up to date project_integration["commit"],
)
gitlab_ci_yml = common.get_repository_file_raw( if new_manifest is not None:
project_integration["project"], manifest = new_manifest
".gitlab-ci.yml", logging.debug(manifest)
ref=project_integration["integration_branch"], continue
)
project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml) # get BB_RECIPE_NAME from the projects .gitlab-ci.yml
# Use direct read from gitlab as we have not checked out
new_srcrev = update_srcrev( # the repo if the branch is already up to date
srcrev, project_keys["recipe"], project_integration["commit"]
) gitlab_ci_yml = common.get_repository_file_raw(
if new_srcrev is not None: project_integration["project"],
srcrev = new_srcrev ".gitlab-ci.yml",
logging.debug(srcrev) ref=project_integration["integration_branch"],
else: )
logging.debug( project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml)
"Project %s not found in xml or srcrev file",
project_integration["project"], 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 # Write manifest
with open(manifest_file_abs, "w", encoding="utf8") as fp: with open(manifest_file_abs, "w", encoding="utf8") as fp:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment