script:
- start_build_message="The project build has started! I will notify you when it's completed. Author $GITLAB_USER_NAME."
- echo "$start_build_message"
- ssh -o "StrictHostKeyChecking=no" "$SSH_USERNAME"@"$SSH_HOST"
"curl -s -X POST 'https://api.telegram.org/$TELEGRAM_BOT_TOKEN/sendMessage' \
-d chat_id=$TELEGRAM_CHAT_ID \
--data-urlencode text=\"\${start_build_message}\""
您的问题可能是由于SSH命令中的可变扩展而引起的。
script:
- start_build_message="The project build has started! I will notify you when it's completed. Author $GITLAB_USER_NAME."
- echo "$start_build_message"
- ssh -o "StrictHostKeyChecking=no" "$SSH_USERNAME@$SSH_HOST" \
"start_build_message=\"${start_build_message}\" && \
curl -s -X POST 'https://api.telegram.org/$TELEGRAM_BOT_TOKEN/sendMessage' \
-d chat_id=$TELEGRAM_CHAT_ID --data-urlencode text=\"\${start_build_message}\""
script:
- start_build_message="The project build has started! I will notify you when it's completed. Author $GITLAB_USER_NAME."
- echo "$start_build_message"
- ssh -o "StrictHostKeyChecking=no" "$SSH_USERNAME@$SSH_HOST" \
"curl -s -X POST 'https://api.telegram.org/$TELEGRAM_BOT_TOKEN/sendMessage' \
-d chat_id=$TELEGRAM_CHAT_ID --data-urlencode text=\"$(echo $start_build_message)\""