forked from prabhakar2020/aws_codedeploy_using_github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_server
More file actions
57 lines (32 loc) · 2.16 KB
/
Copy pathstart_server
File metadata and controls
57 lines (32 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# #!/bin/bash
# function message() {
# cat /var/log/aws/codedeploy-agent/codedeploy-agent.log | tail -300 > /root/codeeploy_errorlog.txt
# curl -F file=@/root/codeeploy_errorlog.txt -F "initial_comment=Error Logs For the Codebuild" -F channels=C04BB1ZPA91 -H "Authorization: Bearer xoxp-4376808933893-4403454396848-4969571972838-5fa4dbbfd2fd21f895b0549bc22b32df" https://slack.com/api/files.upload
# }
# function error() {
# local exit_code="$?"
# message
# exit "${exit_code}"
# }
# trap 'error' ERR
service httpd start
#pipeline-name=$(aws deploy get-deployment --deployment-id d-XDQU9BRDM --query "deploymentInfo.revision.s3Location.key" | sed 's/"//g; s|/.*||')
#pipeline-name=$(aws codepipeline list-pipelines --region us-east-2 | grep $(aws deploy get-deployment --region us-east-2 --deployment-id $DEPLOYMENT_ID --query "deploymentInfo.revision.s3Location.key" | sed 's/"//g; s|/.*||') | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
test=$(aws deploy get-deployment --region us-east-2 --deployment-id $DEPLOYMENT_ID --query "deploymentInfo.revision.s3Location.key" | sed 's/"//g; s|/.*||')
name=$(aws codepipeline list-pipelines --region us-east-2 | grep $test | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
#execution_type=$(aws codepipeline list-pipeline-executions --region us-east-2 --pipeline-name $pipeline-name --query 'pipelineExecutionSummaries[0].trigger.triggerType'|sed 's/\"//g')
execution_type=$(aws codepipeline list-pipeline-executions --region us-east-2 --pipeline-name $name --query 'pipelineExecutionSummaries[0].trigger.triggerType'|sed 's/\"//g')
if [ "$execution_type" == "Webhook" ]; then
echo "Executed Automatically for $name and $DEPLOYMENT_ID" > /root/yes.txt
else
echo "Executed Manually"
fi
# /tetetess.sh
# TARGET_ID=$(aws deploy list-deployment-targets --deployment-id $DEPLOYMENT_ID --region us-east-2 | jq .targetIds | sed 's/\"//g'| sed 's/\[//g' | sed 's/\]//g')
# aws deploy batch-get-deployment-targets --deployment-id $DEPLOYMENT_ID --region us-east-2 --target-ids $TARGET_ID | grep -i scriptfailed
# if [ $(echo $?) -eq 0 ]; then
# echo "codedeploy failed"
# exit 1
# else
# echo "codedeploy success"
# exit 0