加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.sh 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
liuyijia 提交于 2024-01-29 08:20 . !1 add build.sh and readme file
#!/usr/bin/env bash
# 验证
KEY=""
# 指定克隆分支
BRANCH_TAG=""
# 镜像别名
IMG_NAME=""
# 指定镜像上传region, 支持多region上传, 多个region间使用‘,’分隔
IMG_UPLOAD_REGION=""
# 编译服务器地址
SERVER_ADDR=""
# 默认不执行增量编译
INCREMENTAL=0
while getopts ":il" opt; do
case "${opt}" in
i) INCREMENTAL=1;;
l)
curl -X POST -k --insecure -H "key: ${KEY}" https://${SERVER_ADDR}:8081/get_log
exit 0;;
?)
echo "input param error! exit."
exit 1;;
esac
done
echo '{
"region":"'${IMG_UPLOAD_REGION}'",
"tag":"'${BRANCH_TAG}'",
"type":"aosp11",
"name":"'${IMG_NAME}'",
"incrementalBuild":"'${INCREMENTAL}'"
}' > curl_tmp.json
curl -X POST -k --insecure -H "Content-Type: application/json" -H "key: ${KEY}" -d @curl_tmp.json https://${SERVER_ADDR}:8081/image/build &
build_pid=$!
function quit_build ()
{
echo "quit command caught, stop building..."
curl -X POST -k --insecure -H "key: ${KEY}" https://${SERVER_ADDR}:8081/stop_build
kill -9 $build_pid
echo '\n'
}
trap "quit_build" SIGINT
until false
do
sleep 5
is_running=$(ps | grep $build_pid)
if [ "${is_running}" == "" ]; then
rm curl_tmp.json
break
fi
curl -X POST -k --insecure -H "key: ${KEY}" https://${SERVER_ADDR}:8081/get_log
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化