-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build][doc]: build images with combination Grid and browser versions
Signed-off-by: Viet Nguyen Duc <[email protected]>
- Loading branch information
Showing
8 changed files
with
359 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
cd tests || true | ||
|
||
if [ "${CI:-false}" = "false" ]; then | ||
pip3 install virtualenv | grep -v 'Requirement already satisfied' | ||
virtualenv docker-selenium-tests | ||
source docker-selenium-tests/bin/activate | ||
fi | ||
|
||
python -m pip install pyyaml==6.0.1 \ | ||
| grep -v 'Requirement already satisfied' | ||
|
||
cd .. | ||
|
||
SELENIUM_VERSION=$1 | ||
CDP_VERSIONS=$2 | ||
BROWSER=${3:-"all"} | ||
PUSH_IMAGE=${4:-"false"} | ||
|
||
IFS=',' read -ra VERSION_LIST <<< "$CDP_VERSIONS" | ||
|
||
for CDP_VERSION in "${VERSION_LIST[@]}"; do | ||
python tests/build-backward-compatible/builder.py ${SELENIUM_VERSION} ${CDP_VERSION} | ||
export $(cat .env | xargs) | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ]; then | ||
if [ -n "${FIREFOX_VERSION}" ]; then | ||
BUILD_ARGS="--build-arg FIREFOX_VERSION=${FIREFOX_VERSION}" | ||
BUILD_ARGS="${BUILD_ARGS}" make standalone_firefox | ||
else | ||
echo "Firefox version not found in matrix for input ${CDP_VERSION}" | ||
exit 1 | ||
fi | ||
fi | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "edge" ]; then | ||
if [ -n "${EDGE_VERSION}" ]; then | ||
BUILD_ARGS="--build-arg EDGE_VERSION=${EDGE_VERSION}" | ||
BUILD_ARGS="${BUILD_ARGS}" make standalone_edge | ||
else | ||
echo "Edge version not found in matrix for input ${CDP_VERSION}" | ||
exit 1 | ||
fi | ||
fi | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "chrome" ]; then | ||
if [ -n "${CHROME_VERSION}" ]; then | ||
BUILD_ARGS="--build-arg CHROME_VERSION=${CHROME_VERSION}" | ||
BUILD_ARGS="${BUILD_ARGS}" make standalone_chrome | ||
else | ||
echo "Chrome version not found in matrix for input ${CDP_VERSION}" | ||
exit 1 | ||
fi | ||
fi | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ]; then | ||
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} make tag_and_push_firefox_images)" | ||
fi | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "edge" ]; then | ||
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} make tag_and_push_edge_images)" | ||
fi | ||
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "chrome" ]; then | ||
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} make tag_and_push_chrome_images)" | ||
fi | ||
done | ||
|
||
readarray -t LOG_LINES <<< "$TAG_LOG_OUTPUT" | ||
for line in "${LOG_LINES[@]}"; do | ||
echo "$line" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import yaml | ||
import sys | ||
import logging | ||
|
||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") | ||
logger = logging.getLogger(__name__) | ||
|
||
def load_template(yaml_file): | ||
try: | ||
with open(yaml_file, 'r') as file: | ||
documents = yaml.safe_load(file) | ||
return documents | ||
except yaml.YAMLError as error: | ||
logger.debug("Error in configuration file: ", error) | ||
|
||
def recursive_merge(dict1, dict2): | ||
for key in dict2: | ||
if key in dict1 and isinstance(dict1[key], dict) and isinstance(dict2[key], dict): | ||
recursive_merge(dict1[key], dict2[key]) | ||
else: | ||
dict1[key] = dict2[key] | ||
|
||
if __name__ == '__main__': | ||
# Load matrix configuration | ||
selenium_matrix = load_template('tests/build-backward-compatible/selenium-matrix.yml') | ||
cdp_matrix = load_template('tests/build-backward-compatible/cdp-matrix.yml') | ||
# Merge configurations into single matrix | ||
recursive_merge(selenium_matrix, cdp_matrix) | ||
matrix = selenium_matrix["matrix"] | ||
# Get versions from arguments | ||
selenium_version = sys.argv[1] | ||
cdp_version = int(sys.argv[2]) | ||
# Create .env with component versions | ||
BASE_RELEASE = matrix["selenium"][selenium_version]["BASE_RELEASE"] | ||
BASE_VERSION = matrix["selenium"][selenium_version]["BASE_VERSION"] | ||
VERSION = matrix["selenium"][selenium_version]["VERSION"] | ||
BINDING_VERSION = matrix["selenium"][selenium_version]["BINDING_VERSION"] | ||
FIREFOX_VERSION = matrix["CDP"][cdp_version]["FIREFOX_VERSION"] | ||
EDGE_VERSION = matrix["CDP"][cdp_version]["EDGE_VERSION"] | ||
CHROME_VERSION = matrix["CDP"][cdp_version]["CHROME_VERSION"] | ||
with open('.env', 'w') as f: | ||
f.write(f"BASE_RELEASE={BASE_RELEASE}\n") | ||
f.write(f"BASE_VERSION={BASE_VERSION}\n") | ||
f.write(f"VERSION={VERSION}\n") | ||
f.write(f"BINDING_VERSION={BINDING_VERSION}\n") | ||
f.write(f"FIREFOX_VERSION={FIREFOX_VERSION}\n") | ||
f.write(f"EDGE_VERSION={EDGE_VERSION}\n") | ||
f.write(f"CHROME_VERSION={CHROME_VERSION}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
matrix: | ||
# List of versions get from | ||
# Edge: https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable | ||
# Chrome: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable | ||
# Firefox: https://download-installer.cdn.mozilla.net/pub/firefox/releases | ||
CDP: | ||
124: | ||
EDGE_VERSION: 'microsoft-edge-stable=124.0.2478.51-1' | ||
CHROME_VERSION: 'google-chrome-stable=124.0.6367.60-1' | ||
FIREFOX_VERSION: '124.0.2' | ||
123: | ||
EDGE_VERSION: 'microsoft-edge-stable=123.0.2420.97-1' | ||
CHROME_VERSION: 'google-chrome-stable=123.0.6312.122-1' | ||
FIREFOX_VERSION: '123.0.1' | ||
122: | ||
EDGE_VERSION: 'microsoft-edge-stable=122.0.2365.92-1' | ||
CHROME_VERSION: 'google-chrome-stable=122.0.6261.128-1' | ||
FIREFOX_VERSION: '122.0.1' | ||
121: | ||
EDGE_VERSION: 'microsoft-edge-stable=121.0.2277.98-1' | ||
CHROME_VERSION: 'google-chrome-stable=121.0.6167.184-1' | ||
FIREFOX_VERSION: '121.0.1' | ||
120: | ||
EDGE_VERSION: 'microsoft-edge-stable=120.0.2210.91-1' | ||
CHROME_VERSION: 'google-chrome-stable=120.0.6099.224-1' | ||
FIREFOX_VERSION: '120.0.1' | ||
119: | ||
EDGE_VERSION: 'microsoft-edge-stable=119.0.2151.97-1' | ||
CHROME_VERSION: 'google-chrome-stable=119.0.6045.199-1' | ||
FIREFOX_VERSION: '119.0.1' | ||
118: | ||
EDGE_VERSION: 'microsoft-edge-stable=118.0.2088.76-1' | ||
CHROME_VERSION: 'google-chrome-stable=118.0.5993.117-1' | ||
FIREFOX_VERSION: '118.0.2' | ||
117: | ||
EDGE_VERSION: 'microsoft-edge-stable=117.0.2045.55-1' | ||
CHROME_VERSION: 'google-chrome-stable=117.0.5938.149-1' | ||
FIREFOX_VERSION: '117.0.1' | ||
116: | ||
EDGE_VERSION: 'microsoft-edge-stable=116.0.1938.81-1' | ||
CHROME_VERSION: 'google-chrome-stable=116.0.5845.187-1' | ||
FIREFOX_VERSION: '116.0.3' | ||
115: | ||
EDGE_VERSION: 'microsoft-edge-stable=115.0.1901.203-1' | ||
CHROME_VERSION: 'google-chrome-stable=115.0.5790.170-1' | ||
FIREFOX_VERSION: '115.0.3' | ||
114: | ||
EDGE_VERSION: 'microsoft-edge-stable=114.0.1823.82-1' | ||
CHROME_VERSION: 'google-chrome-stable=114.0.5735.198-1' | ||
FIREFOX_VERSION: '114.0.2' | ||
113: | ||
EDGE_VERSION: 'microsoft-edge-stable=113.0.1774.57-1' | ||
CHROME_VERSION: 'google-chrome-stable=113.0.5672.126-1' | ||
FIREFOX_VERSION: '113.0.2' | ||
112: | ||
EDGE_VERSION: 'microsoft-edge-stable=112.0.1722.64-1' | ||
CHROME_VERSION: 'google-chrome-stable=112.0.5615.165-1' | ||
FIREFOX_VERSION: '112.0.2' |
Oops, something went wrong.