aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-02-20 21:39:25 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-02-20 21:50:47 +0100
commit1933ef9d1c4f632edfb24137f9b6630a382c9d3f (patch)
tree0a3eec1a0d231c7995b09e1e4fa856d55e356e69
parentd0be42c102083fdad729685ebc41a258fc99654a (diff)
Print estimate of build job cost
Retrieve the approximate cost of the build job. There is no api call for our instance flavour, so use close match. Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> Change-Id: I7ea96ccabc76550989aa0dcb97b3806f0dd2e047
-rw-r--r--jjb/ci-AGL-verify/ci-platform-jjb.yaml13
-rw-r--r--jjb/ci-apps-verify/ci-apps-jjb.yaml12
-rw-r--r--jjb/common/include-agl-get-cost.sh17
-rw-r--r--jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml6
-rw-r--r--jjb/pre-fetch/pre-fetch.yaml6
-rw-r--r--jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml6
6 files changed, 60 insertions, 0 deletions
diff --git a/jjb/ci-AGL-verify/ci-platform-jjb.yaml b/jjb/ci-AGL-verify/ci-platform-jjb.yaml
index 9bb5137f..108cc121 100644
--- a/jjb/ci-AGL-verify/ci-platform-jjb.yaml
+++ b/jjb/ci-AGL-verify/ci-platform-jjb.yaml
@@ -334,6 +334,13 @@
- ../common/include-agl-bitbake-image.sh
- ../common/include-agl-run-test-prepare.sh
- ../common/include-agl-run-test-rsync-changeid.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
+
# publishers:
# - naginator:
# rerun-unstable-builds: true
@@ -562,6 +569,12 @@
- ../common/include-agl-lava-labs-prepare.sh
- ../common/include-agl-run-test-short.sh
- ../common/include-agl-lava-jobs-submit.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
# publishers:
# - naginator:
diff --git a/jjb/ci-apps-verify/ci-apps-jjb.yaml b/jjb/ci-apps-verify/ci-apps-jjb.yaml
index 1b0a5a6e..7106e586 100644
--- a/jjb/ci-apps-verify/ci-apps-jjb.yaml
+++ b/jjb/ci-apps-verify/ci-apps-jjb.yaml
@@ -200,6 +200,12 @@
- ../common/include-apps-build-app.sh
- ../common/include-apps-prepare-upload-folder.sh
- ../common/include-apps-rsync-download-changeid.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
################################################################################
@@ -725,6 +731,12 @@
- ../common/include-agl-lava-labs-prepare.sh
- ../common/include-agl-app-run-test-short.sh
- ../common/include-agl-lava-jobs-submit.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
#
# CIBT-start
diff --git a/jjb/common/include-agl-get-cost.sh b/jjb/common/include-agl-get-cost.sh
new file mode 100644
index 00000000..d9ca9725
--- /dev/null
+++ b/jjb/common/include-agl-get-cost.sh
@@ -0,0 +1,17 @@
+echo "########## Job cost (estimate) ############"
+
+set +e
+#set -x
+# Retrieve the current uptime (in seconds)
+uptime=$(awk '{print $1}' /proc/uptime)
+# Convert to integer by truncating fractional part' and round up by one
+((uptime=${uptime%\.*}+1))
+instance_type=$(curl -s http://169.254.169.254/latest/meta-data/instance-type | sed -e "s#-iops##g")
+#echo "INFO: Retrieving Pricing Info for: $instance_type"
+url="https://pricing.vexxhost.net/v1/pricing/$instance_type/cost?seconds=$uptime"
+#echo "url=$url"
+json_block=$(curl -s "$url")
+echo "$json_block"
+
+set -e
+echo "########## Job cost (estimate) ############"
diff --git a/jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml b/jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml
index e95ce9f4..270d6b66 100644
--- a/jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml
+++ b/jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml
@@ -33,3 +33,9 @@
!include-raw-escape: include-doc-update.sh
- shell:
!include-raw-escape: include-doc-upload.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
diff --git a/jjb/pre-fetch/pre-fetch.yaml b/jjb/pre-fetch/pre-fetch.yaml
index 183f7c79..d5e31075 100644
--- a/jjb/pre-fetch/pre-fetch.yaml
+++ b/jjb/pre-fetch/pre-fetch.yaml
@@ -28,3 +28,9 @@
!include-raw-escape: include-prefetch.sh
- shell:
!include-raw-escape: include-rsync-prefetch.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh
diff --git a/jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml b/jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml
index 3c4c4e4b..f05c0710 100644
--- a/jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml
+++ b/jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml
@@ -124,3 +124,9 @@
- ../common/include-agl-lava-labs-prepare.sh
- ../common/include-agl-run-test-short-icefish.sh
- ../common/include-agl-lava-jobs-submit-only.sh
+ - conditional-step:
+ condition-kind: always
+ steps:
+ - shell:
+ !include-raw-escape:
+ - ../common/include-agl-get-cost.sh