Skip to content

Commit 66b0dc0

Browse files
feat: add started and completed
1 parent 6356820 commit 66b0dc0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

modules/platform/ec2_deployment/template_files/hook_job_completed.tftpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
LOG_FILE="$HOME/hook.log"
44
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
55

6+
INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.instanceId')
7+
aws ec2 create-tags --cli-input-json "$(jq -n \
8+
--arg completed_timestamp "$TIMESTAMP" \
9+
'{
10+
Resources: [$instance],
11+
Tags: [
12+
{Key:"ghr:completed_timestamp", Value:$completed_timestamp}
13+
]
14+
}')"
15+
616
{
717
echo "{"
818
echo " \"timestamp\": \"$TIMESTAMP\","

modules/platform/ec2_deployment/template_files/hook_job_started.tftpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ aws ec2 create-tags --cli-input-json "$(jq -n \
1616
--arg run_number "$GITHUB_RUN_NUMBER" \
1717
--arg workflow_url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}" \
1818
--arg actor "$GITHUB_ACTOR" \
19+
--arg started_timestamp "$TIMESTAMP" \
1920
'{
2021
Resources: [$instance],
2122
Tags: [
@@ -28,7 +29,8 @@ aws ec2 create-tags --cli-input-json "$(jq -n \
2829
{Key:"ghr:run_attempt", Value:$run_attempt},
2930
{Key:"ghr:run_number", Value:$run_number},
3031
{Key:"ghr:workflow_url", Value:$workflow_url},
31-
{Key:"ghr:actor", Value:$actor}
32+
{Key:"ghr:actor", Value:$actor},
33+
{Key:"ghr:started_timestamp", Value:$started_timestamp}
3234
]
3335
}')"
3436

0 commit comments

Comments
 (0)