Print estimate of build job cost 55/24055/4
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 20 Feb 2020 20:39:25 +0000 (21:39 +0100)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 20 Feb 2020 20:50:47 +0000 (21:50 +0100)
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

jjb/ci-AGL-verify/ci-platform-jjb.yaml
jjb/ci-apps-verify/ci-apps-jjb.yaml
jjb/common/include-agl-get-cost.sh [new file with mode: 0644]
jjb/daily-jjb-doc-update/daily-jjb-doc-update.yaml
jjb/pre-fetch/pre-fetch.yaml
jjb/release-jjb-icefish-snapshot/release-jjb-icefish-snapshot.yaml

index 9bb5137..108cc12 100644 (file)
           - ../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
           - ../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:
index 1b0a5a6..7106e58 100644 (file)
           - ../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
 
 
 ################################################################################
           - ../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 (file)
index 0000000..d9ca972
--- /dev/null
@@ -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) ############"
index e95ce9f..270d6b6 100644 (file)
@@ -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
index 183f7c7..d5e3107 100644 (file)
@@ -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
index 3c4c4e4..f05c071 100644 (file)
           - ../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