Skip to content

Commit

Permalink
get api_key from an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
npalaska committed Apr 17, 2023
1 parent 5996fd1 commit f416632
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 234 deletions.
20 changes: 14 additions & 6 deletions contrib/containerized-pbench/pbench_demo
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ export PB_AGENT_IMAGE_NAME=quay.io/pbench/pbench-agent-all-fedora-36:main

mkdir -p ${FIOTEST}

# Before we run the demo, we need a Pbench authentication token. The token
# location need to be supplied to this script as an argument.
token_location=$1
token=$(< ${token_location})
# Before we run the demo, we need a Pbench API key. The key can be an
# environment variable of PBENCH_API_KEY or need to be supplied to this
# script as an argument.
if [[ $# == 1 ]]; then
api_key=$1
else
api_key=${PBENCH_API_KEY}
fi

if [[ -z "${api_key}" ]]; then
echo "PBENCH_API_KEY is not provided"
exit 1
fi
#+
# Run the demo!
#-
Expand All @@ -33,5 +42,4 @@ pbench pbench-user-benchmark --config example-workload -- \
fio --directory=/fiotest --name fio_test_file --direct=1 --rw=randread \
--bs=16k --size=100M --numjobs=8 --time_based --runtime=5s \
--group_reporting --norandommap
# Note that the token file location below is evaluated -outside- the container.
pbench pbench-results-move --token=token
pbench pbench-results-move --token=${api_key}
224 changes: 0 additions & 224 deletions lib/pbench/test/unit/agent/task/test_generate_token.py

This file was deleted.

16 changes: 12 additions & 4 deletions server/pbenchinacan/load-canned-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ then
exit 2
fi

# Get the Pbench authentication token
token_location=$1
token=$(< ${token_location})
# Get the Pbench authentication API_KEY
if [[ $# == 1 ]]; then
api_key=$1
else
api_key=${PBENCH_API_KEY}
fi

if [[ -z "${api_key}" ]]; then
echo "PBENCH_API_KEY is not provided"
exit 1
fi

# We skip test-7.8, test-7.12, and test-7.15, which have controllers that are
# not legal nodenames, so the server refuses to accept them. We skip test-7.14,
Expand All @@ -52,7 +60,7 @@ done
for ctlr_dir in ${tmp}/pbench/archive/fs-version-001/*; do
for tarball in ${ctlr_dir}/*.tar.xz; do
echo "Pushing $(basename ${ctlr_dir}) $(basename ${tarball}):"
pbench-results-push --token ${token} $(basename ${ctlr_dir}) ${tarball}
pbench-results-push --token ${api_key} $(basename ${ctlr_dir}) ${tarball}
done
done

Expand Down

0 comments on commit f416632

Please sign in to comment.