Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/run: Inject the SSH key via the YAML config #204

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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