Setting up Bitbucket Cloud Webhook for Fisheye
要約
Since Fisheye's REST API Token requires Request Headers which is not supported by Bitbucket's Webhook, you would require generating a User Token and add it as part of the Webhook URL.
手順
Get Fisheye's User token by running the following command:
curl -X POST --header 'content-type: application/x-www-form-urlencoded' --data 'userName=<Your_Username>&password=<Your_password>' --url <Your_URL>:<PORT></optional CONTEXT>/rest-service-fecru/auth/login eg. curl -X POST --header 'content-type: application/x-www-form-urlencoded' --data 'userName=UserA&password=MyPassword' --url http://hostname:8060/fecru/rest-service-fecru/auth/login
It should return a similar output -> {"token":"<username>:2:73c6729f7f5941de6841eca87860dfa0"}
Documentation: Fisheye Crucible REST APIWith the token received from the API, you can add the following URL to your Bitbucket's Webhook's URL then select your preferred triggers to proceed:
<Your_URL>:<PORT></optional CONTEXT>/rest-service-fecru/admin/repositories-v1/<Your_Repo_Name>/scan?FEAUTH=<Your_User_Token> eg. http://hostname:8060/fecru/rest-service-fecru/admin/repositories-v1/ronc/scan?FEAUTH=admin:2:73c6729f7f5941de6841eca87860dfa0
Please ensure that your URL is publicly accessible before adding to your Repository's Webhook
Documentation: Authenticating REST Request