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 (2)
  • Jonas Höppner's avatar
    Changelog-generator: Add parameter to include all integrated projects · 03af7519
    Jonas Höppner authored
    Before this, the changelog was generated on a given list of projects,
    all using the same branch.
    The new parameter now goes the the specified projects from the
    parameters, and detects all integrated projects into this.
    So normally you would specify one or two manifest projects, everything
    else is automatically added to the list.
    
    This also handles different branch names. As for example the kernel
    branches are different, the integration branch is used instead of the
    branch from the command line.
    03af7519
  • Jonas Höppner's avatar
    Changelog: Include all related projects into the changelog · 3eeebfdc
    Jonas Höppner authored
    In build-pipeline.yml, enable the new parameter by default.
    
    YT-256
    3eeebfdc
...@@ -239,6 +239,7 @@ workflow: ...@@ -239,6 +239,7 @@ workflow:
- .gitlab-ci/scripts/changelog_generator.py - .gitlab-ci/scripts/changelog_generator.py
--token=${GITBOT_TOKEN} --token=${GITBOT_TOKEN}
--branch=${MASTER_BRANCH} --branch=${MASTER_BRANCH}
--all-projects
--project=${CI_PROJECT_PATH} --project=${CI_PROJECT_PATH}
${PROJECT_ARGS} ${PROJECT_ARGS}
> changelog.md > changelog.md
......
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Simple changelog generator for Garz&Fricke gitlab projects. Simple changelog generator for Garz&Fricke gitlab projects.
...@@ -22,6 +22,7 @@ import sys ...@@ -22,6 +22,7 @@ import sys
import gitlab as gl import gitlab as gl
import common import common
from get_integration_sources import get_integration_sources
__author__ = "Jonas Höppner" __author__ = "Jonas Höppner"
__email__ = "jonas.hoeppner@garz-fricke.com" __email__ = "jonas.hoeppner@garz-fricke.com"
...@@ -58,7 +59,7 @@ class Tag: ...@@ -58,7 +59,7 @@ class Tag:
self.message = tag.message self.message = tag.message
self.commit = tag.commit self.commit = tag.commit
""" """
The tags timestamp is a little more complicated it normally points The tags timestamp is a little more complicated it normally points
to the tagged commit's timestamps. But the merge happens later. to the tagged commit's timestamps. But the merge happens later.
To handle this, the relelated mergerequest is found by comparing the To handle this, the relelated mergerequest is found by comparing the
sha's and also take the merged_at timestamp. sha's and also take the merged_at timestamp.
...@@ -182,7 +183,6 @@ class MergeRequest: ...@@ -182,7 +183,6 @@ class MergeRequest:
def main(args): def main(args):
parser = argparse.ArgumentParser(description=__doc__, usage="%(prog)s [OPTIONS]") parser = argparse.ArgumentParser(description=__doc__, usage="%(prog)s [OPTIONS]")
parser.add_argument( parser.add_argument(
...@@ -213,6 +213,15 @@ def main(args): ...@@ -213,6 +213,15 @@ def main(args):
required=True, required=True,
) )
parser.add_argument(
"-a",
"--all-projects",
help="""Parse all projects integrated into the listed ones""",
action="store_true",
default=False,
required=False,
)
parser.add_argument( parser.add_argument(
"-v", "-v",
"--verbose", "--verbose",
...@@ -229,10 +238,41 @@ def main(args): ...@@ -229,10 +238,41 @@ def main(args):
logging.debug(options) logging.debug(options)
gitlab = gl.Gitlab(options.gitlab_url, private_token=options.token) gitlab = gl.Gitlab(options.gitlab_url, private_token=options.token)
projects = [Project(gitlab.projects.get(project)) for project in options.project] project_list = {}
manifest_project = options.project[0]
if not options.all_projects:
# Old behaviour: Just a list of all projects from the commandline,
# only one branch name
for project in options.project:
project_list[project] = {"branch": options.branch}
else:
# New behaviour: Go through the project list from the parameters
# and check for all integrated projects
groupname = options.project[0].split("/")[0]
group = gitlab.groups.get(groupname, retry_transient_errors=True)
for project in options.project:
project_list[project] = {"branch": options.branch}
integration_sources = get_integration_sources(
project, options.branch, group
)
for source in integration_sources:
project_list[source["project"]] = {"branch": source["branch"]}
if options.verbose:
print("Projects included in the report:")
for p, b in project_list.items():
print(f" {p} - {b['branch']}")
for p in project_list.keys():
gl_project = Project(gitlab.projects.get(p))
project_list[p]["gitlab"] = gl_project
releases = [ releases = [
Release(Tag(t)) Release(Tag(t))
for t in projects[0].project.tags.list(search=options.branch, as_list=False) for t in project_list[manifest_project]["gitlab"].project.tags.list(
search=project_list[manifest_project]["branch"], as_list=False
)
] ]
# Add dummy release with date today for new unstaged commits # Add dummy release with date today for new unstaged commits
releases.append( releases.append(
...@@ -247,11 +287,11 @@ def main(args): ...@@ -247,11 +287,11 @@ def main(args):
# Sort by date, oldest first # Sort by date, oldest first
releases = sorted(releases, key=lambda d: d.tag.timestamp, reverse=False) releases = sorted(releases, key=lambda d: d.tag.timestamp, reverse=False)
for p in projects: for p in project_list.values():
for mr in p.project.mergerequests.list( for mr in p["gitlab"].project.mergerequests.list(
scope="all", state="merged", target_branch=options.branch, as_list=False scope="all", state="merged", target_branch=p["branch"], as_list=False
): ):
m = MergeRequest(mr, p) m = MergeRequest(mr, p["gitlab"])
for r in releases: for r in releases:
if r.add_mergerequest(m): if r.add_mergerequest(m):
break break
......