3 Star 4 Fork 1

kendryte/k230_canmv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
.gitlab-ci.yml 43.10 KB
一键复制 编辑 原始数据 按行查看 历史
Wentao Wu 提交于 2024-08-02 11:45 . k230 canmv release v1.0
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078
variables:
DEFAULT_CONF: k230_canmv_defconfig
HW_VER: v0.1
TFTP_BASE: /data1/tftp_server
NFS_BASE: /data/nfs_server
NFS_SERVER: 10.10.1.94
GITLAB_REPO: [email protected]:maix_sw/k230_canmv.git
GITHUB_REPO: [email protected]:kendryte/k230_canmv.git
GITEE_REPO: [email protected]:kendryte/k230_canmv.git
TEST_SCRIPTS_REPO: [email protected]:maix_sw/k230_canmv_testscripts.git
default:
image: ai.b-bug.org:5000/k230_sdk:latest
tags:
- k230_sdk
# interruptible: true
stages:
- build_setup
- build_src
- smoke_test
- test
- publish
- send_msg
# MR merged
main_release:
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
variables:
BRANCH: main
extends:
- .sync_github_gitee
# tag push
tag_release:
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
variables:
BRANCH: main
extends:
- .sync_github_gitee
# schedule daily build sync
dev_release:
stage: publish
rules:
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
variables:
BRANCH: dev
extends:
- .sync_github_gitee
# schedule daily build sync and release sync
download_dir_release:
stage: publish
rules:
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
# release
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
extends:
- .release_download_dir
# sdk image publish with tag
release_image_publish:
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
parallel:
matrix:
- CONF:
- k230_canmv_defconfig
- k230d_canmv_only_rtt_defconfig
- k230_canmv_01studio_defconfig
extends:
- .sync_release_image
.sync_github_gitee:
timeout: 30m
retry: 2
script:
- cd $CI_PROJECT_DIR
- ls -alht
- rm -rf ./k230_canmv/
- git clone ${GITLAB_REPO} k230_canmv || exit 1
- cd k230_canmv || exit 1
- pwd
- git checkout ${BRANCH}
- git branch -a
- git status
- echo '---pull latest ${BRANCH} branch---'
- timeout 1m git pull origin ${BRANCH} || { echo "timeout matched">&2; sleep 15; timeout 1m git pull origin ${BRANCH} || { echo "timeout2 matched,">&2; timeout 1m git pull origin ${BRANCH}; exit 1; } }
- echo '---fetch all tags---'
- timeout 1m git fetch --tags || { echo "timeout matched">&2; sleep 15; timeout 1m git fetch --tags || { echo "timeout2 matched,">&2; timeout 1m git fetch --tags; exit 1; } }
- git remote add github ${GITHUB_REPO}
- git remote add gitee ${GITEE_REPO}
- git remote -v
- git branch -a
- git status
- echo "---push to gitee---"
- timeout 3m git push --atomic --tags -u -f gitee ${BRANCH} || { echo "timeout matched">&2; sleep 15; timeout 3m git push --atomic --tags -u -f gitee ${BRANCH} || { echo "timeout2 matched,">&2; timeout 3m git push --atomic --tags -u -f gitee ${BRANCH}; exit 1; } }
- echo "---push to github---"
- timeout 3m git push --atomic --tags -u -f github ${BRANCH} || { echo "timeout matched">&2; sleep 15; timeout 3m git push --atomic --tags -u -f github ${BRANCH} || { echo "timeout2 matched,">&2; git push --atomic --tags -u -f github ${BRANCH}; exit 1; } }
.release_download_dir:
timeout: 60m
retry: 2
script:
- cd $CI_PROJECT_DIR
- ls -alht
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/release/release_download_dir.sh -O ./release_download_dir.sh
- chmod +x ./release_download_dir.sh
- time ./release_download_dir.sh || time ./release_download_dir.sh
- echo "all file synced"
.sync_release_image:
timeout: 60m
retry: 2
script:
- cd $CI_PROJECT_DIR
- ls -alht
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/release/release_k230_canmv_image.sh -O ./release_k230_canmv_image.sh
- chmod +x ./release_k230_canmv_image.sh
- echo $CI_COMMIT_TAG || exit 1
- echo $CONF || exit 1
- time ./release_k230_canmv_image.sh $CI_COMMIT_TAG $CONF || time ./release_k230_canmv_image.sh $CI_COMMIT_TAG $CONF
- echo "all release file synced"
.show_vars: &show_vars
- echo "${JOB_TYPE}"
- echo "${DST_BASE}"
- echo "${SUB_BASE}"
- echo "${sysimage_path}"
- echo "${sysimage_md5}"
- echo "${image_url}"
- echo "${image_path}"
- echo "${BUILD}"
.get_job_result: &get_job_result
- |
echo "CI_PROJECT_NAME $CI_PROJECT_NAME"
echo "CI_JOB_NAME $CI_JOB_NAME"
echo "CI_JOB_STATUS $CI_JOB_STATUS"
echo "CI_JOB_ID $CI_JOB_ID"
echo "CI_JOB_IMAGE $CI_JOB_IMAGE"
echo "CI_JOB_NAME_SLUG $CI_JOB_NAME_SLUG"
echo "CI_JOB_STAGE $CI_JOB_STAGE"
echo "CI_JOB_TIMEOUT $CI_JOB_TIMEOUT"
echo "CI_JOB_URL $CI_JOB_URL"
echo "CI_PIPELINE_SOURCE $CI_PIPELINE_SOURCE"
echo "CI_PIPELINE_URL $CI_PIPELINE_URL"
echo "CI_PIPELINE_NAME $CI_PIPELINE_NAME"
echo "CI_PIPELINE_TRIGGERED $CI_PIPELINE_TRIGGERED"
echo "check send feishu msg to group"
SEND="FALSE"
if [[ "$CI_PIPELINE_SOURCE" != "merge_request_event" ]]; then
if [[ "$CI_JOB_STATUS" == "success" ]]; then
echo "job pass, check again"
if [[ "$CI_JOB_STAGE" == "send_msg" ]]; then
echo "match the last test, will send feishu pass msg"
SEND="TRUE"
else
echo "job pass but not the last one, continue the next job"
fi
elif [[ "$CI_JOB_STATUS" == "failed" ]]; then
echo "job failed, will send feishu msg now"
SEND="TRUE"
else
echo "unknown job status"
fi
else
echo "skip feishu msg for MR event"
fi
echo "Pipeline created at $CI_PIPELINE_CREATED_AT"
total_seconds=$(($(date +%s) - $(date -d $CI_PIPELINE_CREATED_AT +%s)))
echo "Total pipeline duration ${total_seconds} seconds"
t_hours=$((total_seconds / 3600))
t_minutes=$(( (total_seconds % 3600) / 60 ))
t_seconds=$((total_seconds % 60))
echo "Total pipeline duration ${t_hours}小时${t_minutes}分${t_seconds}秒"
if [[ "$SEND" == "TRUE" ]];
then
test -d bin || mkdir ./bin;
test -f ./bin/send_feishu && rm -rf ./bin/send_feishu;
echo "start to download send_feishu";
wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/send_feishu -O ./bin/send_feishu;
chmod +x ./bin/send_feishu;
echo "---start to send feishu msg in for loop"
stime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---run send feishu msg start time: $stime"
send_cmd="timeout 1m ./bin/send_feishu --msg_type pipeline --gitlab_repo $CI_PROJECT_NAME --pipeline_source $CI_PIPELINE_SOURCE --pipeline_version ${SUB_BASE} --pipeline_seconds $total_seconds --pipeline_stage $CI_JOB_STAGE --pipeline_url $CI_PIPELINE_URL --pipeline_result $CI_JOB_STATUS --sdk_url '$sdk_url' --image_url '$image_url' --job_name='$CI_JOB_NAME'"
for i in {1..5}; do
if [ $i -eq 5 ]
then
echo "ERROR: Max retries reached with run send feishu msg"
exit 1
fi
starttime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---loop $i start time: $starttime"
echo "`date +'%Y-%m-%d %H:%M:%S'` use curl to test feishu server start"
timeout 1m curl -X POST -H 'Content-Type: application/json' --data '{"username":"xyz","password":"xyz"}' https://open.feishu.cn/open-apis/bot/v2/hook/44335978-407b-44c5-99d1-954934b3caa4 -v
echo "`date +'%Y-%m-%d %H:%M:%S'` use curl to test feishu server end"
echo "---start to run send feishu msg in loop $i---"
if eval $send_cmd
then
echo "---loop $i run send feishu msg pass---"
break
else
echo "ERROR:loop $i run send feishu msg failed, ignore Error and try again..."
echo "---start to rerun in next loop..."
sleep 3
fi
endtime=$(date +'%Y-%m-%d %H:%M:%S')
start_seconds=$(date -d "$starttime" +%s)
end_seconds=$(date -d "$endtime" +%s)
echo "---loop $i end time: $endtime"
echo "---loop $i total cost time:$((end_seconds - start_seconds)) s"
done
etime=$(date +'%Y-%m-%d %H:%M:%S')
s_seconds=$(date -d "$stime" +%s)
e_seconds=$(date -d "$etime" +%s)
echo "---run send feishu msg end time: $etime"
echo "---run send feishu msg total cost time:$((e_seconds - s_seconds)) s"
echo "---finished run send feishu msg in loop $i"
echo "send feishu done";
else
echo "skip send feishu msg";
fi
.get_job_type: &get_job_type
- echo "----------get dst dir with job type----------"
- |
echo "check job from MR or tag or schedule or web"
if [[ $CI_PIPELINE_SOURCE == "merge_request_event" ]]; then
echo "current job is MR"
JOB_TYPE="merge_request"
DST_BASE="/data1/k230/gitlab-ci/images/${CI_PROJECT_NAME}"
elif [[ $CI_PIPELINE_SOURCE == "schedule" ]]; then
echo "current job is daily build schedule job"
JOB_TYPE="daily_build"
DST_BASE="/data1/k230/dev-release"
elif [[ $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG =~ ^v[0-9]+\.[0-9]+.*$ ]]; then
echo "current job is pre release job"
JOB_TYPE="pre_release"
DST_BASE="/data1/k230/pre-release"
elif [[ $CI_PIPELINE_SOURCE == "web" ]]; then
echo "current job is manual test job"
JOB_TYPE="manual_test"
DST_BASE="/data1/k230/gitlab-ci/images/${CI_PROJECT_NAME}"
elif [[ $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ ^v[0-9]+\.[0-9]+.*$ ]]; then
echo "current job is release job"
JOB_TYPE="release"
DST_BASE="/data1/k230/release"
else
echo "current job is not define, EXIT with ERROR"
exit 1
fi
- echo ${JOB_TYPE}
- echo ${DST_BASE}
- echo "----------get dst dir job done----------"
.generate_version: &generate_version
- echo "----------generate version----------"
- echo "generate version with tag or commit id"
- >
if [[ $CI_COMMIT_TAG =~ ^v[0-9]+\.[0-9]+.*$ ]];
then
echo "tag exist, version should be tag";
new_ver=$CI_COMMIT_TAG;
echo "tag is ${new_ver}";
else
echo "tag is null, version should be commit id";
commitid="unkonwn";
latest_tag="unkonwn";
git rev-parse --short HEAD && commitid=$(git rev-parse --short HEAD);
git describe --tags `git rev-list --tags --max-count=1` && latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`);
cur_date=$(date "+%Y%m%d-%H%M%S") || exit 1;
new_ver="${latest_tag}-${cur_date}-$(whoami)-$(hostname)-${commitid}" || exit 1;
echo "ver is ${new_ver}";
fi
- echo ${new_ver} > version || exit 1
- cat version || exit 1
.latest_version: &latest_version
- echo "check latest commit id for daily build"
- >
if [[ "${JOB_TYPE}" == "daily_build" ]]; then
echo "current job is daily_build, check commit id"
cur_commitid=$(git rev-parse --short HEAD)
echo "get latest commit id"
if [ -d "${DST_BASE}/canmv/latest/"]; then
latest_file=$(ls "${DST_BASE}/canmv/latest/")
finished_commitid=$(echo $latest_file | sed "s/.*-gitlab-runner-\(.*\)\.tar\.gz/\1/g")
else
finished_commitid=""
fi
echo "current commit_id $cur_commitid"
echo "finished commit_id $finished_commitid"
if [[ "$cur_commitid" == "$finished_commitid" ]]; then
echo "WARNNING current commit id is equal to finished commit id";
echo "There is no any code changes, SKIP and EXIT";
echo "BUILD=False" > build.env;
exit 0;
else
echo "current commit id is NOT equal to finished commit id, will continue to run build job";
fi
else
echo "current job is NOT daily build, will continue to run build job";
fi
.build_job: &build_job
- pwd
- echo "----------update folder owner----------"
- ls -alht micropython
- ls -alht k230_sdk
- cur_user=$(id -u)
- cur_group=$(id -g)
- sudo chown -R ${cur_user}:${cur_group} ./micropython
- sudo chown -R ${cur_user}:${cur_group} ./k230_sdk
- ls -alht micropython
- ls -alht k230_sdk
- echo "----------skip toolchain download in local docker----------"
- mkdir toolchain && touch toolchain/.toolchain_ready
- time make prepare_sourcecode || exit 1
- time make CONF=${CONF} || exit 1
- echo "----------show sdk image build output----------"
- pwd
- du -h -d 2 output/${CONF}/ || exit 1
- ls -alht output/${CONF}/images || exit 1
- echo "----------remove duplicate img----------"
- rm -rf output/${CONF}/images/sysimage-sdcard.img
#- rm -rf output/${CONF}/images/sysimage-spinand32m.img
#- rm -rf output/${CONF}/images/sysimage-spinor32m.img
- echo "----------remove big-core/little-core ----------"
- cd output/${CONF}/images/ && pwd
#- tar -zcf big-core.tgz ./big-core/
#- tar -zcf little-core.tgz ./little-core/
- rm -rf ./big-core/
- rm -rf ./little-core/
- cd ../../../ && pwd
- echo "----------build sdk image done----------"
.check_build_result: &check_build_result
- date
- >
if [[ "${BUILD}" == "False" ]];
then
echo "WARNNING: current commit id is equal to finished commit id";
echo "There is no any code changes, SKIP test job and quit"
exit 0;
else
echo "----------start to run test job----------";
fi
.common:
build_image:
- cd $CI_PROJECT_DIR
- echo "----------build image----------"
- *build_job
- echo "----------set test-image flag----------"
- echo "BUILD=True" > build.env
- echo "save default config name for next job"
- echo "conf=${CONF}" >> build.env
- cat $CI_PROJECT_DIR/build.env || exit 1
save_image:
- pwd
- echo "----------save image----------"
- echo ${DST_BASE}
- echo ${SUB_BASE}
- echo "set DST_DIR with different type based on docs/images/src"
- DST_DIR="${DST_BASE}/canmv"
- echo ${DST_DIR}
- echo "---create repo dir---"
- sudo mkdir -p ${DST_DIR}
- echo "----------Save build to external path----------"
- SUB_DIR="${SUB_BASE}/${CONF}";
- echo "---create current image version dir---"
- sudo mkdir -p ${DST_DIR}/${SUB_DIR}/ || exit 1
- echo "---save sdk build output---"
- sudo cp -rf --sparse=always ${SRC_DIR}/ ${DST_DIR}/${SUB_DIR}/
- echo "${DST_DIR}/${SUB_DIR}/"
- |
echo "check linux and rtsmart should be enable at the same time to cp mpp/cdk demo"
config_rtsmart=$(cat ./configs/${CONF} | grep 'CONFIG_SUPPORT_RTSMART=y' || true)
config_linux=$(cat ./configs/${CONF} | grep 'CONFIG_SUPPORT_LINUX=y' || true)
if [[ -n "$config_rtsmart" ]] && [[ -n "$config_linux" ]];
then
sudo mkdir -p ${DST_DIR}/${SUB_DIR}/sdk_testcase/ || exit 1
echo "---save sdk testcase output---"
mkdir -p sdk_testcase/app_demo/
cp -rf --sparse=always ./src/big/mpp/userapps/sample/elf/* ./sdk_testcase/app_demo/
cp -rf --sparse=always ./src/common/cdk/user/out/big/* ./sdk_testcase/app_demo/
tree ./sdk_testcase/
echo "---compress sdk_testcase dir---"
tar -zcf k230_testcase_${SUB_BASE}.tar.gz ./sdk_testcase/ || exit 1
echo "---save zip file---"
sudo cp -rf --sparse=always k230_testcase_${SUB_BASE}.tar.gz ${DST_DIR}/${SUB_DIR}/sdk_testcase/
else
echo "current config only support linux or only support rtsmart ,skip cp mpp/cdk demo"
fi
- echo "${DST_DIR}/${SUB_DIR}/"
- ls "${DST_DIR}/${SUB_DIR}/"
- echo "add latest link for current build"
- test -h ${DST_DIR}/latest && sudo rm ${DST_DIR}/latest || { test -h ${DST_DIR}/latest && sudo rm ${DST_DIR}/latest; }
- sudo ln -s ${DST_DIR}/${SUB_BASE} ${DST_DIR}/latest || exit 1
- echo "----------save image done----------"
- image_path="${DST_DIR}/${SUB_BASE}/"
- echo "image_path=${image_path}" >> $CI_PROJECT_DIR/build.env
- image_url=$(echo ${image_path} | sed 's/\/data1/https:\/\/ai\.b-bug\.org/g')
- echo "image_url=${image_url}" >> $CI_PROJECT_DIR/build.env
- cat $CI_PROJECT_DIR/build.env || exit 1
- echo "----------image output----------"
- echo "${image_path}"
- echo "${image_url}"
save_tftp:
- pwd
- echo "----------save image to tftp----------"
- >
if [[ "${CONF}" == "${DEFAULT_CONF}" ]];
then
echo "start to save test image for default config: ${CONF} ------"
echo ${TFTP_BASE} || exit 1
echo "set DST_DIR with different type based on docs/images/src"
DST_DIR="${TFTP_BASE}/${HW_TYPE}/${HW_MODEL}_${HW_VER}"
echo ${DST_DIR}
echo "---create tftp dir---"
sudo mkdir -p ${DST_DIR} || exit 1
echo "generate sub dir for MR/Pre-releae/relese job"
echo "check job from MR or tag or schedule or web"
if [[ ${CI_MERGE_REQUEST_IID} ]]; then
echo "current job is MR, skip and use CI_MERGE_REQUEST_IID"
elif [[ ${CI_COMMIT_TAG} ]]; then
echo "current job is release job, use CI_COMMIT_TAG"
CI_MERGE_REQUEST_IID=${CI_COMMIT_TAG}
elif [[ $CI_PIPELINE_SOURCE == "schedule" ]]; then
echo "current job is daily build schedule job, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
else
echo "current job is not match, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
fi
echo "current MR ID ${CI_MERGE_REQUEST_IID}"
SUB_DIR="${CI_MERGE_REQUEST_IID}_${CI_PIPELINE_ID}/${CONF}";
sudo mkdir -p ${DST_DIR}/${SUB_DIR}/ || exit 1
src_file="${SRC_DIR}/sysimage-sdcard.img.gz"
ls "${src_file}" || exit 1
sysimage_md5=$(md5sum ${src_file} | awk '{print $1}')
echo "sysimage md5 is ${sysimage_md5}"
sudo cp -rf --sparse=always ${src_file} ${DST_DIR}/${SUB_DIR}/
echo "${DST_DIR}/${SUB_DIR}/"
ls -alht "${DST_DIR}/${SUB_DIR}/" || exit 1
echo "release job works in release_sdk sub dir, use full path"
echo "sysimage_path=${DST_DIR}/${SUB_DIR}/sysimage-sdcard.img.gz" >> $CI_PROJECT_DIR/build.env
echo "sysimage_md5=${sysimage_md5}" >> $CI_PROJECT_DIR/build.env
ls
cat $CI_PROJECT_DIR/build.env
else
echo "SKIP save test image for current config: ${CONF}------"
fi
- echo "----------save image to tftp done----------"
.test:
test_setup:
- - echo "----------Step 1. get available test devices----------"
- |
echo "check job from MR or tag or schedule or web"
if [[ ${CI_MERGE_REQUEST_IID} ]]; then
echo "current job is MR, skip and use CI_MERGE_REQUEST_IID"
elif [[ ${CI_COMMIT_TAG} ]]; then
echo "current job is release job, use CI_COMMIT_TAG"
CI_MERGE_REQUEST_IID=${CI_COMMIT_TAG}
elif [[ $CI_PIPELINE_SOURCE == "schedule" ]]; then
echo "current job is daily build schedule job, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
else
echo "current job is not match, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
fi
- echo "MR ID ${CI_MERGE_REQUEST_IID}"
- echo "Pipeline ID ${CI_PIPELINE_ID}"
- test -d bin || mkdir ./bin
- test -f ./bin/ailab && rm -rf ./bin/ailab
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/ailab -O ./bin/ailab
- chmod +x ./bin/ailab
- |
echo "for loop to get available test device"
for i in {1..6}; do
if [ $i -eq 6 ];
then
echo "ERROR: No Available DUT after 5 times retry, Please rerun curent job to check it again";
exit 1;
fi
starttime=$(date +'%Y-%m-%d %H:%M:%S');
echo "---loop $i start time: $starttime";
echo "---start to get available test device in loop $i---";
available=$(./bin/ailab show --dest available --domain ${TEST_ENV} --hw_type ${HW_TYPE} --hw_model ${HW_MODEL} --hw_ver ${HW_VER} --format args)
echo ${available}
if [[ $available =~ "k230" ]];
then
echo "---Get Available DUT pass in loop $i---";
echo "----------get available test devices done----------";
echo "----------Step 2. reserve test device----------";
reserved=$(./bin/ailab add ${available} --time 15m --site ${CI_PROJECT_NAME} --source ${CI_MERGE_REQUEST_IID} --job ${CI_PIPELINE_ID} --format args);
echo ${reserved};
if [[ ${reserved} =~ "gitlab" ]];
then
echo "Reserve DUT pass in loop $i, break loop and continue the next job";
# exit for loop with break once device avaiable and reserved pass
break;
else
echo "ERROR: Reserve DUT failed";
if [ $i -eq 6 ];
then
echo "ERROR: No Available DUT after 5 times retry, Please rerun curent job to check it again";
exit 1;
else
echo "---sleep 30 seconds and auto rerun in next loop...";
sleep 30
fi
fi
else
echo "ERROR: Get available test device failed in loop $i, ignore Error and try again...";
echo "---sleep for 30seconds and start to rerun in next loop...";
sleep 30;
fi
done
- echo "----------Step 3. save reserved/available for after_script----------"
- echo "${available}" > available
- echo "${reserved}" > reserved
- echo "${HW_MODEL}" > HW_MODEL
- echo "----------Step 4. power on/reset test device before test start----------"
- power_off="./bin/ailab power --type=off ${available}";
- power_on="./bin/ailab power --type=on ${available}";
- power_reset="./bin/ailab power --type=cycle ${available}";
- echo $power_off
- echo $power_on
- echo $power_reset
- |
echo "---start to run device power job before test start...";
if [[ "$HW_MODEL" =~ "canmv_v2" ]]
then
echo "---canmv v2 board will be power reset at test start ---";
$power_reset;
sleep 2;
echo "canmv_v2 board power reset done. continue to run test job";
elif [[ "$HW_MODEL" == "canmv" ]]
then
echo "---canmv board will be power reset at test start ---";
$power_reset;
sleep 2;
echo "canmv board power reset done. continue to run test job";
else
echo "---evb board will be power off and power on at test start---";
$power_off;
sleep 2;
$power_on;
sleep 2;
echo "evb board power off and power on done. continue in next loop";
fi
echo "---device power action done, start to run test job...";
- echo "----------reserve test device and power on/reset test device done----------"
test_teardown:
- echo "----------release test device----------"
- echo "get variables from previous steps"
- reserved=$(cat reserved)
- available=$(cat available)
- HW_MODEL=$(cat HW_MODEL)
- echo "Release DUT start"
- test -d bin || mkdir ./bin
- test -f ./bin/ailab && rm -rf ./bin/ailab
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/ailab -O ./bin/ailab
- chmod +x ./bin/ailab
- result=$(./bin/ailab update --dest=reserved ${reserved})
- echo $result
- echo $result
- |
if [[ $result =~ "True" ]]; then
echo "Release DUT pass";
else
echo "ERROR: Release DUT failed";
exit 1;
fi
- power_off="./bin/ailab power --type=off ${available}";
- power_on="./bin/ailab power --type=on ${available}";
- power_reset="./bin/ailab power --type=cycle ${available}";
- echo $power_off
- echo $power_on
- echo $power_reset
- |
echo "---start to run device power job after test done...";
if [[ "$HW_MODEL" =~ "canmv_v2" ]]
then
echo "---canmv v2 board will skip power job at test start ---";
# $power_reset;
# sleep 2;
# echo "canmv_v2 board power reset done. continue to run test job";
elif [[ "$HW_MODEL" == "canmv" ]]
then
echo "---canmv board will skip power job after test done---";
# $power_reset;
# sleep 2;
# echo "canmv board power reset done. continue to run test job";
else
echo "---evb board will be power off after test done---";
$power_off;
# sleep 2;
# $power_on;
# sleep 2;
echo "evb board power off and power on done. continue in next loop";
fi
echo "---device power job done---";
- echo "----------release test device done----------"
load_image:
- echo "----------load image to test device----------"
- echo "sysimage-sdcard.img.gz md5 ${sysimage_md5}"
- test -d bin || mkdir ./bin
- test -f ./bin/aiload && rm -rf ./bin/aiload
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/k230load -O ./bin/aiload
- chmod +x ./bin/aiload
- echo "MR ID ${CI_MERGE_REQUEST_IID}"
- echo "Pipeline ID ${CI_PIPELINE_ID}"
- |
echo "---start to load image in for loop";
stime=$(date +'%Y-%m-%d %H:%M:%S');
echo "---load image start time: $stime";
load_cmd="./bin/aiload --file_name=$NFS_CASE_FOLDER/${TEST_ENV}.yml";
echo "${load_cmd}";
for i in {1..6}; do
if [ $i -eq 6 ]
then
echo "ERROR: Max retries reached with load image";
exit 1;
fi
starttime=$(date +'%Y-%m-%d %H:%M:%S');
echo "---loop $i start time: $starttime";
echo "---start to load image in loop $i---";
if eval $load_cmd
then
echo "---loop $i load image pass---";
break;
else
echo "ERROR:loop $i load image failed, ignore Error and retry again...";
echo "---start to run device power job after failed job...";
if [[ "$HW_MODEL" == "canmv_v2" ]]
then
echo "---canmv_v2 board will be power reset at the end of loop $i ---";
$power_reset;
sleep 15;
echo "canmv_v2 board power reset done. continue in next loop";
elif [[ "$HW_MODEL" == "canmv" ]]
then
echo "---canmv board will be power reset at the end of loop $i ---";
$power_reset;
sleep 15;
echo "canmv board power reset done. continue in next loop";
else
echo "---evb board will be power off and power on at the end of loop $i---";
$power_off;
sleep 3;
$power_on;
sleep 15;
echo "evb board power off and power on done. continue in next loop";
fi
echo "---device power action, start to rerun in next loop...";
fi
endtime=$(date +'%Y-%m-%d %H:%M:%S');
start_seconds=$(date -d "$starttime" +%s);
end_seconds=$(date -d "$endtime" +%s);
echo "---loop $i end time: $endtime";
echo "---loop $i total cost time:$((end_seconds - start_seconds)) s";
done
etime=$(date +'%Y-%m-%d %H:%M:%S');
s_seconds=$(date -d "$stime" +%s);
e_seconds=$(date -d "$etime" +%s);
echo "---load image end time: $etime";
echo "---load image total cost time:$((e_seconds - s_seconds)) s";
echo "---finished load image in loop $i";
- echo "---load image pass"
- echo "----------load image to test device done----------"
copy_test_resource:
- echo "----------Step 5. copy test resource----------"
- echo "get build step result"
- *show_vars
- pwd
- echo "---get nfs case floder---"
- |
echo ${NFS_BASE}
echo "set NFS_DST_DIR with different type based on docs/images/src"
NFS_DST_DIR="${NFS_BASE}/${HW_TYPE}/${HW_MODEL}_${HW_VER}"
echo ${NFS_DST_DIR}
echo "---create NFS dir---"
echo "generate sub dir for MR/Pre-releae/relese job"
echo "check job from MR or tag or schedule or web"
if [[ ${CI_MERGE_REQUEST_IID} ]]; then
echo "current job is MR, skip and use CI_MERGE_REQUEST_IID"
elif [[ ${CI_COMMIT_TAG} ]]; then
echo "current job is release job, use CI_COMMIT_TAG"
CI_MERGE_REQUEST_IID=${CI_COMMIT_TAG}
elif [[ $CI_PIPELINE_SOURCE == "schedule" ]]; then
echo "current job is daily build schedule job, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
else
echo "current job is not match, use CI_PIPELINE_SOURCE"
CI_MERGE_REQUEST_IID=$CI_PIPELINE_SOURCE
fi
echo "current MR ID ${CI_MERGE_REQUEST_IID}"
SUB_DIR="${CI_MERGE_REQUEST_IID}_${CI_PIPELINE_ID}"
NFS_CASE_FOLDER="${NFS_DST_DIR}/${SUB_DIR}/${CONF}/${TEST_ENV}"
echo "NFS_CASE_FOLDER: $NFS_CASE_FOLDER"
echo "update current NFS_CASE_FOLDER permission before write"
sudo mkdir -p ${NFS_CASE_FOLDER} || exit 1
sudo chmod -R 777 ${NFS_CASE_FOLDER} || exit 1
- echo "---add testcase script to nfs folder"
- git clone ${TEST_SCRIPTS_REPO} k230_canmv_testscripts || exit 1
- cd k230_canmv_testscripts || exit 1
- timeout 1m git fetch origin main || { echo "timeout matched">&2; sleep 15; timeout 1m git fetch origin main || { echo "timeout2 matched,">&2; timeout 1m git fetch origin main; exit 1; } }
- git checkout main || exit 1
- echo "check micropython_testcases dir should be exist"
- ls micropython_testcases || exit 1
- cd ../ || exit 1
- echo "---copy test resource to nfs dir in nfs_server"
- time cp -rf --sparse=always ./k230_canmv_testscripts/micropython_testcases/ $NFS_CASE_FOLDER/
- cd $NFS_CASE_FOLDER/ || exit 1;
- ls -alht || exit 1
- |
if [[ -d "micropython_testcases" ]]; then
echo "micropython_testcases dir exist, continue run test job"
else
echo "micropython_testcases dir not exit, return error and exit"
exit 1
fi
- echo "confirm micropython_testcase dir again"
- ls -alht micropython_testcases || exit 1
- echo "show test resource in nfs_server"
- tree $NFS_CASE_FOLDER
- cd -
- pwd
- echo "finished copy test resource in nfs_server"
- echo "----------Step 7. generate test device yml file for test job----------"
- echo "run command ./bin/ailab convert --dest=script --format yaml --file_name=${TEST_ENV}.yml --nfs_server_ip $NFS_SERVER --nfs_case_folder $NFS_CASE_FOLDER --only_rtt ${ONLY_RTT} --conf ${CONF} --pr_id ${CI_MERGE_REQUEST_IID} --job_id ${CI_PIPELINE_ID} --sysimage_md5 ${sysimage_md5} ${available}"
- ./bin/ailab convert --dest=script --format yaml --file_name=${TEST_ENV}.yml --nfs_server_ip $NFS_SERVER --nfs_case_folder $NFS_CASE_FOLDER --only_rtt ${ONLY_RTT} --conf ${CONF} --pr_id ${CI_MERGE_REQUEST_IID} --job_id ${CI_PIPELINE_ID} --sysimage_md5 ${sysimage_md5} ${available}
- test -f ${TEST_ENV}.yml || exit 1
- cat ${TEST_ENV}.yml || exit 1
- echo "cp ${TEST_ENV}.yml to nfs_case_folder for NUC remote PC audio job"
- cp -rf --sparse=always ${TEST_ENV}.yml $NFS_CASE_FOLDER/ || exit 1
- test -f $NFS_CASE_FOLDER/${TEST_ENV}.yml || exit 1
- echo "show test resource in nfs_server"
- echo $NFS_CASE_FOLDER
- ls -alht $NFS_CASE_FOLDER
smoke_test:
- echo "----------Run Smoke Test start----------"
- echo "---add test script"
- test -d k230_canmv_testscripts || git clone ${TEST_SCRIPTS_REPO} k230_canmv_testscripts || exit 1
- cd k230_canmv_testscripts || exit 1
- timeout 1m git fetch origin main || { echo "timeout matched">&2; sleep 15; timeout 1m git fetch origin main || { echo "timeout2 matched,">&2; timeout 1m git fetch origin main; exit 1; } }
- git checkout main || exit 1
- pwd
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/testscripts/k230_micropython_smoke_test.sh -O ./k230_micropython_smoke_test.sh
- chmod +x ./k230_micropython_smoke_test.sh
- ls -alht
- |
echo "---start to run k230 micropython smoke test in for loop"
stime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---run k230 smoke test start time: $stime"
test_cmd="./k230_micropython_smoke_test.sh $NFS_CASE_FOLDER/${TEST_ENV}.yml"
for i in {1..2}; do
if [ $i -eq 2 ]
then
echo "ERROR: Max retries reached with run k230 micropython smoke test"
exit 1
fi
starttime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---loop $i start time: $starttime"
echo "---start to run k230 canmicropythonmv smoke test in loop $i---"
if eval $test_cmd
then
echo "---loop $i run k230 micropython smoke test pass---"
break
else
echo "ERROR:loop $i run k230 micropython smoke test failed, ignore Error and try again..."
echo "---start to rerun in next loop..."
sleep 3
fi
endtime=$(date +'%Y-%m-%d %H:%M:%S')
start_seconds=$(date -d "$starttime" +%s)
end_seconds=$(date -d "$endtime" +%s)
echo "---loop $i end time: $endtime"
echo "---loop $i total cost time:$((end_seconds - start_seconds)) s"
done
etime=$(date +'%Y-%m-%d %H:%M:%S')
s_seconds=$(date -d "$stime" +%s)
e_seconds=$(date -d "$etime" +%s)
echo "---run k230 micropython smoke test end time: $etime"
echo "---run k230 micropython smoke test total cost time:$((e_seconds - s_seconds)) s"
echo "---finished run k230 micropython smoke test in loop $i"
- echo "----------Run Smoke Test pass----------"
daily_test:
- echo "----------Run Daily Test start----------"
- echo "---add test script"
- test -d k230_canmv_testscripts || git clone ${TEST_SCRIPTS_REPO} k230_canmv_testscripts || exit 1
- cd k230_canmv_testscripts || exit 1
- timeout 1m git fetch origin main || { echo "timeout matched">&2; sleep 15; timeout 1m git fetch origin main || { echo "timeout2 matched,">&2; timeout 1m git fetch origin main; exit 1; } }
- git checkout main || exit 1
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/testscripts/k230_micropython_daily_test.sh -O ./k230_micropython_daily_test.sh
- chmod +x ./k230_micropython_daily_test.sh
- |
echo "---start to run k230 micropython daily test in for loop"
stime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---run k230 micropython daily test start time: $stime"
test_cmd="./k230_micropython_daily_test.sh $NFS_CASE_FOLDER/${TEST_ENV}.yml"
for i in {1..2}; do
if [ $i -eq 2 ]
then
echo "ERROR: Max retries reached with run k230 micropython daily test"
exit 1
fi
starttime=$(date +'%Y-%m-%d %H:%M:%S')
echo "---loop $i start time: $starttime"
echo "---start to run k230 micropython daily test in loop $i---"
if eval $test_cmd
then
echo "---loop $i run k230 micropython daily test pass---"
break
else
echo "ERROR:loop $i run k230 micropython daily test failed, ignore Error and try again..."
echo "---start to rerun in next loop..."
sleep 3
fi
endtime=$(date +'%Y-%m-%d %H:%M:%S')
start_seconds=$(date -d "$starttime" +%s)
end_seconds=$(date -d "$endtime" +%s)
echo "---loop $i end time: $endtime"
echo "---loop $i total cost time:$((end_seconds - start_seconds)) s"
done
etime=$(date +'%Y-%m-%d %H:%M:%S')
s_seconds=$(date -d "$stime" +%s)
e_seconds=$(date -d "$etime" +%s)
echo "---run k230 micropython daily test end time: $etime"
echo "---run k230 micropython daily test total cost time:$((e_seconds - s_seconds)) s"
echo "---finished run k230 micropython daily test in loop $i"
- echo "----------Run Daily Test pass----------"
before_script:
- echo '----------Build ENV Prepare----------'
- echo 'Add SSH KEY for Multiple repo clone in Makefile'
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" | ssh-add - > ~/.ssh/id_ed25519 || exit 1
- '[[ -f /.dockerenv ]] && echo -e "Host *\n StrictHostKeyChecking no\n" > ~/.ssh/config'
- echo $SHELL
- echo "config ssh timeout"
- echo " ServerAliveInterval 30" >> ~/.ssh/config
- echo " ServerAliveCountMax 60" >> ~/.ssh/config
- echo " TCPKeepAlive yes" >> ~/.ssh/config
- cat ~/.ssh/config
- whoami
- uptime
- pwd
- ls -alht
- ls -alht k230_sdk
- ls -alht micropython
- uname -a
- cat /etc/issue
- echo $CI_PROJECT_DIR
- echo $CI_PROJECT_NAME
- echo $CI_PIPELINE_SOURCE
- echo $CI_COMMIT_TAG
- echo '----------Set git config----------'
- echo "${GITLAB_USER_EMAIL}"
- echo "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global --add safe.directory $CI_PROJECT_DIR
- git config --global --add safe.directory $CI_PROJECT_DIR/k230_sdk
- git config --global --add safe.directory $CI_PROJECT_DIR/micropython
- echo '----------fetch all tags----------'
- timeout 1m git fetch --tags || { echo "timeout matched">&2; sleep 15; timeout 1m git fetch --tags || { echo "timeout2 matched,">&2; timeout 1m git fetch --tags; exit 1; } }
- HW_TYPE=$(echo $CONF | awk -F '_' '{print $1}')
- HW_MODEL=$(echo $CONF | awk -F "_" '{if ($3 == "v2") print $2"_"$3; else print $2}')
- echo "HW_TYPE ${HW_TYPE}, HW_MODEL ${HW_MODEL}"
- |
if [[ $CONF =~ "only_rtt_defconfig" ]]; then
ONLY_RTT=True
else
ONLY_RTT=False
fi
- echo "ONLY_RTT is ${ONLY_RTT}"
after_script:
- *show_vars
- *get_job_result
# build setup for all jobs
build_setup:
stage: build_setup
rules:
# MR job to dev branch
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"
# release job
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# pre-release job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# manual job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG !~ /^v\d+\.\d+.*$/
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
timeout: 5m
script:
- echo "build env setup"
- *get_job_type
- *latest_version
- *generate_version
- echo "JOB_TYPE=${JOB_TYPE}" >> build.env
- echo "DST_BASE=${DST_BASE}" >> build.env
- echo "SUB_BASE=${new_ver}" >> build.env
artifacts:
reports:
dotenv: build.env
# first build with src for MR
build_image:
stage: build_src
rules:
# MR job to dev branch
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"
# release job
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# pre-release job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# manual job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG !~ /^v\d+\.\d+.*$/
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
timeout: 45m
parallel:
matrix:
- CONF:
- k230_canmv_defconfig
- k230d_canmv_only_rtt_defconfig
- k230_canmv_01studio_defconfig
variables:
SRC_DIR: ./output/${CONF}/images
script:
- *show_vars
- *check_build_result
- !reference [.common, build_image]
- !reference [.common, save_tftp]
- !reference [.common, save_image]
- cat $CI_PROJECT_DIR/build.env
artifacts:
reports:
dotenv: build.env
#test setup for all jobs
load_image_smoke_test:
stage: smoke_test
variables:
TEST_ENV: ai
CONF: k230_canmv_defconfig
rules:
# MR job to dev branch
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"
# release job
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# pre-release job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# manual job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG !~ /^v\d+\.\d+.*$/
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
timeout: 60m
script:
- *show_vars
- *check_build_result
- !reference [.test, test_setup]
- !reference [.test, copy_test_resource]
- !reference [.test, load_image]
- !reference [.test, smoke_test]
after_script:
- !reference [.test, test_teardown]
- *show_vars
- *get_job_result
# daily build test
daily_build_test:
stage: test
rules:
# release job
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# pre-release job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# manual job
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG !~ /^v\d+\.\d+.*$/
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
timeout: 300m
variables:
TEST_ENV: ai
CONF: k230_canmv_defconfig
script:
- *show_vars
- *check_build_result
- !reference [.test, test_setup]
- !reference [.test, copy_test_resource]
- !reference [.test, load_image]
- !reference [.test, daily_test]
after_script:
- !reference [.test, test_teardown]
- *show_vars
- *get_job_result
# sync dev branch to main branch
dev_to_main:
stage: publish
rules:
# MR job to main branch
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
timeout: 30m
script:
- echo "----------Step 1, Check Merge Request Title, k230 canmv release v*.* MUST bt exist----------"
- echo "$CI_MERGE_REQUEST_TITLE"
- >
if [[ "$CI_MERGE_REQUEST_TITLE" =~ "^k230 canmv release v[0-9]+\.[0-9]+".*$ ]];
then
echo "Merge Request title check PASS, continue get release version from merge request title";
else
echo "Merge Request title check FAILED, please EDIT title name with release tag";
echo "Title MUST be end with tag like: k230 canmv release v0.4";
exit 1;
fi
- RELEASE_TAG=$(echo $CI_MERGE_REQUEST_TITLE |grep -Eo "v[0-9]+\.[0-9]+.*?$")
- >
if [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+.*$ ]];
then
echo "Release TAG/version will be " $RELEASE_TAG;
else
echo "Release TAG/version check FAILED, please EDIT title name with release tag";
echo "Title MUST be end with tag like: k230 canmv release v1.4";
exit 1;
fi
- echo "----------sync dev branch to main branch for canmv repo----------"
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/release/k230_canmv_release.sh -O ./k230_canmv_release
- chmod +x ./k230_canmv_release
- ./k230_canmv_release canmv $RELEASE_TAG "k230 canmv release $RELEASE_TAG" || exit 1
- echo "----------sync dev to main branch pass for canmv repo----------"
# send feishu msg
send_feishu_msg:
stage: send_msg
rules:
# release job
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
# when: always
# pre-release job
- if: $CI_PIPELINE_SOURCE == "web"
# when: always
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
# when: always
timeout: 5m
script:
- *show_vars
- *get_job_result
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kendryte/k230_canmv.git
[email protected]:kendryte/k230_canmv.git
kendryte
k230_canmv
k230_canmv
main

搜索帮助