Skip to content
Open
Show file tree
Hide file tree
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
184 changes: 184 additions & 0 deletions .github/workflows/smoke-deploy-lab-talos.yaml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
name: Running hyperconverged smoke tests

"on":
workflow_dispatch:
inputs:
acmeEmail:
description: Set email for ACME
required: true
default: "[email protected]"
type: string
gatewayDomain:
description: Set domain for the gateway
required: true
default: cloud.local
type: string
sshUsername:
description: Set SSH username
required: true
default: "ubuntu"
type: choice
options:
- "ubuntu"
- "debian"
mode:
description: Set mode
required: true
default: "test"
type: choice
options:
- "test"
- "deploy"
- "cleanup"
run_tests:
description: Run post-deployment tests
required: false
default: true
type: boolean
test_level:
description: Test level to run
required: false
default: "quick"
type: choice
options:
- "quick"
- "standard"
- "full"
pull_request:
paths:
- ansible/**
- base-kustomize/**
- base-helm-configs/**
- bin/**
- scripts/**
- ".github/workflows/smoke-deploy-lab.yaml"

env:
HYPERCONVERGED_DEV: "true"
GATEWAY_DOMAIN: cloud.local
OS_FLAVOR: gp.5.8.16
JUMP_HOST_FLAVOR: gp.5.2.2
ACME_EMAIL: [email protected]
SSH_USERNAME: "ubuntu"
TEST_LEVEL: "quick"

jobs:
smoke-deploy:
runs-on: self-hosted
container:
image: localhost:5000/genestack-ci:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Dynamically set MY_DATE environment variable
if: ${{ github.event_name == 'pull_request' }}
run: echo "LAB_NAME_PREFIX=smoke-$(date +%s)" >> $GITHUB_ENV

- name: Statically set environment variable
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "LAB_NAME_PREFIX=$(echo '${{ github.event.inputs.gatewayDomain }}' | tr '.' '-')" >> $GITHUB_ENV
echo "GATEWAY_DOMAIN=${{ github.event.inputs.gatewayDomain }}" >> $GITHUB_ENV
echo "ACME_EMAIL=${{ github.event.inputs.acmeEmail }}" >> $GITHUB_ENV
echo "SSH_USERNAME=${{ github.event.inputs.sshUsername }}" >> $GITHUB_ENV

- name: Run deployment script
if: ${{ github.event_name == 'pull_request' || contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode) }}
run: |
eval "$(ssh-agent -s)"
export TEST_LEVEL="${{ github.event.inputs.test_level }}"
scripts/hyperconverged-lab.sh talos

- name: Retrieve Keys
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'deploy' }}
uses: actions/upload-artifact@v4
with:
name: ssh-keys
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
path: "/github/home/.ssh/${{ env.LAB_NAME_PREFIX }}-key.pem"

- name: Create output file in markdown format
run: |
if [ -s /tmp/output.txt ]; then
echo "### Cloud Access" > access-output.txt
cat /tmp/output.txt >> access-output.txt
fi

- name: Publish Output to Summary
run: |
if [ -s access-output.txt ]; then
{
cat access-output.txt
} >> $GITHUB_STEP_SUMMARY
fi

- name: Upload Test Results
if: ${{ always() && (github.event_name == 'pull_request' || (github.event.inputs.run_tests == 'true' && contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode))) }}
uses: actions/upload-artifact@v4
with:
name: test-results-${{ github.run_number }}
path: test-results/
if-no-files-found: ignore
retention-days: 30

- name: Publish Test Summary
if: ${{ always() && (github.event_name == 'pull_request' || (github.event.inputs.run_tests == 'true' && contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode))) }}
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ -f test-results/aggregate-results.txt ]; then
echo "### Test Suite Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY

while IFS=: read -r suite status; do
status=$(echo "$status" | xargs)
if [ "$status" = "PASSED" ]; then
echo "| $suite | :white_check_mark: PASSED |" >> $GITHUB_STEP_SUMMARY
else
echo "| $suite | :x: FAILED |" >> $GITHUB_STEP_SUMMARY
fi
done < test-results/aggregate-results.txt

echo "" >> $GITHUB_STEP_SUMMARY
fi

# Parse XML results if available
if ls test-results/*.xml >/dev/null 2>&1; then
echo "### Detailed Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

for xml_file in test-results/*.xml; do
if [ -f "$xml_file" ]; then
suite_name=$(grep -o 'name="[^"]*"' "$xml_file" | head -1 | sed 's/name="//;s/"//')
echo "#### $suite_name" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY

grep -o '<testcase name="[^"]*"' "$xml_file" | sed 's/<testcase name="//;s/"$//' | while read test; do
if grep -q "name=\"${test}\".*<failure" "$xml_file"; then
echo "| $test | :x: Failed |" >> $GITHUB_STEP_SUMMARY
elif grep -q "name=\"${test}\".*<skipped" "$xml_file"; then
echo "| $test | :warning: Skipped |" >> $GITHUB_STEP_SUMMARY
else
echo "| $test | :white_check_mark: Passed |" >> $GITHUB_STEP_SUMMARY
fi
done

echo "" >> $GITHUB_STEP_SUMMARY
fi
done
fi

if [ ! -f test-results/aggregate-results.txt ] && ! ls test-results/*.xml >/dev/null 2>&1; then
echo "_No test results available_" >> $GITHUB_STEP_SUMMARY
fi

- name: Cleanup the lab
if: ${{ always() && (github.event_name == 'pull_request' || contains(fromJSON('["cleanup", "test"]'), github.event.inputs.mode)) }}
run: scripts/hyperconverged-lab-uninstall.sh talos
5 changes: 3 additions & 2 deletions .github/workflows/smoke-deploy-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ env:
GATEWAY_DOMAIN: cloud.local
ACME_EMAIL: [email protected]
OS_IMAGE: "Ubuntu 24.04"
OS_FLAVOR: gp.5.8.16
SSH_USERNAME: "ubuntu"
TEST_LEVEL: "quick"

Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:
run: |
eval "$(ssh-agent -s)"
export TEST_LEVEL="${{ github.event.inputs.test_level }}"
scripts/hyperconverged-lab.sh
scripts/hyperconverged-lab.sh kubespray

- name: Retrieve Keys
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'deploy' }}
Expand Down Expand Up @@ -190,4 +191,4 @@ jobs:

- name: Cleanup the lab
if: ${{ always() && (github.event_name == 'pull_request' || contains(fromJSON('["cleanup", "test"]'), github.event.inputs.mode)) }}
run: scripts/hyperconverged-lab-uninstall.sh
run: scripts/hyperconverged-lab-uninstall.sh kubespray
15 changes: 3 additions & 12 deletions bin/install-neutron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,9 @@ fi
echo

# Set connection string based on whether we use Kube-OVN TLS
# Hyperconverged build tries to execute the install script without yq in the
# path
function installYq() {
export VERSION=v4.47.2
export BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -q -O - | tar xz && mv ${BINARY} /usr/local/bin/yq
}

if ! yq --version 2> /dev/null; then
echo "yq is not installed. Attempting to install yq"
installYq
fi
# Source functions library for ensureYq
source "${GENESTACK_BASE_DIR}/scripts/lib/functions.sh"
ensureYq

if helm -n kube-system get values kube-ovn \
| yq -e '.networking.ENABLE_SSL == true' >/dev/null 2>&1
Expand Down
15 changes: 3 additions & 12 deletions bin/install-octavia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,9 @@ fi
echo

# Set connection string based on whether we use Kube-OVN TLS
# Hyperconverged build tries to execute the install script without yq in the
# path
function installYq() {
export VERSION=v4.47.2
export BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -q -O - | tar xz && mv ${BINARY} /usr/local/bin/yq
}

if ! yq --version 2> /dev/null; then
echo "yq is not installed. Attempting to install yq"
installYq
fi
# Source functions library for ensureYq
source "${GENESTACK_BASE_DIR}/scripts/lib/functions.sh"
ensureYq

if helm -n kube-system get values kube-ovn \
| yq -e '.networking.ENABLE_SSL == true' >/dev/null 2>&1
Expand Down
18 changes: 8 additions & 10 deletions bin/setup-openstack-rc.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#!/usr/bin/env bash
set -e

function installYq() {
export VERSION=v4.47.2
export BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -q -O - | tar xz && mv ${BINARY} /usr/local/bin/yq
}

if ! yq --version 2> /dev/null; then
echo "yq is not installed. Attempting to install yq"
installYq
fi
# Base directories provided by the environment
GENESTACK_BASE_DIR="${GENESTACK_BASE_DIR:-/opt/genestack}"

# Source functions library for ensureYq
source "${GENESTACK_BASE_DIR}/scripts/lib/functions.sh"

USER_NAME="$(whoami)"
USER_PATH="$(getent passwd ${USER_NAME} | awk -F':' '{print $6}')"
Expand All @@ -19,6 +14,8 @@ CONFIG_FILE="${CONFIG_PATH}/genestack-clouds.yaml"

mkdir -p "${CONFIG_PATH}"

echo "Generating OpenStack RC file at: ${CONFIG_FILE}"

cat > "${CONFIG_FILE}" <<EOF
cache:
auth: true
Expand All @@ -39,6 +36,7 @@ clouds:
EOF

if [ -f "${CONFIG_PATH}/clouds.yaml" ]; then
ensureYq
/usr/local/bin/yq eval-all 'select(filename == "'"${CONFIG_PATH}/clouds.yaml"'") * select(filename == "'"${CONFIG_FILE}"'")' \
"${CONFIG_FILE}" \
"${CONFIG_PATH}/clouds.yaml" | tee "${CONFIG_PATH}/clouds.yaml.tmp"
Expand Down
2 changes: 2 additions & 0 deletions openstack-components.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
# This file is used to determine which services will be installed automatically
# via the hyperconverged lab and in a future release the genestack-installed.
components:
keystone: true
glance: true
Expand Down
47 changes: 47 additions & 0 deletions scripts/hyperconverged-lab-kubespray-uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# shellcheck disable=SC2124,SC2145,SC2294,SC2086,SC2087,SC2155
#
# Hyperconverged Lab Uninstall Script for Kubespray
#
# This script removes all resources created by the Kubespray hyperconverged lab script.
#

set -o pipefail
set -e
SECONDS=0

# Source common uninstall library
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source "${SCRIPT_DIR}/lib/hyperconverged-uninstall-common.sh"

#############################################################################
# Initialize
#############################################################################

promptForCloudConfig

export LAB_NAME_PREFIX="${LAB_NAME_PREFIX:-hyperconverged}"

#############################################################################
# Run Common Uninstall
#############################################################################

runCommonUninstall "${LAB_NAME_PREFIX}"

#############################################################################
# Kubespray-Specific: Delete SSH Keypair and Security Group
#############################################################################

echo "Deleting Kubespray-specific resources..."
keypairDelete ${LAB_NAME_PREFIX}-key
securityGroupDelete ${LAB_NAME_PREFIX}-jump-secgroup

#############################################################################
# Cleanup Complete
#############################################################################

echo "Cleanup complete"
echo "The Kubespray lab uninstall took ${SECONDS} seconds to complete."
echo ""
echo "Note: Local SSH key files (~/.ssh/${LAB_NAME_PREFIX}-key.pem, ~/.ssh/${LAB_NAME_PREFIX}-key.pub)"
echo "were NOT removed. Delete them manually if no longer needed."
Loading