Feat: Append build result to cost file 71/69871/3
authorKevin Sandi <ksandi@contractor.linuxfoundation.org>
Thu, 17 Mar 2022 23:04:29 +0000 (17:04 -0600)
committerKevin Sandi <ksandi@contractor.linuxfoundation.org>
Wed, 23 Mar 2022 22:11:21 +0000 (16:11 -0600)
Change-Id: I0f08f364432d4f102655dfe80e98d5202a6b0349
Signed-off-by: Kevin Sandi <ksandi@contractor.linuxfoundation.org>
job-cost/format-csv
releasenotes/notes/append-job-status-to-costs-file-ca6935984177f089.yaml [new file with mode: 0644]
shell/job-cost.sh

index 4a6e114..8c521f2 100755 (executable)
@@ -16,8 +16,8 @@ set -euf
 
 cost_file=$1
 
-while IFS="," read -r job_name build_number date resource uptime cost stack_cost; do
+while IFS="," read -r job_name build_number date resource uptime cost stack_cost build_result; do
     [[ $resource == "0" ]] && resource='unknown'
-    printf "%s,%s,%s,%s,%d,%.2f,%.2f\n" "$job_name" "$build_number" "$date" \
-           "$resource" "$uptime" "$cost" "$stack_cost"
+    printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "$job_name" "$build_number" "$date" \
+           "$resource" "$uptime" "$cost" "$stack_cost" "$build_result"
 done < "$cost_file"
diff --git a/releasenotes/notes/append-job-status-to-costs-file-ca6935984177f089.yaml b/releasenotes/notes/append-job-status-to-costs-file-ca6935984177f089.yaml
new file mode 100644 (file)
index 0000000..05aeade
--- /dev/null
@@ -0,0 +1,6 @@
+---
+features:
+  - |
+    Append build result to cost.csv file. This would be useful to capture stats
+    for unattended jobs and potentially send out reports to PTL's on resource
+    usage stats.
index b856f6a..e5e1810 100644 (file)
@@ -85,5 +85,5 @@ echo "INFO: Archiving Costs"
 date=$(TZ=GMT date +'%Y-%m-%d %H:%M:%S')
 
 # Format the uptime, cost & stack_cost fields
-printf "%s,%s,%s,%s,%d,%.2f,%.2f\n" "$JOB_NAME" "$BUILD_NUMBER" "$date" \
-       "$resource" "$uptime" "$cost" "$stack_cost" > "$WORKSPACE/archives/cost.csv"
+printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "$JOB_NAME" "$BUILD_NUMBER" "$date" \
+       "$resource" "$uptime" "$cost" "$stack_cost" "$BUILD_RESULT" > "$WORKSPACE/archives/cost.csv"