#!/bin/bash
# Set AWS credentials
export AWS_ACCESS_KEY_ID=<your-access-key-id>
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
export AWS_DEFAULT_REGION=<your-region>
# Set the EventBridge rule name and JSON event data
RULE_NAME=<your-rule-name>
EVENT_DATA='{
"source": "jenkins",
"detail-type": "jenkins-build",
"detail": {
"project": "your-project",
"branch": "master",
"status": "success"
}
}'
# Send the event to EventBridge using the AWS CLI
1条答案
按热度按时间8i9zcol21#
您可以使用AWS CLI或SDK将事件从Jenkins发送到AWS EventBridge。
aws events put-events --entries "{\"Source\": \"jenkins\", \"DetailType\": \"jenkins-build\", \"Detail\": \"$EVENT_DATA\", \"EventBusName\": \"$RULE_NAME\"}"