0
Follow
2
View

How to fix function which I'm trying to pass into "payload" in bash ? I've stuck with error "invalid payload"

dtq_1985 注册会员
2023-01-25 01:36

If the webhook works locally (meaning the curl to ${slack_webhook} is successful), but the same webhook, when called by GitLab CI, does not work, that should probably mean one of the variables used in print_slack_summary_deploy() is not correctly valued (or is empty), resulting in an invalid payload.

I would display those variables in a debug print, and compare them with the one done during a manual (successful) test done locally.


As noted by the OP Vlad Tkachuk, the root cause was the JSON being invalid.

A tool like /usr/bin/json_pp (usually present when Perl is already installed) can help validate the variable (as seen here)

echo "${myJSONvar}" | json_pp 2>/dev/null || exit -1

About the Author

Question Info

Publish Time
2023-01-25 01:36
Update Time
2023-01-25 01:36