Skip to content
Snippets Groups Projects
Commit fda1d69e authored by Lorenzo Pagliai's avatar Lorenzo Pagliai
Browse files

[CHANGELOG] Modify script to accept project list

* Instead of hardcoding the gitlab repository ID the script accepts a
list of which the manifest project it the first element
* Introduce CHANGELOG_PROJECTS variable containing the list of projects
parent 91939ce2
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,14 @@ variables:
GIT_SSL_NO_VERIFY: 1
FS_EXTENSION: rootfs.tar.bz2
IMAGE_EXTENSION: wic.bz2
CHANGELOG_PROJECTS:
edgehog/layers/seco/meta-seco-imx
edgehog/layers/seco/meta-seco-rk
edgehog/layers/seco/meta-seco-intel
edgehog/layers/seco/meta-seco-edgehog-things
edgehog/layers/seco/meta-seco-edgehog-embedded
edgehog/layers/external/poky
edgehog/layers/external/linux-imx
# This is the jinja2 template file used to generate the build jobs
......@@ -335,9 +343,16 @@ changelog:
allow_failure: true
rules:
- *schedule_tag_rule
script: .gitlab-ci/scripts/changelog_generator.py
script:
- PROJECT_ARGS=""
- for project in ${CHANGELOG_PROJECTS}; do
PROJECT_ARGS="${PROJECT_ARGS} --project=$project";
done
- .gitlab-ci./scripts/changelog_generator.py
--token=${GITBOT_TOKEN}
--branch=${MASTER_BRANCH}
--project=${CI_PROJECT_PATH}
${PROJECT_ARGS}
> changelog.md
artifacts:
expire_in: 4 weeks
......
......@@ -18,24 +18,15 @@ import argparse
import datetime
import logging
import sys
import gitlab as gl
import common
__author__ = "Jonas Höppner"
__email__ = "jonas.hoeppner@garz-fricke.com"
GITLAB_SERVER = "https://git.seco.com"
# ID of the Edgehog yocto group
GITLAB_GROUP_ID = "479"
# List of main repositories to collect changelog
THINGS_PROJECT_ID = "1460"
EMBEDDED_PROJECT_ID = "2449"
IMX_PROJECT_ID = "1457"
RK_PROJECT_ID = "1458"
INTEL_PROJECT_ID = "2109"
MANIFEST_PROJECT_ID = "1456"
DEFAULTBRANCH = "kirkstone"
GITLAB_TIMEFORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
TIMEFORMAT = "%Y-%m-%d %H:%M"
......@@ -147,9 +138,10 @@ class Release:
# Ignore automated merge requests
if m.mr.author["username"] == "gitbot":
return False
# Exclude also MRs opened by a temporary access token
# from Lorenzo Pagliai
if m.mr.author["username"] == "lorenzo.pagliai":
# Exclude MRs containing CICD reference in the title
if "CICD" in m.mr.title:
return False
if "CI/CD" in m.mr.title:
return False
# With the movement to git.seco.com the MRs owned by
# the guf-gitbot have been transfered to tobias
......@@ -211,8 +203,7 @@ def main(args):
"--gitlab-url",
help="""URL to the GitLab instance""",
dest="gitlab_url",
action="store",
default=GITLAB_SERVER,
default=common.GITLAB_URL,
)
parser.add_argument(
"--token",
......@@ -220,13 +211,20 @@ def main(args):
dest="token",
required=True,
)
parser.add_argument(
"--project",
help="""Project to get merge requests from
(can be passed multiple times, tags are read from the first one)""",
dest="project",
action="append",
required=True,
)
parser.add_argument(
"-b",
"--branch",
action="store",
help="""Branch to work on""",
dest="branch",
default=DEFAULTBRANCH,
help=("Specify the branch to work on, default is dunfell."),
required=True,
)
parser.add_argument(
......@@ -245,17 +243,12 @@ def main(args):
logging.debug(options)
gitlab = gl.Gitlab(options.gitlab_url, private_token=options.token)
# Speed up, complete project lookup takes much longer
# then specifying the ID directly
things = Project(gitlab.projects.get(THINGS_PROJECT_ID))
embedded = Project(gitlab.projects.get(EMBEDDED_PROJECT_ID))
imx = Project(gitlab.projects.get(IMX_PROJECT_ID))
rk = Project(gitlab.projects.get(RK_PROJECT_ID))
intel = Project(gitlab.projects.get(INTEL_PROJECT_ID))
manifest = Project(gitlab.projects.get(MANIFEST_PROJECT_ID))
projects = []
for project in options.project:
projects.append(Project(gitlab.projects.get(project)))
releases = []
for t in manifest.project.tags.list():
for t in projects[0].project.tags.list(): #search=options.branch
releases.append(Release(Tag(t)))
# Add dummy release with date today for new untaged commits
......@@ -263,7 +256,7 @@ def main(args):
Release(
DummyTag(
"Not yet released",
"Merged Request already merged into "
"Merge Request already merged into "
+ options.branch
+ " but not yet released.",
)
......@@ -273,7 +266,7 @@ def main(args):
# Sort by date, oldest first
releases = sorted(releases, key=lambda d: d.tag.timestamp, reverse=False)
for p in [manifest, things, embedded, imx, rk, intel]:
for p in projects:
for mr in p.project.mergerequests.list(
scope="all", state="merged", target_branch=options.branch, per_page="10000"
):
......
......@@ -12,7 +12,7 @@ from gitlab import GitlabAuthenticationError, GitlabGetError, GitlabMRRebaseErro
from gitlab.v4.objects import Project
from gitlab.v4.objects import MergeRequest
GITLAB_URL = "https://git.seco.com"
manifest_file = "default.xml"
srcrev_file = "SRCREV.conf"
pending_states = ["created", "waiting_for_resource", "preparing", "pending", "running"]
......
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