Skip to content

Commit 8d8685d

Browse files
committed
feat: add per-pr smoke tests
This change will build a simple three node cloud environment on-top of openstack flex in dfw. The job will build, evaluate, and return the state of the build upon completion. The hyperconverged lab script is used to run the base test. The new job will also ensure that it cleans up resources built no matter the state of the build. Signed-off-by: Kevin Carter <[email protected]>
1 parent f75cc41 commit 8d8685d

File tree

2 files changed

+53
-8
lines changed

2 files changed

+53
-8
lines changed
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Running hyperconverged smoke tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ansible/**
7+
- base-kustomize/**
8+
- base-helm-configs/**
9+
- bin/**
10+
- scripts/**
11+
12+
env:
13+
HYPERCONVERGED_DEV: "true"
14+
GATEWAY_DOMAIN: cloud.local
15+
ACME_EMAIL: [email protected]
16+
OS_IMAGE: "Ubuntu 24.04"
17+
SSH_USERNAME: "ubuntu"
18+
19+
jobs:
20+
smoke-deploy:
21+
runs-on: self-hosted
22+
container:
23+
image: localhost:5000/genestack-ci:latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Dynamically set MY_DATE environment variable
29+
run: echo "LAB_NAME_PREFIX=smoke-$(date +%s)" >> $GITHUB_ENV
30+
31+
- name: Run deployment script
32+
run: |
33+
eval "$(ssh-agent -s)"
34+
scripts/hyperconverged-lab.sh
35+
36+
- name: Cleanup the lab
37+
if: always()
38+
run: scripts/hyperconverged-lab-uninstall.sh

scripts/hyperconverged-lab.sh

+15-8
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ if ! COMPUTE_2_PORT=$(openstack port show ${LAB_NAME_PREFIX}-2-compute-port -f v
246246
)
247247
fi
248248

249+
if [ ! -d "~/.ssh" ]; then
250+
echo "Creating the SSH directory"
251+
mkdir -p ~/.ssh
252+
chmod 700 ~/.ssh
253+
fi
249254
if ! openstack keypair show ${LAB_NAME_PREFIX}-key 2> /dev/null; then
250255
if [ ! -f ~/.ssh/${LAB_NAME_PREFIX}-key.pem ]; then
251256
openstack keypair create ${LAB_NAME_PREFIX}-key > ~/.ssh/${LAB_NAME_PREFIX}-key.pem
@@ -290,11 +295,11 @@ fi
290295

291296
echo "Waiting for the jump host to be ready"
292297
COUNT=0
293-
while ! ssh -o ConnectTimeout=2 -o ConnectionAttempts=3 -o UserKnownHostsFile=/dev/null -q ${SSH_USERNAME}@${JUMP_HOST_VIP} exit; do
298+
while ! ssh -o ConnectTimeout=2 -o ConnectionAttempts=3 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -q ${SSH_USERNAME}@${JUMP_HOST_VIP} exit; do
294299
sleep 2
295300
echo "SSH is not ready, Trying again..."
296301
COUNT=$((COUNT+1))
297-
if [ $COUNT -gt 30 ]; then
302+
if [ $COUNT -gt 60 ]; then
298303
echo "Failed to ssh into the jump host"
299304
exit 1
300305
fi
@@ -307,16 +312,16 @@ if [ "${HYPERCONVERGED_DEV:-false}" = "true" ]; then
307312
echo "HYPERCONVERGED_DEV is true, but we've failed to determine the base genestack directory"
308313
exit 1
309314
fi
310-
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -t ${SSH_USERNAME}@${JUMP_HOST_VIP} \
315+
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t ${SSH_USERNAME}@${JUMP_HOST_VIP} \
311316
"timeout 1m bash -c 'while ! sudo apt update; do sleep 2; done' && sudo apt install -y rsync git"
312317
echo "Copying the development source code to the jump host"
313318
rsync -az \
314-
-e "ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null" \
319+
-e "ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
315320
--rsync-path="sudo rsync" \
316321
$(readlink -fn ${SCRIPT_DIR}/../) ${SSH_USERNAME}@${JUMP_HOST_VIP}:/opt/
317322
fi
318323

319-
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
324+
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
320325
set -e
321326
if [ ! -d "/opt/genestack" ]; then
322327
sudo git clone --recurse-submodules -j4 https://github.com./rackerlabs/genestack /opt/genestack
@@ -468,6 +473,8 @@ if [ ! -f "/etc/genestack/helm-configs/glance/glance-helm-overrides.yaml" ]; the
468473
cat > /etc/genestack/helm-configs/glance/glance-helm-overrides.yaml <<EOF
469474
conf:
470475
glance:
476+
DEFAULT:
477+
workers: 2
471478
oslo_messaging_notifications:
472479
driver: noop
473480
glance_api_uwsgi:
@@ -616,7 +623,7 @@ fi
616623
EOC
617624

618625
# Run host and K8S setup
619-
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
626+
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
620627
set -e
621628
if [ ! -f "/usr/local/bin/queue_max.sh" ]; then
622629
python3 -m venv ~/.venvs/genestack
@@ -648,7 +655,7 @@ popd
648655
EOC
649656

650657
# Run Genestack Infrastucture/OpenStack Setup
651-
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
658+
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
652659
set -e
653660
echo "Installing OpenStack Infrastructure"
654661
sudo LONGHORN_STORAGE_REPLICAS=1 \
@@ -661,7 +668,7 @@ sudo /opt/genestack/bin/setup-openstack.sh
661668
EOC
662669

663670
# Run Genestack post setup
664-
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
671+
ssh -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t ${SSH_USERNAME}@${JUMP_HOST_VIP} <<EOC
665672
set -e
666673
sudo bash <<HERE
667674
sudo /opt/genestack/bin/setup-openstack-rc.sh

0 commit comments

Comments
 (0)