Skip to content

Commit

Permalink
Merge pull request #962 from replicatedhq/laverya/report-testgrid-met…
Browse files Browse the repository at this point in the history
…rics

read testgrid ID from disk during kurl install
  • Loading branch information
laverya authored Dec 10, 2020
2 parents fb91283 + 537ecad commit 793071c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/common/reporting.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


INSTALLATION_ID=
TESTGRID_ID=
function report_install_start() {
# report that the install started
# this includes the install ID, time, kurl URL, HA status, server CPU count and memory size, and linux distribution name + version.
Expand All @@ -13,8 +14,12 @@ function report_install_start() {
INSTALLATION_ID=$(< /dev/urandom tr -dc a-z0-9 | head -c16)
local started=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # rfc3339

if [ -f "/tmp/testgrid-id" ]; then
TESTGRID_ID=$(cat /tmp/testgrid-id)
fi

curl -s --output /dev/null -H 'Content-Type: application/json' --max-time 5 \
-d "{\"started\": \"$started\", \"os\": \"$LSB_DIST $DIST_VERSION\", \"kernel_version\": \"$KERNEL_MAJOR.$KERNEL_MINOR\", \"kurl_url\": \"$KURL_URL\", \"installer_id\": \"$INSTALLER_ID\", \"testgrid_id\": \"$TEST_ID\"}" \
-d "{\"started\": \"$started\", \"os\": \"$LSB_DIST $DIST_VERSION\", \"kernel_version\": \"$KERNEL_MAJOR.$KERNEL_MINOR\", \"kurl_url\": \"$KURL_URL\", \"installer_id\": \"$INSTALLER_ID\", \"testgrid_id\": \"$TESTGRID_ID\"}" \
$REPLICATED_APP_URL/kurl_metrics/start_install/$INSTALLATION_ID
}

Expand Down Expand Up @@ -46,7 +51,7 @@ function report_addon_start() {
local started=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # rfc3339

curl -s --output /dev/null -H 'Content-Type: application/json' --max-time 5 \
-d "{\"started\": \"$started\", \"addon_version\": \"$version\"}" \
-d "{\"started\": \"$started\", \"addon_version\": \"$version\", \"testgrid_id\": \"$TESTGRID_ID\"}" \
$REPLICATED_APP_URL/kurl_metrics/start_addon/$INSTALLATION_ID/$name
}

Expand Down
2 changes: 2 additions & 0 deletions testgrid/tgrun/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ curl -X POST $TESTGRID_APIENDPOINT/v1/instance/$TEST_ID/running
echo "running kurl installer"
echo "$TEST_ID" > /tmp/testgrid-id
if [ ! -c /dev/urandom ]; then
/bin/mknod -m 0666 /dev/urandom c 1 9 && /bin/chown root:root /dev/urandom
fi
Expand Down

0 comments on commit 793071c

Please sign in to comment.