可發運CI UI被顯示我以下錯誤:如何修復shippable.yml文件中的「長度必須小於40」錯誤?
ERROR:1個驗證檢測到的錯誤:在'environmentNames'
值'[if [ develop == master ]; then xxx-xx-prod; else xxx-xx-dev; fi]'
不能滿足約束:成員必須滿足約束:[會員的長度必須小於或等於40,會員的長度必須大於或等於4]
這是我shippable.yml文件:
branches:
only:
- develop
- master
build:
ci:
- "echo 'CI is running'"
post_ci:
- "docker build -t=\"xxxx/xxx-xxxx:$BRANCH.$BUILD_NUMBER\" ."
- "docker push xxxx/xxx-xxx:$BRANCH.$BUILD_NUMBER"
- "pip install --upgrade botocore"
- "pip install setuptools==34.0.1"
integrations:
deploy:
-
application_name: seamless-ai
env_name: if [ "$BRANCH" == "master" ]; then "xxx-xx-prod"; else "xxx-xx-dev"; fi
image_name: xxxx/xxx-xxx
image_tag: $BRANCH.$BUILD_NUMBER
integrationName: AWS-int
region: us-east-1
type: aws
hub:
-
integrationName: "Docker Hub"
type: docker
language: node_js
所以基本上,我的問題是:
env_name: if [ "$BRANCH" == "master" ]; then "xxx-xx-prod"; else "xxx-xx-dev"; fi
本質上講,我需要做的是:
如果分支是高手的話env_name
必須xxx-xx-prod
否則,再env_name
= xxx-xx-dev
我怎樣才能解決這個問題?
你的'if'語句在bash中甚至不是正確的語法,因爲你似乎期望評估作爲三元運算符(它不存在於bash中)。 – flyx