Skip to content
Snippets Groups Projects
Commit 897ba059 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Manifest integration: remove dynamic job generation

The dynamic job was only necessary because GitLab did not expand
variables in the "trigger:project" keyword:
https://gitlab.com/gitlab-org/gitlab/-/issues/347469

This has been fixed in GitLab 15.3, so we don't need it anymore:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92346
parent ea1f3bad
No related branches found
No related tags found
1 merge request!237Manifest integration: remove dynamic job generation
Pipeline #48641 passed with stage
in 18 minutes and 33 seconds
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
# Global # Global
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
include: include:
# FIXME: see FIXME comments in manifest-integration-pipelines.yml.jinja2 - project: '${CI_PROJECT_ROOT_NAMESPACE}/yocto/infrastructure/gitlab-ci'
# - project: '${CI_PROJECT_ROOT_NAMESPACE}/yocto/infrastructure/gitlab-ci' ref: ${GITLAB_CI_REVISION}
# ref: ${GITLAB_CI_REVISION}
- project: {{ CI_PROJECT_ROOT_NAMESPACE }}/yocto/infrastructure/gitlab-ci
ref: {{ GITLAB_CI_REVISION }}
file: common.yml file: common.yml
workflow: workflow:
...@@ -57,9 +54,7 @@ build: ...@@ -57,9 +54,7 @@ build:
when: never when: never
- if: $CI_MERGE_REQUEST_IID - if: $CI_MERGE_REQUEST_IID
trigger: trigger:
# FIXME: see FIXME comments in manifest-integration-pipelines.yml.jinja2 project: $TARGET_PROJECT
# project: $TARGET_PROJECT
project: {{ TARGET_PROJECT }}
branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/into/${TARGET_BRANCH}" branch: "integrate/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/into/${TARGET_BRANCH}"
strategy: depend strategy: depend
......
...@@ -14,42 +14,6 @@ workflow: ...@@ -14,42 +14,6 @@ workflow:
stages: stages:
- manifest-integration-pipelines - manifest-integration-pipelines
# --------------------------------------------------------------------------------------
# Generate job
# --------------------------------------------------------------------------------------
# Use one single job to generate multiple yaml files for the downstream pipelines.
# FIXME: This is only necessary due to a GitLab limitation:
# https://gitlab.com/gitlab-org/gitlab/-/issues/347469
# We work around this by generating manifest-integration-jobs.yml from a Jinja2 template
# and insert the trigger project via a Jinja2 variable.
# The issue is already fixed and will be released in GitLab 15.3:
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92346
# As soon as we update to this version, we can get rid of the generate job and convert
# the Jinja2 template to a simple YAML file.
generate:
extends:
- .infrastructure
stage: manifest-integration-pipelines
script:
# The job generation script implicitly passes the OS environment to the template, so
# that the template has access to all GitLab CI variables. Hence there is no need
# 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
paths:
- manifest-integration-jobs-*.yml
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
# Trigger jobs # Trigger jobs
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
...@@ -61,8 +25,6 @@ generate: ...@@ -61,8 +25,6 @@ generate:
{{ TARGET_PROJECT }}:{{ TARGET_BRANCH }}: {{ TARGET_PROJECT }}:{{ TARGET_BRANCH }}:
stage: manifest-integration-pipelines stage: manifest-integration-pipelines
needs:
- generate
variables: variables:
SOURCE_BRANCH: {{ SOURCE_BRANCH }} SOURCE_BRANCH: {{ SOURCE_BRANCH }}
TARGET_PROJECT: {{ TARGET_PROJECT }} TARGET_PROJECT: {{ TARGET_PROJECT }}
...@@ -72,12 +34,9 @@ generate: ...@@ -72,12 +34,9 @@ generate:
BB_RECIPE_NAME: {{ BB_RECIPE_NAME }} BB_RECIPE_NAME: {{ BB_RECIPE_NAME }}
trigger: trigger:
include: include:
# FIXME: Use these settings after switching from jinja2 to yaml (see above) project: '${CI_PROJECT_ROOT_NAMESPACE}/yocto/infrastructure/gitlab-ci'
# project: '${CI_PROJECT_ROOT_NAMESPACE}/yocto/infrastructure/gitlab-ci' ref: ${GITLAB_CI_REVISION}
# ref: ${GITLAB_CI_REVISION} file: manifest-integration-jobs.yml
# file: manifest-integration-jobs.yml
artifact: manifest-integration-jobs-{{ loop.index }}.yml
job: generate
strategy: depend strategy: depend
{% endif %} {% endif %}
......
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