Skip to content

Commit

Permalink
Merge pull request #204 from wking/smoke-ssh-key-via-config
Browse files Browse the repository at this point in the history
tests/run: Inject the SSH key via the YAML config
  • Loading branch information
openshift-merge-robot authored Sep 5, 2018
2 parents 136752a + 838fd3f commit f2e6b3e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ cp bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test tectonic-dev/smoke
export PATH="${PWD}/tectonic-dev/installer:${PATH}"
cd tectonic-dev

### HANDLE SSH KEY ###
if [ ! -f ~/.ssh/id_rsa.pub ]; then
echo -e "\\e[36m Generating SSH key-pair...\\e[0m"
ssh-keygen -qb 2048 -t rsa -f ~/.ssh/id_rsa -N "" </dev/zero
fi

if test -z "${AWS_REGION+x}"
then
echo -e "\\e[36m Calculating the AWS region...\\e[0m"
Expand All @@ -59,13 +65,16 @@ CONFIGURE_AWS_ROLES=False
echo -e "\\e[36m Creating Tectonic configuration...\\e[0m"
python <<-EOF >"${CLUSTER_NAME}.yaml"
import datetime
import os.path
import sys
import yaml
with open('examples/tectonic.aws.yaml') as f:
config = yaml.load(f)
config['name'] = '${CLUSTER_NAME}'
with open(os.path.expanduser(os.path.join('~', '.ssh', 'id_rsa.pub'))) as f:
config['admin']['sshKey'] = f.read()
config['baseDomain'] = '${DOMAIN}'
config['pullSecretPath'] = '${PULL_SECRET_PATH}'
config['aws']['region'] = '${AWS_REGION}'
Expand All @@ -83,13 +92,6 @@ python <<-EOF >"${CLUSTER_NAME}.yaml"
echo -e "\\e[36m Initializing Tectonic...\\e[0m"
tectonic init --config="${CLUSTER_NAME}".yaml

### HANDLE SSH KEY ###
if [ ! -f ~/.ssh/id_rsa.pub ]; then
echo -e "\\e[36m Generating SSH key-pair...\\e[0m"
ssh-keygen -qb 2048 -t rsa -f ~/.ssh/id_rsa -N "" </dev/zero
fi
export TF_VAR_tectonic_admin_ssh_key="$(cat ~/.ssh/id_rsa.pub)"

echo -e "\\e[36m Deploying Tectonic...\\e[0m"
tectonic install --dir="${CLUSTER_NAME}"
echo -e "\\e[36m Running smoke test...\\e[0m"
Expand Down

0 comments on commit f2e6b3e

Please sign in to comment.