From: Kevin Sandi Date: Thu, 17 Mar 2022 23:04:29 +0000 (-0600) Subject: Feat: Append build result to cost file X-Git-Tag: v0.76.0^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F71%2F69871%2F3;p=releng%2Fglobal-jjb.git Feat: Append build result to cost file Change-Id: I0f08f364432d4f102655dfe80e98d5202a6b0349 Signed-off-by: Kevin Sandi --- diff --git a/job-cost/format-csv b/job-cost/format-csv index 4a6e1140..8c521f23 100755 --- a/job-cost/format-csv +++ b/job-cost/format-csv @@ -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 index 00000000..05aeade9 --- /dev/null +++ b/releasenotes/notes/append-job-status-to-costs-file-ca6935984177f089.yaml @@ -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. diff --git a/shell/job-cost.sh b/shell/job-cost.sh index b856f6a5..e5e18106 100644 --- a/shell/job-cost.sh +++ b/shell/job-cost.sh @@ -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"