From bf0d88eef418426f5a4f84008bb4429bcec348e9 Mon Sep 17 00:00:00 2001 From: Lorenzo Pagliai <lorenzo.pagliai@seco.com> Date: Tue, 4 Apr 2023 12:42:06 +0200 Subject: [PATCH] [CHECK] Insert script to check artifacts presence * The script search for all type of artifacts (uboot, kernel, fs, image files) and exit with an error in case something is missing * This prevent to have build jobs that succed even though not all artifacts were produced --- boards/.a62.yml | 4 +- boards/.c12.yml | 4 +- boards/.c20.yml | 4 +- boards/.c26.yml | 4 +- boards/.c31.yml | 4 +- boards/.c43.yml | 4 +- boards/.intel_apl.yml | 4 +- boards/.tanaro.yml | 4 +- manifest-pipeline-yocto.yml | 3 +- scripts/check_build_artifacts.sh | 75 ++++++++++++++++++++++++++++++++ 10 files changed, 93 insertions(+), 17 deletions(-) create mode 100755 scripts/check_build_artifacts.sh diff --git a/boards/.a62.yml b/boards/.a62.yml index f351a08..89cb69e 100644 --- a/boards/.a62.yml +++ b/boards/.a62.yml @@ -12,6 +12,8 @@ build-edgehog-a62: DEFCONFIG_FILE: seco_sbc_a62_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: u-boot.imx + KERNEL_FILE: zImage deploy-edgehog-a62: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-a62: artifacts: true variables: &deploy-edgehog-a62 <<: *build-edgehog-a62 - UBOOT_FILE: u-boot.imx - KERNEL_FILE: zImage AZURE_PATH: imx6/a62 ############################# diff --git a/boards/.c12.yml b/boards/.c12.yml index ee5d1be..2107712 100644 --- a/boards/.c12.yml +++ b/boards/.c12.yml @@ -12,6 +12,8 @@ build-edgehog-c12: DEFCONFIG_FILE: seco_smarc_c12_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: imx-boot + KERNEL_FILE: Image deploy-edgehog-c12: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-c12: artifacts: true variables: &deploy-edgehog-c12 <<: *build-edgehog-c12 - UBOOT_FILE: imx-boot - KERNEL_FILE: Image AZURE_PATH: imx8/c12 ############################# diff --git a/boards/.c20.yml b/boards/.c20.yml index 36904bb..abe85d6 100644 --- a/boards/.c20.yml +++ b/boards/.c20.yml @@ -12,6 +12,8 @@ build-edgehog-c20: DEFCONFIG_FILE: seco_sbc_c20_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: imx-boot + KERNEL_FILE: Image deploy-edgehog-c20: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-c20: artifacts: true variables: &deploy-edgehog-c20 <<: *build-edgehog-c20 - UBOOT_FILE: imx-boot - KERNEL_FILE: Image AZURE_PATH: imx8/c20 ############################# diff --git a/boards/.c26.yml b/boards/.c26.yml index 8f3b4cd..f7e3771 100644 --- a/boards/.c26.yml +++ b/boards/.c26.yml @@ -12,6 +12,8 @@ build-edgehog-c26: DEFCONFIG_FILE: seco_q7_c26_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: imx-boot + KERNEL_FILE: Image deploy-edgehog-c26: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-c26: artifacts: true variables: &deploy-edgehog-c26 <<: *build-edgehog-c26 - UBOOT_FILE: imx-boot - KERNEL_FILE: Image AZURE_PATH: imx8/c26 ############################# diff --git a/boards/.c31.yml b/boards/.c31.yml index 7186f79..523c1ac 100644 --- a/boards/.c31.yml +++ b/boards/.c31.yml @@ -13,6 +13,8 @@ build-edgehog-c31: RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image KERNEL: 4-19-111 + UBOOT_FILE: uboot.img trust.img idblock.img + KERNEL_FILE: Image deploy-edgehog-c31: extends: .deploy @@ -21,8 +23,6 @@ deploy-edgehog-c31: artifacts: true variables: &deploy-edgehog-c31 <<: *build-edgehog-c31 - UBOOT_FILE: uboot.img trust.img idblock.img - KERNEL_FILE: Image AZURE_PATH: rockchip/c31 ############################# diff --git a/boards/.c43.yml b/boards/.c43.yml index a99e462..515b65f 100644 --- a/boards/.c43.yml +++ b/boards/.c43.yml @@ -12,6 +12,8 @@ build-edgehog-c43: DEFCONFIG_FILE: seco_sbc_c43_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: imx-boot + KERNEL_FILE: Image deploy-edgehog-c43: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-c43: artifacts: true variables: &deploy-edgehog-c43 <<: *build-edgehog-c43 - UBOOT_FILE: imx-boot - KERNEL_FILE: Image AZURE_PATH: imx8/c43 ############################# diff --git a/boards/.intel_apl.yml b/boards/.intel_apl.yml index 661f6d2..844f4a4 100644 --- a/boards/.intel_apl.yml +++ b/boards/.intel_apl.yml @@ -12,6 +12,8 @@ build-edgehog-intel-apl: DEFCONFIG_FILE: seco_intel_apl_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: none + KERNEL_FILE: none deploy-edgehog-intel-apl: extends: .deploy @@ -20,6 +22,4 @@ deploy-edgehog-intel-apl: artifacts: true variables: &deploy-edgehog-intel-apl <<: *build-edgehog-intel-apl - UBOOT_FILE: none - KERNEL_FILE: none AZURE_PATH: apollolake/Yocto diff --git a/boards/.tanaro.yml b/boards/.tanaro.yml index 4cfb54e..81e46a3 100644 --- a/boards/.tanaro.yml +++ b/boards/.tanaro.yml @@ -12,6 +12,8 @@ build-edgehog-tanaro: DEFCONFIG_FILE: seco_sbc_tanaro_edgehog RECIPE_NAME: seco-image-edgehog IMAGE_NAME: edgehog-things-image + UBOOT_FILE: imx-boot + KERNEL_FILE: Image deploy-edgehog-tanaro: extends: .deploy @@ -20,8 +22,6 @@ deploy-edgehog-tanaro: artifacts: true variables: &deploy-edgehog-tanaro <<: *build-edgehog-tanaro - UBOOT_FILE: imx-boot - KERNEL_FILE: Image AZURE_PATH: imx8/tanaro ############################# diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml index 0b8c72a..27e587b 100644 --- a/manifest-pipeline-yocto.yml +++ b/manifest-pipeline-yocto.yml @@ -211,10 +211,11 @@ retrigger: sh .gitlab-ci/scripts/build_setup.sh $GITBOT_TOKEN $CI_REPOSITORY_URL $BUILD_BRANCH $DEFCONFIG_FILE $RECIPE_NAME . ./seco-setup.sh -d ${DEFCONFIG_FILE}; . ./seco-setup.sh -c; - sh ../.gitlab-ci/scripts/yocto_cache_setup.sh $PROCESSOR $CUSTOM + sh ../.gitlab-ci/scripts/yocto_cache_setup.sh $PROCESSOR $CUSTOM; time bitbake ${RECIPE_NAME}; if [[ "$CI_JOB_NAME" != *"embedded"* ]]; then time bitbake seco-bundle-edgehog; fi; " + - . ../.gitlab-ci/scripts/check_build_artifacts.sh - echo "$BUILD_DIRECTORY/$IMAGES_PATH/$MACHINE" > $BASEDIR/pathname.txt after_script: diff --git a/scripts/check_build_artifacts.sh b/scripts/check_build_artifacts.sh new file mode 100755 index 0000000..0e6386b --- /dev/null +++ b/scripts/check_build_artifacts.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +ARTIFACTS_DIR="$IMAGES_PATH/$MACHINE" + +count_uboot_files=0 +count_image=`ls -1 $ARTIFACTS_DIR/$KERNEL_FILE 2>/dev/null | wc -l` +count_dtb=`ls -1 $ARTIFACTS_DIR/*.dtb 2>/dev/null | wc -l` +count_dtbo=`ls -1 $ARTIFACTS_DIR/*.dtbo 2>/dev/null | wc -l` +count_fs=`ls -1 $ARTIFACTS_DIR/*.$FS_EXTENSION 2>/dev/null | wc -l` +count_wic=`ls -1 $ARTIFACTS_DIR/*.$IMAGE_EXTENSION 2>/dev/null | wc -l` +count_bundle=`ls -1 $ARTIFACTS_DIR/*.raucb 2>/dev/null | wc -l` + +if [[ $UBOOT_FILE != *"none"* ]]; then + count_el=0 + for i in $UBOOT_FILE; do + count_tmp=0 + count_tmp=`ls -1 $ARTIFACTS_DIR/$i 2>/dev/null | wc -l` + count_uboot_files=$(($count_uboot_files+$count_tmp)) + count_el=$((count_el+1)) + done + if [ $count_uboot_files -eq 0 ]; then + echo "No uboot artifacts were compiled, exiting with error 1 .." + exit 1 + elif [ $count_uboot_files -gt 0 ] && [ $count_uboot_files -lt "$count_el" ]; then + echo "uboot artifacts lower than expected found, warning!" + else + echo "All uboot artifacts were found!" + fi +fi + +if [[ $KERNEL_FILE != *"none"* ]]; then + if [ $count_image -eq 0 ]; then + echo "No kernel image artifacts were compiled, exiting with error 1 .." + exit 1 + else + echo "Kernel image artifacts were found!" + fi + + if [ $count_dtb -eq 0 ]; then + echo "No dtb artifacts were compiled, exiting with error 1 .." + exit 1 + else + echo "dtb artifacts were found!" + fi + + if [ $count_dtbo -eq 0 ]; then + echo "No dtb artifacts were compiled, exiting with error 1 .." + exit 1 + else + echo "dtb artifacts were found!" + fi +fi + +if [ $count_fs -eq 0 ]; then + echo "No filesystem artifacts were compiled, exiting with error 1 .." + exit 1 +else + echo "Filesystem artifacts were found!" +fi + +if [ $count_wic -eq 0 ]; then + echo "No image artifacts were compiled, exiting with error 1 .." + exit 1 +else + echo "Image artifacts were found!" +fi + +if [[ "$CI_JOB_NAME" != *"embedded"* ]]; then + if [ $count_bundle -eq 0 ]; then + echo "No bundle artifacts were compiled, exiting with error 1 .." + exit 1 + else + echo "Bundle artifacts were found!" + fi +fi \ No newline at end of file -- GitLab