Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • seco-ne/yocto/infrastructure/gitlab-ci
1 result
Show changes
Commits on Source (1)
...@@ -116,6 +116,7 @@ yamllint: ...@@ -116,6 +116,7 @@ yamllint:
--manifest-project=${MANIFEST_PROJECT} --manifest-project=${MANIFEST_PROJECT}
--submodule=.gitlab-ci --submodule=.gitlab-ci
--revision=${CI_COMMIT_SHA} --revision=${CI_COMMIT_SHA}
--verbose
${MERGE} ${MERGE}
${INTEGRATE_INTO} ${INTEGRATE_INTO}
......
...@@ -53,7 +53,7 @@ def check_if_integration_branch_is_up_to_date( ...@@ -53,7 +53,7 @@ def check_if_integration_branch_is_up_to_date(
# Loop over the commits until the integration_branch head id is found # Loop over the commits until the integration_branch head id is found
return common.is_commit_parent_of_project_commit( return common.is_commit_parent_of_project_commit(
manifest_project, integration_branch.commit["id"], integration_base_id manifest_project, integration_branch.commit["id"], integration_base_id, limit=10
) )
......
...@@ -266,7 +266,9 @@ def get_repository_file_obj(project: Project, filename, ref=None): ...@@ -266,7 +266,9 @@ def get_repository_file_obj(project: Project, filename, ref=None):
return fileobj return fileobj
def is_commit_parent_of_project_commit(project: Project, project_commit, commit): def is_commit_parent_of_project_commit(
project: Project, project_commit, commit, limit=None
):
"""Walks through the commits of project, starting with project_commit """Walks through the commits of project, starting with project_commit
and compares its sha with the given commit. and compares its sha with the given commit.
Both commits are specified as sha Both commits are specified as sha
...@@ -280,7 +282,13 @@ def is_commit_parent_of_project_commit(project: Project, project_commit, commit) ...@@ -280,7 +282,13 @@ def is_commit_parent_of_project_commit(project: Project, project_commit, commit)
# Loop over the parent commits until commit is found # Loop over the parent commits until commit is found
parent_id = project_commit parent_id = project_commit
count = 0
while True: while True:
count = count + 1
if limit is not None and count >= limit:
logging.debug("Check %d commits and did not found a match.", count)
return False
try: try:
parent = project.commits.get(parent_id, retry_transient_errors=True) parent = project.commits.get(parent_id, retry_transient_errors=True)
except GitlabGetError as e: except GitlabGetError as e:
......
...@@ -185,7 +185,7 @@ def main(): ...@@ -185,7 +185,7 @@ def main():
project_integration = {} project_integration = {}
# Update submodule in all 'child' project # Update submodule in all 'child' project
for p in args.projects: for p in args.projects:
logging.debug("Integrate into: %s", p) print("Create integration commit is: %s", p)
res = integrate_submodule_into( res = integrate_submodule_into(
gitlab, p, args.submodule, args.revision, args.branch gitlab, p, args.submodule, args.revision, args.branch
...@@ -195,6 +195,7 @@ def main(): ...@@ -195,6 +195,7 @@ def main():
if res["commit"] is not None: if res["commit"] is not None:
project_integration[p] = res project_integration[p] = res
print("Create integration commit in: %s", args.project)
# Update submodule in manifest project # Update submodule in manifest project
manifest_project = integrate_submodule_into( manifest_project = integrate_submodule_into(
gitlab, gitlab,
......
...@@ -282,25 +282,40 @@ def update_submodule_and_include_ref( ...@@ -282,25 +282,40 @@ def update_submodule_and_include_ref(
pass pass
if existing_branch: if existing_branch:
( # Check if the integration branch is on top of the integration
_, # base or if it is outdated
integration_branch_submodule_rev, integration_base_branch = project.branches.get(branch)
) = get_submodule_project_path_and_revision( integration_base_id = integration_base_branch.commit["id"]
project, submodule_name, integration_branch_name logging.debug("Head of %s points to %s", branch, integration_base_id)
)
logging.debug( # Loop over the commits until the integration_branch head id is found
"Revision in integration branch '%s', new_revision '%s'", if not common.is_commit_parent_of_project_commit(
integration_branch_submodule_rev, project, existing_branch.commit["id"], integration_base_id, limit=5
new_revision, ):
) logging.debug("Integration branch is outdated, delete it.")
project.branches.delete(existing_branch.name)
if integration_branch_submodule_rev == new_revision: existing_branch = None
print( else:
"Submodule is already at %s on branch %s" # Check the submodule revision on the integration branch
% (new_revision, integration_branch_name) (
_,
integration_branch_submodule_rev,
) = get_submodule_project_path_and_revision(
project, submodule_name, integration_branch_name
) )
integration_commit = existing_branch.commit["id"] logging.debug(
submodule_update_needed = False "Revision in integration branch '%s', new_revision '%s'",
integration_branch_submodule_rev,
new_revision,
)
if integration_branch_submodule_rev == new_revision:
print(
"Submodule is already at %s on branch %s"
% (new_revision, integration_branch_name)
)
integration_commit = existing_branch.commit["id"]
submodule_update_needed = False
# Clone the project, we need to do changes # Clone the project, we need to do changes
if submodule_update_needed or force_clone: if submodule_update_needed or force_clone:
......