我正在尝试从jenkins管道运行以下shell脚本,但是它给出了错误。
/bin/openstack image create Abhay_Centos_6_8_img_V7 --disk-format vhd --min-disk 40 --min-ram 1024 --volume "71c8532d-4fc0-42d4-a534-7b368e4804cb" --unprotected --property __os_type=Linux --property __platform=Linux --property __os_version="CentOS linux 6.8" --force
错误:
/bin/openstack image create Abhay_Centos_6_8_img_V7 --disk-format vhd --min-disk 40 --min-ram 1024 --volume 71c8532d-4fc0-42d4-a534-7b368e4804cb --unprotected --property __os_type=Linux --property __platform=Linux --property '__os_version=CentOS linux 6.8' --force
Uploading data and using container are not allowed at the same time
Build step 'Conditional step (single)' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Finished: FAILURE
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
但是如果我在服务器上手动运行shell脚本,则相同的脚本运行良好。
答案 0 :(得分:0)
很晚才回答,但我刚刚遇到问题并解决了它,所以让我们分享一个解决方案:
在检查 Openstack 代码后,似乎“openstack image create”会检查 tty 状态:它需要一个 tty(即使您从卷创建),而 cron 或 jenkins 可能不提供。所以你需要“伪造”一个 tty 来执行命令:
bash 中的示例:
faketty() {
script -qefc "$(printf "%q " "$@")"
}
faketty openstack image create --volume ${VOLUME_NAME} ${IMAGE_NAME}
享受