我有一个非常简单的标签管道。当我做标签时,我想发送简单的松弛webhook。我的问题是,$BITBUCKET_TAG
和松弛消息中都没有呈现环境变量echo
。
pipelines:
tags:
'*':
- step:
script:
- echo $BITBUCKET_TAG
- curl -X POST "https://hooks.slack.com/services/mysecuritykey" -H "Content-Type:application/json" -H "cache-control:no-cache" -d '{"username":"CoreLib tag","text":"Tag *$BITBUCKET_TAG* has been created"}'
我在Slack中得到了
CoreLib tag [12:50 PM]
Tag $BITBUCKET_TAG has been created
我想要实现的是在我的$BITBUCKET_TAG
和Slack消息中正确渲染echo
值,如下所示:
CoreLib tag [12:50 PM]
Tag v2019.1.1 has been created
答案 0 :(得分:0)
基本解决方案非常简单。
应该改为$BITBUCKET_TAG
,而不是'"$BITBUCKET_TAG'"
。
来自这里: https://superuser.com/questions/835587/how-to-include-environment-variable-in-bash-line-curl