Skip to content
Snippets Groups Projects
Commit 3c4a375b authored by Chase Qi's avatar Chase Qi
Browse files

.oniro-ci: allow build job to customize what artifacts it needs to deploy


Introduce variable CI_ONIRO_JOB_ARTIFACTS to allow build job to
customize what artifacts it needs to deploy.

Signed-off-by: default avatarChase Qi <chase.qi@linaro.org>
parent eb24f51f
No related branches found
No related tags found
No related merge requests found
...@@ -268,11 +268,14 @@ ...@@ -268,11 +268,14 @@
# This job is documented in docs/ci/hidden-jobs/build-image.rst # This job is documented in docs/ci/hidden-jobs/build-image.rst
.build-image: .build-image:
extends: .build-recipe extends: .build-recipe
variables:
CI_ONIRO_JOB_ARTIFACTS: ""
script: script:
- !reference [.build-recipe, script] - !reference [.build-recipe, script]
# Move artifacts for recovery, which only considers $CI_PROJECT_DIR and # Move artifacts for recovery, which only considers $CI_PROJECT_DIR and
# subdirectories. # subdirectories.
- mkdir -p "$CI_PROJECT_DIR"/artifacts - mkdir -p "$CI_PROJECT_DIR"/artifacts
- rm -rf "$CI_PROJECT_DIR"/artifacts/*
# The name of the build-specific tmp directory may vary. Ask bitbake # The name of the build-specific tmp directory may vary. Ask bitbake
# instead of hard-coding it. This is currently only relevant for Zephyr, # instead of hard-coding it. This is currently only relevant for Zephyr,
# which uses tmp-newlib. # which uses tmp-newlib.
...@@ -281,35 +284,37 @@ ...@@ -281,35 +284,37 @@
# meta-oniro-core/classes/oniro-image.bbclass as runqemu needs it for local # meta-oniro-core/classes/oniro-image.bbclass as runqemu needs it for local
# build and boot. # build and boot.
- find "$BITBAKE_TMPDIR"/deploy/images/ -name *.wic -exec rm -rf {} \; - find "$BITBAKE_TMPDIR"/deploy/images/ -name *.wic -exec rm -rf {} \;
- cp -a "$BITBAKE_TMPDIR"/deploy/images/ "$CI_PROJECT_DIR"/artifacts || true
- cp -a "$BITBAKE_TMPDIR"/deploy/licenses/ "$CI_PROJECT_DIR"/artifacts || true - cp -a "$BITBAKE_TMPDIR"/deploy/licenses/ "$CI_PROJECT_DIR"/artifacts || true
# Only copy the files defined in the CI_ONIRO_JOB_ARTIFACTS variable. Most
# of the remaining files are redundant and quite large.
- |
set -x
if test -n "$CI_ONIRO_JOB_ARTIFACTS" && test -d "$BITBAKE_TMPDIR"/deploy/; then
(
cd "$BITBAKE_TMPDIR"/deploy/
for artifact in $CI_ONIRO_JOB_ARTIFACTS; do
find ./ -type f -name "$artifact" -exec cp --parents {} "$CI_PROJECT_DIR"/artifacts \;
done
)
fi
set +x
artifacts: artifacts:
paths: paths:
- artifacts/ - artifacts/
.build-wic-image: .build-wic-image:
extends: .build-image extends: .build-image
variables:
CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap"
script: script:
- !reference [.build-image, script] - !reference [.build-image, script]
# Remove everything _except_ for the .wic.* and *.bmap and ovmf.qcow2 files.
# Most of the remaining files are redundant and quite large. Our Linux
# builds really only care about the wic files and the qemu UEFI firmware.
- echo "Removing non-wic/bmap image files"
- find "$CI_PROJECT_DIR"/artifacts/images/ \( -type f -o -type l \) -a ! \( -name "*.wic.*" -o -name "ovmf.qcow2" \) -print -delete
- echo "Pruning empty directories"
- find "$CI_PROJECT_DIR"/artifacts/ -type d -exec rmdir --verbose --ignore-fail-on-non-empty {} \; 2>/dev/null || true
.build-rauc-bundle: .build-rauc-bundle:
extends: .build-image extends: .build-image
variables:
CI_ONIRO_JOB_ARTIFACTS: "*.raucb"
script: script:
- !reference [.build-image, script] - !reference [.build-image, script]
# Remove everything _except_ for the .raucb.* files. The bundle is
# self-sufficient (aka standalone) and does not need any supporting
# infrastructure.
- echo "Removing non-bundle files"
- find "$CI_PROJECT_DIR"/artifacts/images/ \( -type f -o -type l \) -a ! -name "*.raucb" -print -delete
- echo "Pruning empty directories"
- find "$CI_PROJECT_DIR"/artifacts/ -type d -exec rmdir --verbose --ignore-fail-on-non-empty {} \; 2>/dev/null || true
# This job is currently used to customize the behavior in oniro and xts-acts. # This job is currently used to customize the behavior in oniro and xts-acts.
# It will be removed when that is safe to do so. It is not documented. # It will be removed when that is safe to do so. It is not documented.
......
...@@ -19,6 +19,7 @@ linux-qemu-x86: ...@@ -19,6 +19,7 @@ linux-qemu-x86:
# This is done assuming that there are no non-redistributable or otherwise # This is done assuming that there are no non-redistributable or otherwise
# tainted build intermediate files, downloads or published artifacts. # tainted build intermediate files, downloads or published artifacts.
CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1 CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap ovmf.qcow2"
linux-qemu-x86_64: linux-qemu-x86_64:
extends: .build-wic-image extends: .build-wic-image
...@@ -29,6 +30,7 @@ linux-qemu-x86_64: ...@@ -29,6 +30,7 @@ linux-qemu-x86_64:
# See the note on linux-qemu-x86. # See the note on linux-qemu-x86.
CI_ONIRO_BUILD_CACHE: "pub" CI_ONIRO_BUILD_CACHE: "pub"
CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1 CI_ONIRO_BB_LOCAL_CONF_BB_GENERATE_MIRROR_TARBALLS: 1
CI_ONIRO_JOB_ARTIFACTS: "*.wic.* *.bmap ovmf.qcow2"
linux-seco-intel-b68: linux-seco-intel-b68:
extends: .build-wic-image extends: .build-wic-image
......
...@@ -84,6 +84,16 @@ tested. ...@@ -84,6 +84,16 @@ tested.
This functionality is useful for testing incoming changes to repositories that This functionality is useful for testing incoming changes to repositories that
contain source code that is already packaged one of the layers. contain source code that is already packaged one of the layers.
CI_ONIRO_JOB_ARTIFACTS
----------------------
Most of the files generated in the ``tmp/deploy`` directory are redundant. Some
of them are quite large. By default, only the files in the
``tmp/deploy/licenses`` directory are published.
``CI_ONIRO_JOB_ARTIFACTS`` allows build job to define space-separated list of
build artifacts to publish. Wildcards are supported.
Configuring BitBake Configuring BitBake
=================== ===================
......
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