|
| 1 | +name: Test Autoscaling |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + release: |
| 7 | + description: 'Test a new release process' |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: 'false' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-and-test: |
| 18 | + name: Test K8s |
| 19 | + runs-on: blacksmith-16vcpu-ubuntu-2204 |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + include: |
| 24 | + - k8s-version: 'v1.31.2' |
| 25 | + cluster: 'minikube' |
| 26 | + helm-version: 'v3.16.3' |
| 27 | + docker-version: '27.3.1' |
| 28 | + python-version: '3.13' |
| 29 | + env: |
| 30 | + CLUSTER: ${{ matrix.cluster }} |
| 31 | + KUBERNETES_VERSION: ${{ matrix.k8s-version }} |
| 32 | + HELM_VERSION: ${{ matrix.helm-version }} |
| 33 | + DOCKER_VERSION: ${{ matrix.docker-version }} |
| 34 | + steps: |
| 35 | + - name: Free Disk Space (Ubuntu) |
| 36 | + uses: jlumbroso/free-disk-space@main |
| 37 | + with: |
| 38 | + tool-cache: false |
| 39 | + large-packages: false |
| 40 | + - name: Checkout code |
| 41 | + uses: actions/checkout@main |
| 42 | + - name: Set up containerd image store feature |
| 43 | + uses: nick-invision/retry@master |
| 44 | + with: |
| 45 | + timeout_minutes: 10 |
| 46 | + max_attempts: 3 |
| 47 | + command: | |
| 48 | + make setup_dev_env |
| 49 | + - name: Output Docker info |
| 50 | + run: docker info |
| 51 | + - name: Set up Python |
| 52 | + uses: actions/setup-python@main |
| 53 | + with: |
| 54 | + python-version: ${{ matrix.python-version }} |
| 55 | + check-latest: true |
| 56 | + - name: Verify chart configuration up-to-date |
| 57 | + run: make lint_readme_charts |
| 58 | + - name: Get branch name (only for push to branch) |
| 59 | + if: github.event_name == 'push' |
| 60 | + run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV |
| 61 | + env: |
| 62 | + PUSH_BRANCH: ${{ github.ref }} |
| 63 | + - name: Get target branch name (only for PRs) |
| 64 | + if: github.event_name == 'pull_request' |
| 65 | + run: echo "BRANCH=$(echo ${TARGET_BRANCH##*/})" >> $GITHUB_ENV |
| 66 | + env: |
| 67 | + TARGET_BRANCH: ${{ github.head_ref }} |
| 68 | + - name: Output branch name |
| 69 | + run: echo ${BRANCH} |
| 70 | + - name: Set Selenium base version |
| 71 | + uses: ./.github/actions/get-latest-upstream |
| 72 | + with: |
| 73 | + release: ${{ inputs.release || false }} |
| 74 | + gh_cli_token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + - name: Sets build date |
| 76 | + run: | |
| 77 | + echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV |
| 78 | + echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV |
| 79 | + echo "AUTHORS=${AUTHORS}" >> $GITHUB_ENV |
| 80 | + env: |
| 81 | + AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }} |
| 82 | + - name: Build Helm charts |
| 83 | + run: | |
| 84 | + BUILD_DATE=${BUILD_DATE} make chart_build |
| 85 | + echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV |
| 86 | + echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV |
| 87 | + - name: Build Docker images |
| 88 | + uses: nick-invision/retry@master |
| 89 | + with: |
| 90 | + timeout_minutes: 12 |
| 91 | + max_attempts: 3 |
| 92 | + retry_wait_seconds: 60 |
| 93 | + command: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build |
| 94 | + - name: Setup Kubernetes cluster |
| 95 | + uses: nick-invision/retry@master |
| 96 | + with: |
| 97 | + timeout_minutes: 10 |
| 98 | + max_attempts: 3 |
| 99 | + command: CLUSTER=${CLUSTER} SERVICE_MESH=${SERVICE_MESH} KUBERNETES_VERSION=${KUBERNETES_VERSION} NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup |
| 100 | + - name: Test Selenium Grid on Kubernetes with Autoscaling |
| 101 | + uses: nick-invision/retry@master |
| 102 | + with: |
| 103 | + timeout_minutes: 30 |
| 104 | + max_attempts: 3 |
| 105 | + command: | |
| 106 | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_chaos |
| 107 | + - name: Upload results |
| 108 | + if: always() |
| 109 | + uses: actions/upload-artifact@main |
| 110 | + with: |
| 111 | + name: chart_test_autoscaling_job_count_chaos |
| 112 | + path: ./tests/tests/*.md |
| 113 | + if-no-files-found: ignore |
| 114 | + - name: Test Selenium Grid on Kubernetes with Autoscaling |
| 115 | + uses: nick-invision/retry@master |
| 116 | + with: |
| 117 | + timeout_minutes: 30 |
| 118 | + max_attempts: 3 |
| 119 | + command: | |
| 120 | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_max_sessions |
| 121 | + - name: Upload results |
| 122 | + if: always() |
| 123 | + uses: actions/upload-artifact@main |
| 124 | + with: |
| 125 | + name: chart_test_autoscaling_job_count_max_sessions |
| 126 | + path: ./tests/tests/*.md |
| 127 | + if-no-files-found: ignore |
| 128 | + - name: Test Selenium Grid on Kubernetes with Autoscaling |
| 129 | + uses: nick-invision/retry@master |
| 130 | + with: |
| 131 | + timeout_minutes: 30 |
| 132 | + max_attempts: 3 |
| 133 | + command: | |
| 134 | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count_strategy_accurate |
| 135 | + - name: Upload results |
| 136 | + if: always() |
| 137 | + uses: actions/upload-artifact@main |
| 138 | + with: |
| 139 | + name: chart_test_autoscaling_job_count_strategy_accurate |
| 140 | + path: ./tests/tests/*.md |
| 141 | + if-no-files-found: ignore |
| 142 | + - name: Test Selenium Grid on Kubernetes with Autoscaling |
| 143 | + uses: nick-invision/retry@master |
| 144 | + with: |
| 145 | + timeout_minutes: 30 |
| 146 | + max_attempts: 3 |
| 147 | + command: | |
| 148 | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} TEST_UPGRADE_CHART=false make chart_test_autoscaling_job_count |
| 149 | + - name: Upload results |
| 150 | + if: always() |
| 151 | + uses: actions/upload-artifact@main |
| 152 | + with: |
| 153 | + name: chart_test_autoscaling_job_count |
| 154 | + path: ./tests/tests/*.md |
| 155 | + if-no-files-found: ignore |
| 156 | + - name: Cleanup Kubernetes cluster |
| 157 | + if: always() |
| 158 | + run: CLUSTER=${CLUSTER} make chart_cluster_cleanup |
| 159 | + - name: Clean up Docker |
| 160 | + if: always() |
| 161 | + run: docker system prune -af |
0 commit comments