Add CI details script

Dump data about the machine running the test very early in the job run.

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2020-06-05 11:29:59 -05:00 committed by Major Hayden
parent 381abb354a
commit daec7e8234
2 changed files with 34 additions and 0 deletions

View file

@ -23,6 +23,7 @@ pipeline {
AWS_CREDS = credentials('aws-credentials-osbuildci')
}
steps {
sh "schutzbot/ci_details.sh"
sh "schutzbot/mockbuild.sh"
stash (
includes: 'osbuild-mock.repo',
@ -36,6 +37,7 @@ pipeline {
AWS_CREDS = credentials('aws-credentials-osbuildci')
}
steps {
sh "schutzbot/ci_details.sh"
sh "schutzbot/mockbuild.sh"
stash (
includes: 'osbuild-mock.repo',
@ -49,6 +51,7 @@ pipeline {
AWS_CREDS = credentials('aws-credentials-osbuildci')
}
steps {
sh "schutzbot/ci_details.sh"
sh "schutzbot/mockbuild.sh"
stash (
includes: 'osbuild-mock.repo',
@ -126,6 +129,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"

28
schutzbot/ci_details.sh Executable file
View file

@ -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"