Skip to content

Commit

Permalink
[ci] Add workflow for autoscaling tests
Browse files Browse the repository at this point in the history
[skip ci]

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Nov 30, 2024
1 parent df1844e commit 31fba3c
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- build-test
if: (contains(toJson(github.event.commits), '[deploy]') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')) && !failure() && !cancelled()
name: Deploy and Release
runs-on: blacksmith-16vcpu-ubuntu-2204
runs-on: blacksmith-8vcpu-ubuntu-2204
permissions: write-all
steps:
- name: Free Disk Space (Ubuntu)
Expand Down
161 changes: 161 additions & 0 deletions .github/workflows/k8s-scaling-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Test Autoscaling

on:
workflow_call:
inputs:
release:
description: 'Test a new release process'
required: false
type: string
default: 'false'
workflow_dispatch:

permissions:
contents: read

jobs:
build-and-test:
name: Test K8s
runs-on: blacksmith-16vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
include:
- k8s-version: 'v1.31.2'
cluster: 'minikube'
helm-version: 'v3.16.3'
docker-version: '27.3.1'
python-version: '3.13'
env:
CLUSTER: ${{ matrix.cluster }}
KUBERNETES_VERSION: ${{ matrix.k8s-version }}
HELM_VERSION: ${{ matrix.helm-version }}
DOCKER_VERSION: ${{ matrix.docker-version }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false
- name: Checkout code
uses: actions/checkout@main
- name: Set up containerd image store feature
uses: nick-invision/retry@master
with:
timeout_minutes: 10
max_attempts: 3
command: |
make setup_dev_env
- name: Output Docker info
run: docker info
- name: Set up Python
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Verify chart configuration up-to-date
run: make lint_readme_charts
- name: Get branch name (only for push to branch)
if: github.event_name == 'push'
run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV
env:
PUSH_BRANCH: ${{ github.ref }}
- name: Get target branch name (only for PRs)
if: github.event_name == 'pull_request'
run: echo "BRANCH=$(echo ${TARGET_BRANCH##*/})" >> $GITHUB_ENV
env:
TARGET_BRANCH: ${{ github.head_ref }}
- name: Output branch name
run: echo ${BRANCH}
- name: Set Selenium base version
uses: ./.github/actions/get-latest-upstream
with:
release: ${{ inputs.release || false }}
gh_cli_token: ${{ secrets.GITHUB_TOKEN }}
- name: Sets build date
run: |
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV
echo "AUTHORS=${AUTHORS}" >> $GITHUB_ENV
env:
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
- name: Build Helm charts
run: |
BUILD_DATE=${BUILD_DATE} make chart_build
echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV
echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV
- name: Build Docker images
uses: nick-invision/retry@master
with:
timeout_minutes: 12
max_attempts: 3
retry_wait_seconds: 60
command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Setup Kubernetes cluster
uses: nick-invision/retry@master
with:
timeout_minutes: 10
max_attempts: 3
command: CLUSTER=${CLUSTER} SERVICE_MESH=${SERVICE_MESH} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup
- name: Test Selenium Grid on Kubernetes with Autoscaling
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_chaos
- name: Upload results
if: always()
uses: actions/upload-artifact@main
with:
name: chart_test_autoscaling_job_count_chaos
path: ./tests/tests/*.md
if-no-files-found: ignore
- name: Test Selenium Grid on Kubernetes with Autoscaling
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_max_sessions
- name: Upload results
if: always()
uses: actions/upload-artifact@main
with:
name: chart_test_autoscaling_job_count_max_sessions
path: ./tests/tests/*.md
if-no-files-found: ignore
- name: Test Selenium Grid on Kubernetes with Autoscaling
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_strategy_accurate
- name: Upload results
if: always()
uses: actions/upload-artifact@main
with:
name: chart_test_autoscaling_job_count_strategy_accurate
path: ./tests/tests/*.md
if-no-files-found: ignore
- name: Test Selenium Grid on Kubernetes with Autoscaling
uses: nick-invision/retry@master
with:
timeout_minutes: 30
max_attempts: 3
command: |
NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count
- name: Upload results
if: always()
uses: actions/upload-artifact@main
with:
name: chart_test_autoscaling_job_count
path: ./tests/tests/*.md
if-no-files-found: ignore
- name: Cleanup Kubernetes cluster
if: always()
run: CLUSTER=${CLUSTER} make chart_cluster_cleanup
- name: Clean up Docker
if: always()
run: docker system prune -af
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- build-test
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && !failure() && !cancelled()
name: Deploy and Release Nightly
runs-on: blacksmith-16vcpu-ubuntu-2204
runs-on: blacksmith-8vcpu-ubuntu-2204
permissions: write-all
steps:
- name: Free Disk Space (Ubuntu)
Expand Down

0 comments on commit 31fba3c

Please sign in to comment.