From: Andrew Grimberg Date: Wed, 13 Apr 2022 23:07:30 +0000 (+0000) Subject: Merge "Feat: Append build result to cost file" X-Git-Tag: v0.76.0^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=fca0db4ebfaa82e0acbdfc9310141f5750e532b2;hp=8b1e8a7f02cbf2a43c038cd319077b67e3d39a93;p=releng%2Fglobal-jjb.git Merge "Feat: Append build result to cost file" --- 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"