wal*_*alv 7 bash bitbucket environment-variables slack-api bitbucket-pipelines
我有一个非常简单的标签管道。当我做标签时,我想发送简单的 slack 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"}'
Run Code Online (Sandbox Code Playgroud)
我在 Slack 中得到了这个
CoreLib tag [12:50 PM]
Tag $BITBUCKET_TAG has been created
Run Code Online (Sandbox Code Playgroud)
我想要实现的是正确呈现$BITBUCKET_TAG我echo和 Slack 消息中的值,例如:
CoreLib tag [12:50 PM]
Tag v2019.1.1 has been created
Run Code Online (Sandbox Code Playgroud)
基本解决方案非常简单。
而不是$BITBUCKET_TAG应该是'"$BITBUCKET_TAG"'。
echo -d '{"username":"CoreLib tag","text":"Tag *'"$BITBUCKET_TAG"'* has been created"}'
Run Code Online (Sandbox Code Playgroud)
摘自这里: https: //superuser.com/questions/835587/how-to-include-environment-variable-in-bash-line-curl
| 归档时间: |
|
| 查看次数: |
12739 次 |
| 最近记录: |