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 (4)
#---------------------------------------------------------------------------------------
# Global
#---------------------------------------------------------------------------------------
image: "registry.gitlab.com/garz-fricke/yocto/infrastructure/ci-images/python/3.8:\
82661251e22d9651a3e5b17e56f41a2266339f29"
variables:
CI_IMAGES_BASEPATH: registry.gitlab.com/garz-fricke/yocto/infrastructure
CI_IMAGES_PATH: ${CI_IMAGES_BASEPATH}/ci-images
CI_IMAGES_REVISION: 1fc5f61d3d8338f900a19e34a448a577e513a90c
CI_IMAGE_PYTHON: "${CI_IMAGES_PATH}/python/3.8:${CI_IMAGES_REVISION}"
CI_IMAGE_YOCTO: "${CI_IMAGES_PATH}/yocto-build/ubuntu-20.04:${CI_IMAGES_REVISION}"
image: "${CI_IMAGE_PYTHON}"
default:
tags:
......@@ -26,6 +33,10 @@ pylint:
script:
- pylint --rcfile=pylintrc *.py
pylint-yocto:
extends: pylint
image: "${CI_IMAGE_YOCTO}"
black:
stage: analyze
timeout: 2m
......
......@@ -9,13 +9,29 @@ from gitlab import Gitlab, GitlabGetError
from gitlab.v4.objects import Project
def check_pipeline_status(project: Project, commit):
"""Get latest pipeline status for a given commit"""
def check_pipeline_status(project: Project, commit, ref: str):
"""
Get latest pipeline status for a given commit and ref.
The ref can be negated with a preceding '^', e.g. '^master' finds a pipeline on any
ref different from 'master'.
"""
# Find pipeline for commit
pipelines = project.pipelines.list(sha=commit, retry_transient_errors=True)
# Remove pipelines not matching the ref condition
if ref:
for p in pipelines[:]:
if (
ref.startswith("^")
and p.ref == ref[1:]
or not ref.startswith("^")
and p.ref != ref
):
pipelines.remove(p)
if not pipelines:
print("ERROR: no pipeline for commit '%s' found" % commit)
print("ERROR: no pipeline for commit '%s' with ref '%s' found" % (commit, ref))
sys.exit(1)
pipeline = pipelines[0]
......@@ -58,13 +74,20 @@ def main():
dest="commit",
required=True,
)
parser.add_argument(
"--ref",
help="""ref the pipeline ran on (can be negated with preceding '^')""",
dest="ref",
default="",
required=False,
)
args, _ = parser.parse_known_args()
gitlab = Gitlab(args.gitlab_url, private_token=args.token)
project = common.get_project(gitlab, args.project)
status = check_pipeline_status(project, args.commit)
status = check_pipeline_status(project, args.commit, args.ref)
# If we are running in a job environment and the upstream status is canceled,
# explicitly cancel this job as well
......
......@@ -99,7 +99,13 @@ def main():
help="""Documentation directory""",
dest="doc_dir",
)
parser.add_argument(
"--generate-fwr-articles",
help="""Enable AlphaPlan FWR generation""",
dest="generate_fwr_articles",
action="store_true",
)
parser.set_defaults(generate_fwr_articles=False)
args, _ = parser.parse_known_args()
if args.outputdir_upload is None and args.outputdir_local is None:
......@@ -171,21 +177,16 @@ def main():
artifacts_all, args.images_dir, machine, output_dir, outlocal_dir
)
# Generate a json file for creating alphaplan FWR articles
if (
outlocal_dir is not None
and output_dir is not None
and "ftp" not in outlocal_dir
and "ftp" not in output_dir
):
alphaplan_fwr.generate_fwr_articles(
output_dir,
outlocal_dir,
machine,
release_name_local,
artifacts_all,
md5sums,
)
# Generate alphaplan FWR articles
if args.generate_fwr_articles:
alphaplan_fwr.generate_fwr_articles(
output_dir,
outlocal_dir,
machine,
release_name_local,
artifacts_all,
md5sums,
)
# Handle SDK if available
if args.sdk_dir is not None:
......