Skip to content

Commit ea46846

Browse files
authored
[ci] Automic update browser versions matrix and workflow (#2945)
Signed-off-by: Viet Nguyen Duc <[email protected]> [skip ci]
1 parent 4aef2ac commit ea46846

File tree

13 files changed

+238
-43
lines changed

13 files changed

+238
-43
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ jobs:
169169
run: |
170170
make generate_latest_sbom
171171
make fetch_grid_scaler_resources
172+
make update_browser_versions_matrix
172173
- name: Tag browser images
173174
if: github.event.inputs.skip-build-push-image != 'true'
174175
uses: nick-invision/retry@master

.github/workflows/release-chrome-versions.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
browser-versions:
3232
description: 'List browser version to build. E.g: [130, 131]'
3333
required: true
34-
default: '[95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138]'
34+
default: '[95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139]'
3535
push-image:
3636
description: 'Push image after testing successfully'
3737
required: true
@@ -61,6 +61,7 @@ jobs:
6161
permissions: write-all
6262
strategy:
6363
fail-fast: false
64+
max-parallel: 10
6465
matrix:
6566
browser-version: ${{ fromJSON(github.event.inputs.browser-versions)}}
6667
outputs:
@@ -106,12 +107,6 @@ jobs:
106107
run: |
107108
echo ${GRID_VERSION}
108109
echo "GRID_VERSION=${GRID_VERSION}" >> "$GITHUB_OUTPUT"
109-
- name: Fetch latest version
110-
run: |
111-
python3 -m pip install -r tests/requirements.txt
112-
python3 tests/build-backward-compatible/fetch_firefox_version.py
113-
python3 tests/build-backward-compatible/fetch_version.py
114-
make update_selenium_version_matrix
115110
- name: Login Docker Hub
116111
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
117112
env:
@@ -124,6 +119,7 @@ jobs:
124119
max_attempts: 3
125120
retry_wait_seconds: 60
126121
command: |
122+
make update_browser_versions_matrix
127123
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} ${REUSE_BASE}
128124
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
129125
- name: Build Hub image for testing
@@ -177,10 +173,7 @@ jobs:
177173
- name: Create CHANGELOG directory
178174
run: mkdir -p ./CHANGELOG/${{ env.GRID_VERSION }}
179175
- name: Fetch latest version
180-
run: |
181-
python3 -m pip install -r tests/requirements.txt
182-
python3 tests/build-backward-compatible/fetch_version.py
183-
make update_selenium_version_matrix
176+
run: make update_browser_versions_matrix
184177
- name: Download results
185178
uses: actions/download-artifact@v5
186179
with:

.github/workflows/release-edge-versions.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
permissions: write-all
6262
strategy:
6363
fail-fast: false
64+
max-parallel: 10
6465
matrix:
6566
browser-version: ${{ fromJSON(github.event.inputs.browser-versions)}}
6667
outputs:
@@ -106,12 +107,6 @@ jobs:
106107
run: |
107108
echo ${GRID_VERSION}
108109
echo "GRID_VERSION=${GRID_VERSION}" >> "$GITHUB_OUTPUT"
109-
- name: Fetch latest version
110-
run: |
111-
python3 -m pip install -r tests/requirements.txt
112-
python3 tests/build-backward-compatible/fetch_firefox_version.py
113-
python3 tests/build-backward-compatible/fetch_version.py
114-
make update_selenium_version_matrix
115110
- name: Login Docker Hub
116111
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
117112
env:
@@ -124,6 +119,7 @@ jobs:
124119
max_attempts: 3
125120
retry_wait_seconds: 60
126121
command: |
122+
make update_browser_versions_matrix
127123
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} ${REUSE_BASE}
128124
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
129125
- name: Build Hub image for testing
@@ -177,10 +173,7 @@ jobs:
177173
- name: Create CHANGELOG directory
178174
run: mkdir -p ./CHANGELOG/${{ env.GRID_VERSION }}
179175
- name: Fetch latest version
180-
run: |
181-
python3 -m pip install -r tests/requirements.txt
182-
python3 tests/build-backward-compatible/fetch_version.py
183-
make update_selenium_version_matrix
176+
run: make update_browser_versions_matrix
184177
- name: Download results
185178
uses: actions/download-artifact@v5
186179
with:

.github/workflows/release-firefox-versions.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
browser-versions:
3232
description: 'List browser version to build. E.g: [130, 131]'
3333
required: true
34-
default: '[98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140]'
34+
default: '[98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141]'
3535
push-image:
3636
description: 'Push image after testing successfully'
3737
required: true
@@ -61,6 +61,7 @@ jobs:
6161
permissions: write-all
6262
strategy:
6363
fail-fast: false
64+
max-parallel: 10
6465
matrix:
6566
browser-version: ${{ fromJSON(github.event.inputs.browser-versions)}}
6667
outputs:
@@ -106,12 +107,6 @@ jobs:
106107
run: |
107108
echo ${GRID_VERSION}
108109
echo "GRID_VERSION=${GRID_VERSION}" >> "$GITHUB_OUTPUT"
109-
- name: Fetch latest version
110-
run: |
111-
python3 -m pip install -r tests/requirements.txt
112-
python3 tests/build-backward-compatible/fetch_firefox_version.py
113-
python3 tests/build-backward-compatible/fetch_version.py
114-
make update_selenium_version_matrix
115110
- name: Login Docker Hub
116111
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
117112
env:
@@ -124,6 +119,7 @@ jobs:
124119
max_attempts: 3
125120
retry_wait_seconds: 60
126121
command: |
122+
make update_browser_versions_matrix
127123
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} ${REUSE_BASE}
128124
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
129125
- name: Build Hub image for testing
@@ -177,11 +173,7 @@ jobs:
177173
- name: Create CHANGELOG directory
178174
run: mkdir -p ./CHANGELOG/${{ env.GRID_VERSION }}
179175
- name: Fetch latest version
180-
run: |
181-
python3 -m pip install -r tests/requirements.txt
182-
python3 tests/build-backward-compatible/fetch_firefox_version.py
183-
python3 tests/build-backward-compatible/fetch_version.py
184-
make update_selenium_version_matrix
176+
run: make update_browser_versions_matrix
185177
- name: Download results
186178
uses: actions/download-artifact@v5
187179
with:

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,31 @@ format_shell_scripts:
8787
fi ; \
8888
exit $$EXIT_CODE
8989

90+
install_python_deps:
91+
python3 -m pip install -r tests/requirements.txt --break-system-packages
92+
93+
format_python_scripts: install_python_deps
94+
python3 -m isort tests/ ; \
95+
python3 -m black --line-length=120 --skip-string-normalization tests/
96+
9097
generate_readme_charts:
9198
if [ ! -f $$HOME/go/bin/helm-docs ] ; then \
9299
echo "helm-docs is not installed. Please install it or run 'make setup_dev_env' once." ; \
93100
else \
94101
$$HOME/go/bin/helm-docs --chart-search-root charts/selenium-grid --output-file CONFIGURATION.md --sort-values-order file ; \
95102
fi
96103

97-
update_list_env_vars:
98-
python3 -m pip install -r tests/requirements.txt ; \
104+
update_list_env_vars: install_python_deps
99105
python3 scripts/generate_list_env_vars/extract_env.py
100106

101-
update_selenium_version_matrix:
107+
update_selenium_version_matrix: install_python_deps
102108
python3 tests/build-backward-compatible/add_selenium_version.py $(BASE_VERSION)
103109

110+
update_browser_versions_matrix: update_selenium_version_matrix
111+
python3 tests/build-backward-compatible/fetch_firefox_version.py ; \
112+
python3 tests/build-backward-compatible/fetch_version.py ; \
113+
python3 tests/build-backward-compatible/update_workflow_versions.py
114+
104115
lint_readme_charts: generate_readme_charts
105116
git diff --stat --exit-code ; \
106117
EXIT_CODE=$$? ; \

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,12 @@ In generic, the script takes the following arguments:
15071507
- `$3` (optional): browser name. If not provided, it will iterate over all the browsers (`chrome`, `edge`, `firefox`)
15081508
- `$4` (optional): Push image to registry. By default, it is `false`. If you want to push the image to the registry, set it to `true` (required Docker login to your namespace done before running the script).
15091509
1510+
To update the browser versions matrix, you can run the following command:
1511+
1512+
```bash
1513+
make update_browser_versions_matrix
1514+
```
1515+
15101516
To set your namespace for the images, you can set the environment variable `NAME` before running the script. For example:
15111517
15121518
```bash

charts/selenium-grid/multiple-nodes-platform-version.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ crossBrowsers:
1313
hpa:
1414
platformName: 'Linux'
1515
browserVersion: ''
16+
- nameOverride: '{{ $.Release.Name }}-node-chrome-139'
17+
imageTag: '139.0-20250808'
18+
hpa:
19+
platformName: 'Linux'
20+
browserVersion: '139.0'
1621
- nameOverride: '{{ $.Release.Name }}-node-chrome-138'
1722
imageTag: '138.0-20250808'
1823
hpa:
@@ -455,6 +460,11 @@ crossBrowsers:
455460
hpa:
456461
platformName: 'Linux'
457462
browserVersion: ''
463+
- nameOverride: '{{ $.Release.Name }}-node-edge-139'
464+
imageTag: '139.0-20250808'
465+
hpa:
466+
platformName: 'Linux'
467+
browserVersion: '139.0'
458468
- nameOverride: '{{ $.Release.Name }}-node-edge-138'
459469
imageTag: '138.0-20250808'
460470
hpa:

tests/build-backward-compatible/browser-matrix.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
matrix:
22
browser:
3+
'142':
4+
FIREFOX_VERSION: 142.0.1
5+
FIREFOX_PLATFORMS: linux/amd64,linux/arm64
36
'141':
47
EDGE_VERSION: null
58
CHROME_VERSION: null
69
FIREFOX_VERSION: 141.0.3
710
FIREFOX_PLATFORMS: linux/amd64,linux/arm64
811
'140':
912
EDGE_VERSION: null
10-
CHROME_VERSION: null
13+
CHROME_VERSION: google-chrome-stable=140.0.7339.80-1
1114
FIREFOX_VERSION: 140.0.4
1215
FIREFOX_PLATFORMS: linux/amd64,linux/arm64
1316
'139':
14-
EDGE_VERSION: microsoft-edge-stable=139.0.3405.86-1
15-
CHROME_VERSION: google-chrome-stable=139.0.7258.127-1
17+
EDGE_VERSION: microsoft-edge-stable=139.0.3405.125-1
18+
CHROME_VERSION: google-chrome-stable=139.0.7258.154-1
1619
FIREFOX_VERSION: 139.0.4
1720
FIREFOX_PLATFORMS: linux/amd64,linux/arm64
1821
'138':

tests/build-backward-compatible/fetch_version.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from collections import OrderedDict
2-
31
import requests
42
import yaml
53

@@ -32,17 +30,38 @@ def merge_dicts(dict1, dict2):
3230

3331
def update_local_yaml(local_data, source_data):
3432
updated = False
33+
local_versions = local_data['matrix']['browser'].keys()
34+
local_min_version = str(min(int(v) for v in local_versions)) if local_versions else "0"
3535
for version, details in source_data['matrix']['browser'].items():
3636
if version in local_data['matrix']['browser']:
3737
original_details = local_data['matrix']['browser'][version]
3838
for key in details:
3939
if key in original_details and '_PACKAGE_' not in key:
4040
original_details[key] = details[key] if details[key] is not None else ""
4141
updated = True
42+
elif '_PACKAGE_' not in key:
43+
original_details[key] = details[key] if details[key] is not None else ""
44+
updated = True
4245
merge_dicts(original_details, details)
46+
else:
47+
if int(version) > int(local_min_version):
48+
local_data['matrix']['browser'][version] = details
49+
local_data['matrix']['browser'][version]['FIREFOX_PLATFORMS'] = 'linux/amd64,linux/arm64'
50+
updated = True
4351
return updated
4452

4553

54+
def sort_keys(local_data):
55+
# Sort local_data by key in matrix.browser
56+
list_versions = list(local_data['matrix']['browser'].keys())
57+
list_versions.sort(key=lambda x: int(x), reverse=True)
58+
sorted_browser_dict = {}
59+
for version in list_versions:
60+
sorted_browser_dict[version] = local_data['matrix']['browser'][version]
61+
local_data['matrix']['browser'] = sorted_browser_dict
62+
return local_data
63+
64+
4665
def main():
4766
# Fetch source YAML data
4867
chrome_data = fetch_yaml(chrome_url)
@@ -61,6 +80,7 @@ def main():
6180
# Save updated local YAML data
6281
if updated:
6382
with open(local_file, 'w') as file:
83+
sort_keys(local_data)
6484
yaml.dump(local_data, file, default_flow_style=False, sort_keys=False)
6585
print("Local YAML file updated.")
6686
else:

tests/build-backward-compatible/firefox-matrix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
matrix:
22
browser:
3+
'142':
4+
FIREFOX_VERSION: 142.0.1
35
'141':
46
FIREFOX_VERSION: 141.0.3
57
'140':

0 commit comments

Comments
 (0)