Skip to content
Snippets Groups Projects
Commit 42fe227c authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

.gitlab-ci.yml: share rules among build, bundle, publish jobs

When looking at pipeline [1] we have realized that the newly introduced
bundle build and publishing jobs pose a problem for unrelated updates
of the tree, as depending on which exact files are modified by the
incoming pull request, the build jobs may not spawn, causing a
dependency error on the bundle and publishing jobs.

When initially introduced, it was overlooked that the jobs both have a
dependency on one another (build->bundle->publish) *and* come with a
distinct set of rules that govern if a specific job is created in a
given pipeline.

To resolve the problem move the rules to a new dot-job, called
.workspace-rules, and inject the dependency on .workspace-rules to all
the jobs that share the dependency chain.

[1] https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/pipelines/4285



Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent 9ce56263
No related branches found
No related tags found
1 merge request!115.gitlab-ci.yml: share rules among build, bundle, publish jobs
...@@ -46,13 +46,17 @@ aggregate-docs: ...@@ -46,13 +46,17 @@ aggregate-docs:
variables: variables:
CI_ONIRO_GIT_REPO_PATH: oniro CI_ONIRO_GIT_REPO_PATH: oniro
# Customize the .bitbake-workspace job to set the rules governing when a build # Anchor job rules, which govern if a job is instantiated in a given pipeline.
# is attempted to: modifications (changes) to the pipeline, meta-layers, # This job is then used as another base to several different jobs, including
# flavours and assets OR to placement of a tag on a commit OR when a job is # .bitbake-workspace, .build-rauc-bundle and the
# scheduled. In addition, draft merge requests will no longer start the heavy # .publish-rauc-bundle-to-hawkbit jobs.
# build jobs automatically, giving an option to the developer, to start the #
# desired jobs manually. # The rules are: modifications (changes) to the pipeline, meta-layers, flavours
.bitbake-workspace: # and assets OR to placement of a tag on a commit OR when a job is scheduled.
# In addition, draft merge requests will no longer start the heavy build jobs
# automatically, giving an option to the developer, to start the desired jobs
# manually.
.workspace-rules:
rules: rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"' - if: '$CI_PIPELINE_SOURCE == "schedule"'
variables: variables:
...@@ -82,6 +86,30 @@ aggregate-docs: ...@@ -82,6 +86,30 @@ aggregate-docs:
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
# XXX: This needs CI_ONIRO_MANIFEST_BRANCH as well, most likely. # XXX: This needs CI_ONIRO_MANIFEST_BRANCH as well, most likely.
# The three jobs defined below override the definitions from build-generic.yaml
# to inject .workspace-rules and the rules defined therein. It is important to
# understand that this is based on several separate systems: parsing and
# loading yaml, processing the include rules, and processing extends rules.
#
# This specific trick (ab)uses the fact that yaml-top-level is one big map of
# entities, and we can define an entity multiple times to effectively extend or
# replace specific elements.
#
# The following three jobs are equivalent to copy-pasting the modified extends
# line into the jobs in .oniro-ci/build-generic.yaml, because map/dictionary
# entries compute the union of the defined keys, unlike list entries or scalars
# that replace the previous value.
.bitbake-workspace:
extends: [.workspace, .workspace-rules]
.build-rauc-bundle:
extends: [.build-image, .workspace-rules]
.publish-rauc-bundle-to-hawkbit:
extends: [.workspace-rules]
# Build a RAUC update bundle for Raspberry Pi 4 # Build a RAUC update bundle for Raspberry Pi 4
bundle-raspberrypi4-64: bundle-raspberrypi4-64:
extends: .build-rauc-bundle extends: .build-rauc-bundle
......
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