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)
......@@ -51,6 +51,27 @@ workflow:
- repo sync --detach --current-branch --force-remove-dirty
--optimized-fetch --force-sync
# --------------------------------------------------------------------------------------
# Stage: Infrastructure
# --------------------------------------------------------------------------------------
.changelog:
extends: .infrastructure
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
paths:
- "changelog.md"
# --------------------------------------------------------------------------------------
# Stage: build
# --------------------------------------------------------------------------------------
......
......@@ -12,6 +12,7 @@ include:
- common.yml
stages:
- Infrastructure
- Build
- Test
- Package
......@@ -19,6 +20,12 @@ stages:
- Deploy FTP
- Alphaplan
# --------------------------------------------------------------------------------------
# Stage: Infrastructure
# --------------------------------------------------------------------------------------
changelog:
extends: .changelog
# --------------------------------------------------------------------------------------
# Stage: Build
# --------------------------------------------------------------------------------------
......@@ -41,6 +48,7 @@ build:files:
- .buildbase
tags:
- infrastructure
needs: []
timeout: 2m
variables:
GIT_STRATEGY: none
......@@ -59,6 +67,7 @@ build:echo:
stage: Build
tags:
- infrastructure
needs: []
timeout: 2m
image: ${CI_IMAGE_PYTHON}
script:
......@@ -71,6 +80,7 @@ build:check-foo-branch:
- .buildbase
tags:
- infrastructure
needs: []
timeout: 2m
variables:
GIT_STRATEGY: none
......@@ -91,6 +101,7 @@ build:check-foo-branch:
- .buildbase
tags:
- misc
needs: []
timeout: 60m
variables:
BUILD_ARTIFACTS:
......
......@@ -37,15 +37,7 @@ variables:
# Stage: Infrastructure
# --------------------------------------------------------------------------------------
changelog:
extends: .infrastructure
script: .gitlab-ci/scripts/changelog_generator.py
--token=${GITBOT_TOKEN}
--branch=${MASTER_BRANCH}
> changelog.md
artifacts:
expire_in: 4 weeks
paths:
- "changelog.md"
extends: .changelog
# --------------------------------------------------------------------------------------
......
......@@ -24,3 +24,8 @@ variables:
# The master branch is hardcoded here, because it cannot be determined automatically.
# Has to be modified for new branches, e.g. new Yocto versions or fix releases.
MASTER_BRANCH: master
# Projects to include in the changelog in addition to the manifest project
CHANGELOG_PROJECTS:
seco-ne/yocto/infrastructure/ci-test/minimal-bar
seco-ne/yocto/infrastructure/ci-test/minimal-foo
......@@ -21,6 +21,11 @@ variables:
# This is the jinja2 template file used to generate the build jobs
BUILD_JOBS_TEMPLATE: build-jobs-yocto.yml.jinja2
# Projects to include in the changelog in addition to the manifest project
CHANGELOG_PROJECTS:
seco-ne/yocto/layers/meta-seconorth-distro
seco-ne/yocto/layers/meta-seconorth-machine
generate-build-jobs:
variables:
# Default image and distro
......
......@@ -21,18 +21,12 @@ 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 guf_yocto group
GITLAB_GROUP_ID = "556"
DISTRO_PROJECT_ID = "1748"
MACHINE_PROJECT_ID = "2074"
MANIFEST_PROJECT_ID = "1725"
DEFAULTBRANCH = "dunfell"
GITLAB_TIMEFORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
TIMEFORMAT = "%Y-%m-%d %H:%M"
......@@ -206,8 +200,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",
......@@ -215,13 +208,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(
......@@ -240,22 +240,20 @@ 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
distro = Project(gitlab.projects.get(DISTRO_PROJECT_ID))
machine = Project(gitlab.projects.get(MACHINE_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(search=options.branch):
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
# Add dummy release with date today for new unstaged commits
releases.append(
Release(
DummyTag(
"Not yet released",
"Merged Request already merged into "
"Merge Requests already merged into "
+ options.branch
+ " but not yet released.",
)
......@@ -265,7 +263,7 @@ def main(args):
# Sort by date, oldest first
releases = sorted(releases, key=lambda d: d.tag.timestamp, reverse=False)
for p in [manifest, distro, machine]:
for p in projects:
for mr in p.project.mergerequests.list(
scope="all", state="merged", target_branch=options.branch, all=True
):
......