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 (9)
......@@ -61,6 +61,28 @@ build:echo:
- printenv
- echo "Build successful"
build:check-foo-branch:
stage: build
extends:
- .buildbase
needs: []
tags:
- infrastructure
timeout: 2m
variables:
GIT_STRATEGY: none
before_script:
- !reference [.docker_check]
- !reference [.setup_ssh]
- !reference [.repo_checkout]
script: |
echo "repo branch: $MASTER_BRANCH"
echo "foo branch: $(cat foo/branch.txt)"
if [[ "$MASTER_BRANCH" != $(cat foo/branch.txt) ]]; then
echo "ERROR: Branches do not match!"
exit 1
fi
build-imx6guf-fake:
stage: build
needs: []
......
File moved
......@@ -127,5 +127,4 @@ check:
--integration-base=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH}
--merge-request=${MERGE_REQUEST}
--verbose
${PARENT_MR}
......@@ -35,10 +35,14 @@ generate:
# to explicitly pass any of them as command line arguments.
{% for integration in INTEGRATION.split('\n') %}
{% set SOURCE_BRANCH, TARGET_PROJECT, TARGET_BRANCH = integration.split(':') %}
{% if (CI_MERGE_REQUEST_TARGET_BRANCH_NAME is defined
and SOURCE_BRANCH == CI_MERGE_REQUEST_TARGET_BRANCH_NAME)
or SOURCE_BRANCH == CI_COMMIT_REF_NAME %}
- TARGET_PROJECT={{ TARGET_PROJECT }}
.gitlab-ci/scripts/generate_job_from_template.py
--template=.gitlab-ci/manifest-integration-jobs.yml.jinja2
> manifest-integration-jobs-{{ loop.index }}.yml
{% endif %}
{% endfor %}
artifacts:
expire_in: 4 weeks
......@@ -50,6 +54,9 @@ generate:
# --------------------------------------------------------------------------------------
{% for integration in INTEGRATION.split('\n') %}
{% set SOURCE_BRANCH, TARGET_PROJECT, TARGET_BRANCH = integration.split(':') %}
{% if (CI_MERGE_REQUEST_TARGET_BRANCH_NAME is defined
and SOURCE_BRANCH == CI_MERGE_REQUEST_TARGET_BRANCH_NAME)
or SOURCE_BRANCH == CI_COMMIT_REF_NAME %}
{{ TARGET_PROJECT }}:{{ TARGET_BRANCH }}:
stage: infrastructure
......@@ -72,4 +79,5 @@ generate:
job: generate
strategy: depend
{% endif %}
{% endfor %}
......@@ -19,7 +19,7 @@ variables:
BUILD_TIMEOUT: 2m
# This is the jinja2 template file used to generate the build jobs
BUILD_JOBS_TEMPLATE: build-jobs-ci-test.jinja2
BUILD_JOBS_TEMPLATE: build-jobs-ci-test.yml.jinja2
# 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.
......
......@@ -19,7 +19,7 @@ variables:
BUILD_TIMEOUT: 1h
# This is the jinja2 template file used to generate the build jobs
BUILD_JOBS_TEMPLATE: build-jobs-yocto.jinja2
BUILD_JOBS_TEMPLATE: build-jobs-yocto.yml.jinja2
generate-build-jobs:
variables:
......
......@@ -202,19 +202,23 @@ def main():
# Create integration branches and commits with updates
# submodule in all projects
# =======================================================
integration_sources = []
integration_sources = {}
all_integration_sources = []
for manifest_branch in manifest_branches:
print(
"Searching for projects in %s that are configured for automatic integration into %s:%s"
% (args.group, args.manifest_project, manifest_branch)
)
for s in get_integration_sources(args.manifest_project, manifest_branch, group):
if s not in integration_sources:
integration_sources.append(s)
integration_sources[manifest_branch] = get_integration_sources(
args.manifest_project, manifest_branch, group
)
for s in integration_sources[manifest_branch]:
if s not in all_integration_sources:
all_integration_sources.append(s)
# Update submodule in all integration sources
project_integrations = []
for s in integration_sources:
for s in all_integration_sources:
print("Create integration commit in %s:%s" % (s["project"], s["branch"]))
integration = integrate_submodule_into(
......@@ -317,42 +321,51 @@ def main():
logging.debug(srcrev)
for project_integration in project_integrations:
logging.debug(
"Update %s to %s",
project_integration["project"].name,
project_integration["commit"],
)
new_manifest = update_manifest(
manifest, project_integration["project"], project_integration["commit"]
)
if new_manifest is not None:
manifest = new_manifest
logging.debug(manifest)
continue
# get BB_RECIPE_NAME from the projects .gitlab-ci.yml
# Use direct read from gitlab as we have not checked out
# the repo if the branch is already up to date
gitlab_ci_yml = common.get_repository_file_raw(
project_integration["project"],
".gitlab-ci.yml",
ref=project_integration["integration_branch"],
)
project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml)
new_srcrev = update_srcrev(
srcrev, project_keys["recipe"], project_integration["commit"]
)
if new_srcrev is not None:
srcrev = new_srcrev
logging.debug(srcrev)
else:
logging.debug(
"Project %s not found in xml or srcrev file",
project_integration["project"],
)
# Check if project integration belongs to this manifest branch
for source in integration_sources[manifest_integration["master_branch"]]:
if (
source["project"]
== project_integration["project"].path_with_namespace
and source["branch"] == project_integration["master_branch"]
):
logging.debug(
"Update %s to %s",
project_integration["project"].name,
project_integration["commit"],
)
new_manifest = update_manifest(
manifest,
project_integration["project"],
project_integration["commit"],
)
if new_manifest is not None:
manifest = new_manifest
logging.debug(manifest)
continue
# get BB_RECIPE_NAME from the projects .gitlab-ci.yml
# Use direct read from gitlab as we have not checked out
# the repo if the branch is already up to date
gitlab_ci_yml = common.get_repository_file_raw(
project_integration["project"],
".gitlab-ci.yml",
ref=project_integration["integration_branch"],
)
project_keys = read_keys_from_gitlab_ci_yml(gitlab_ci_yml)
new_srcrev = update_srcrev(
srcrev, project_keys["recipe"], project_integration["commit"]
)
if new_srcrev is not None:
srcrev = new_srcrev
logging.debug(srcrev)
else:
logging.debug(
"Project %s not found in xml or srcrev file",
project_integration["project"],
)
# Write manifest
with open(manifest_file_abs, "w", encoding="utf8") as fp:
......
......@@ -84,17 +84,18 @@ def main():
retry_transient_errors=True,
)
try:
states = ["success", "running"]
jobs = retrigger_pipeline_jobs(
project,
pipeline,
args.job,
["success", "running"],
states,
include_children=True,
)
if not jobs:
print(
"Could not find any jobs named '%s' in %s"
% (args.job, pipeline.web_url)
"Could not find any jobs named '%s' with states %s in %s"
% (args.job, states, pipeline.web_url)
)
except GitlabJobRetryError as e:
print(
......
......@@ -20,7 +20,10 @@ def retrigger_pipeline_jobs(
# Recurse to child pipelines
if include_children:
for bridge in pipeline.bridges.list():
if bridge.downstream_pipeline["project_id"] == project.id:
if (
bridge is not None
and bridge.downstream_pipeline["project_id"] == project.id
):
child_pipeline = project.pipelines.get(
bridge.downstream_pipeline["id"],
retry_transient_errors=True,
......