From 4364b0a181b1f560ec8ca8de6cf7ed3acc9bb69e Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Fri, 5 Jun 2020 11:29:19 -0500 Subject: [PATCH] Add CI details script Dump the machine specs for the system running the CI job very early during the job run. Signed-off-by: Major Hayden --- schutzbot/Jenkinsfile | 6 ++++++ schutzbot/ci_details.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 schutzbot/ci_details.sh diff --git a/schutzbot/Jenkinsfile b/schutzbot/Jenkinsfile index e79cace3e..bdd4b177f 100644 --- a/schutzbot/Jenkinsfile +++ b/schutzbot/Jenkinsfile @@ -29,6 +29,7 @@ pipeline { AWS_CREDS = credentials('aws-credentials-osbuildci') } steps { + sh "schutzbot/ci_details.sh" sh "schutzbot/mockbuild.sh" stash ( includes: 'osbuild-mock.repo', @@ -42,6 +43,7 @@ pipeline { AWS_CREDS = credentials('aws-credentials-osbuildci') } steps { + sh "schutzbot/ci_details.sh" sh "schutzbot/mockbuild.sh" stash ( includes: 'osbuild-mock.repo', @@ -55,6 +57,7 @@ pipeline { AWS_CREDS = credentials('aws-credentials-osbuildci') } steps { + sh "schutzbot/ci_details.sh" sh "schutzbot/mockbuild.sh" stash ( includes: 'osbuild-mock.repo', @@ -180,6 +183,9 @@ pipeline { // need to copy/paste the same lines over and over above. void run_tests() { + // Get CI machine details. + sh "schutzbot/ci_details.sh" + // Run the tests from the repository. sh "schutzbot/run_tests.sh" diff --git a/schutzbot/ci_details.sh b/schutzbot/ci_details.sh new file mode 100755 index 000000000..28f5b329d --- /dev/null +++ b/schutzbot/ci_details.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Dumps details about the instance running the CI job. + +PRIMARY_IP=$(ip route get 8.8.8.8 | head -n 1 | cut -d' ' -f7) +EXTERNAL_IP=$(curl --retry 5 -s -4 icanhazip.com) +PTR=$(curl --retry 5 -s -4 icanhazptr.com) +CPUS=$(nproc) +MEM=$(free -m | grep -oP '\d+' | head -n 1) +DISK=$(df --output=size -h / | sed '1d;s/[^0-9]//g') +HOSTNAME=$(uname -n) + +echo -e "\033[0;36m" +cat << EOF +------------------------------------------------------------------------------ +CI MACHINE SPECS +------------------------------------------------------------------------------ + + Hostname: ${HOSTNAME} + Primary IP: ${PRIMARY_IP} + External IP: ${EXTERNAL_IP} + Reverse DNS: ${PTR} + CPUs: ${CPUS} + RAM: ${MEM} GB + DISK: ${DISK} GB + +------------------------------------------------------------------------------ +EOF +echo -e "\033[0m" \ No newline at end of file