Skip to content

Commit 7e854d3

Browse files
committed
[ci] Update workflow to upload image tags changelog
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 7bc46b2 commit 7e854d3

File tree

3 files changed

+74
-42
lines changed

3 files changed

+74
-42
lines changed

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

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,45 @@ on:
88
required: true
99
type: string
1010
default: 'true'
11+
reuse-base:
12+
description: 'Reuse base image to build'
13+
required: false
14+
type: boolean
15+
default: true
1116
grid-version:
12-
description: 'Grid version to build. E.g: 4.28.1'
17+
description: 'Grid version to build. E.g: 4.28.1. Must provide if reusing base image'
1318
required: false
1419
type: string
15-
browser-version:
16-
description: 'Browser version to build. E.g: 120'
17-
required: true
20+
default: ''
21+
build-date:
22+
description: 'Build date in format YYYYMMDD. Must provide if reusing base image'
23+
required: false
1824
type: string
25+
default: ''
1926
browser-name:
2027
description: 'Browser name to build. E.g: chrome'
2128
required: true
2229
type: string
2330
default: 'chrome'
31+
browser-version:
32+
description: 'Browser version to build. E.g: 120'
33+
required: true
34+
type: string
2435
push-image:
25-
description: 'Push images to registry after build & test is successful'
26-
required: false
36+
description: 'Push image after testing successfully'
37+
required: true
2738
type: boolean
2839
default: true
29-
build-date:
30-
description: 'Build date'
31-
required: false
32-
type: string
33-
default: ''
40+
41+
env:
42+
GRID_VERSION: ${{ github.event.inputs.grid-version }}
43+
BROWSER_NAME: ${{ github.event.inputs.browser-name }}
44+
BROWSER_VERSION: ${{ github.event.inputs.browser-version }}
45+
REUSE_BASE: ${{ github.event.inputs.reuse-base || true }}
46+
BUILD_DATE: ${{ github.event.inputs.build-date || '' }}
47+
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
48+
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
49+
PUSH_IMAGE: ${{ github.event.inputs.push-image || false }}
3450

3551
jobs:
3652
deploy:
@@ -70,12 +86,8 @@ jobs:
7086
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_ENV
7187
fi
7288
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
73-
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
74-
env:
75-
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
76-
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
77-
BUILD_DATE: ${{ github.event.inputs.build-date || '' }}
7889
- name: Get Grid version
90+
if: env.GRID_VERSION == ''
7991
run: |
8092
echo ${BASE_VERSION}
8193
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
@@ -88,19 +100,22 @@ jobs:
88100
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
89101
- name: Build images
90102
run: |
91-
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME}
92-
make hub
93-
env:
94-
GRID_VERSION: ${{ github.event.inputs.grid-version || env.GRID_VERSION }}
95-
BROWSER_VERSION: ${{ github.event.inputs.browser-version }}
96-
BROWSER_NAME: ${{ github.event.inputs.browser-name }}
103+
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} ${REUSE_BASE}
104+
- name: Build Hub image for testing
105+
if: env.REUSE_BASE == 'false'
106+
run: make hub
97107
- name: Test images
98108
run: |
99109
make test_chrome
110+
make test_chrome_standalone
100111
- name: Push images
112+
if: env.PUSH_IMAGE == 'true'
101113
run: |
102-
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} true
103-
env:
104-
GRID_VERSION: ${{ github.event.inputs.grid-version || env.GRID_VERSION }}
105-
BROWSER_VERSION: ${{ github.event.inputs.browser-version }}
106-
BROWSER_NAME: ${{ github.event.inputs.browser-name }}
114+
./tests/build-backward-compatible/bootstrap.sh ${GRID_VERSION} ${BROWSER_VERSION} ${BROWSER_NAME} ${REUSE_BASE} true true
115+
- name: Upload changelog
116+
if: always()
117+
uses: actions/upload-artifact@main
118+
with:
119+
name: image_tags_${{ env.GRID_VERSION }}_${{ env.BROWSER_NAME }}_${{ env.BROWSER_VERSION }}
120+
path: ./CHANGELOG/${{ env.GRID_VERSION }}/${{ env.BROWSER_NAME }}_${{ env.BROWSER_VERSION }}.md
121+
if-no-files-found: ignore

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-7.
2424
FFMPEG_BASED_NAME := $(or $(FFMPEG_BASED_NAME),$(FFMPEG_BASED_NAME),selenium)
2525
FFMPEG_BASED_TAG := $(or $(FFMPEG_BASED_TAG),$(FFMPEG_BASED_TAG),latest)
2626
CURRENT_PLATFORM := $(shell if [ `arch` = "aarch64" ] || [ `arch` = "arm64" ]; then echo "linux/arm64"; else echo "linux/amd64"; fi)
27-
PLATFORMS := $(or $(PLATFORMS),$(shell echo $$PLATFORMS),$(CURRENT_PLATFORM))
27+
PLATFORMS := $(or $(PLATFORMS),$(shell echo $$PLATFORMS),linux/amd64)
2828
SEL_PASSWD := $(or $(SEL_PASSWD),$(SEL_PASSWD),secret)
2929
CHROMIUM_VERSION := $(or $(CHROMIUM_VERSION),$(CHROMIUM_VERSION),latest)
3030
FIREFOX_DOWNLOAD_URL := $(or $(FIREFOX_DOWNLOAD_URL),$(FIREFOX_DOWNLOAD_URL),https://download-installer.cdn.mozilla.net/pub/firefox/nightly/2024/11/2024-11-25-09-40-45-mozilla-central/firefox-134.0a1.en-US.linux-aarch64.deb)
@@ -154,7 +154,7 @@ event_bus: base
154154
node_base: base video
155155
cd ./NodeBase && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=video --build-arg VERSION=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) --secret id=SEL_PASSWD -t $(NAME)/node-base:$(TAG_VERSION) .
156156

157-
chrome: node_base
157+
chrome_only:
158158
case "$(PLATFORMS)" in \
159159
*linux/amd64*) \
160160
echo "Google Chrome is only supported on linux/amd64" \
@@ -165,6 +165,8 @@ chrome: node_base
165165
;; \
166166
esac
167167

168+
chrome: node_base chrome_only
169+
168170
chrome_dev:
169171
cd ./NodeChrome && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg CHROME_VERSION=google-chrome-unstable -t $(NAME)/node-chrome:dev .
170172

@@ -217,7 +219,7 @@ standalone_firefox_beta: firefox_beta
217219
cd ./Standalone && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --sbom=true --attest type=provenance,mode=max \
218220
--build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:beta .
219221

220-
standalone_chrome: chrome
222+
standalone_chrome_only:
221223
case "$(PLATFORMS)" in \
222224
*linux/amd64*) \
223225
echo "Google Chrome is only supported on linux/amd64" \
@@ -228,6 +230,8 @@ standalone_chrome: chrome
228230
;; \
229231
esac
230232

233+
standalone_chrome: chrome standalone_chrome_only
234+
231235
standalone_chrome_dev: chrome_dev
232236
cd ./Standalone && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --sbom=true --attest type=provenance,mode=max \
233237
--build-arg NAMESPACE=$(NAME) --build-arg VERSION=dev --build-arg BASE=node-chrome -t $(NAME)/standalone-chrome:dev .

tests/build-backward-compatible/bootstrap.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ cd ..
1515
SELENIUM_VERSION=$1
1616
CDP_VERSIONS=$2
1717
BROWSER=${3:-"all"}
18-
PUSH_IMAGE=${4:-"false"}
19-
RELEASE_OLD_VERSION=${5:-"true"}
18+
REUSE_BASE=${4:-"false"}
19+
PUSH_IMAGE=${5:-"false"}
20+
SKIP_BUILD=${6:-"false"}
21+
RELEASE_OLD_VERSION=${7:-"true"}
2022

2123
IFS=',' read -ra VERSION_LIST <<< "$CDP_VERSIONS"
2224

25+
mkdir -p CHANGELOG/${SELENIUM_VERSION}
26+
2327
for CDP_VERSION in "${VERSION_LIST[@]}"; do
2428
python3 tests/build-backward-compatible/builder.py ${SELENIUM_VERSION} ${CDP_VERSION}
2529
export $(cat .env | xargs)
26-
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ]; then
30+
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ] && [ "${SKIP_BUILD}" = "false" ]; then
2731
if [ -n "${FIREFOX_VERSION}" ]; then
2832
BUILD_ARGS="--build-arg FIREFOX_VERSION=${FIREFOX_VERSION}"
2933
BUILD_ARGS="${BUILD_ARGS}" make standalone_firefox
@@ -32,7 +36,7 @@ for CDP_VERSION in "${VERSION_LIST[@]}"; do
3236
exit 1
3337
fi
3438
fi
35-
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "edge" ]; then
39+
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "edge" ] && [ "${SKIP_BUILD}" = "false" ]; then
3640
if [ -n "${EDGE_VERSION}" ]; then
3741
BUILD_ARGS="--build-arg EDGE_VERSION=${EDGE_VERSION}"
3842
BUILD_ARGS="${BUILD_ARGS}" make standalone_edge
@@ -41,26 +45,35 @@ for CDP_VERSION in "${VERSION_LIST[@]}"; do
4145
exit 1
4246
fi
4347
fi
44-
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "chrome" ]; then
48+
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "chrome" ] && [ "${SKIP_BUILD}" = "false" ]; then
4549
if [ -n "${CHROME_VERSION}" ]; then
4650
BUILD_ARGS="--build-arg CHROME_VERSION=${CHROME_VERSION}"
47-
BUILD_ARGS="${BUILD_ARGS}" make standalone_chrome
51+
if [ "${REUSE_BASE}" = "true" ]; then
52+
BUILD_ARGS="${BUILD_ARGS}" make chrome_only standalone_chrome_only
53+
else
54+
BUILD_ARGS="${BUILD_ARGS}" make standalone_chrome
55+
fi
4856
else
4957
echo "Chrome version not found in matrix for input ${CDP_VERSION}"
5058
exit 1
5159
fi
5260
fi
5361
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ]; then
54-
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_firefox_images)"
62+
TAG_LOG_OUTPUT="$(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_firefox_images)"
5563
fi
5664
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "edge" ]; then
57-
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_edge_images)"
65+
TAG_LOG_OUTPUT="$(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_edge_images)"
5866
fi
5967
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "chrome" ]; then
60-
TAG_LOG_OUTPUT="$TAG_LOG_OUTPUT $(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_chrome_images)"
68+
TAG_LOG_OUTPUT="$(PUSH_IMAGE=${PUSH_IMAGE} RELEASE_OLD_VERSION=${RELEASE_OLD_VERSION} make tag_and_push_chrome_images)"
6169
fi
62-
done
6370

64-
echo "$TAG_LOG_OUTPUT" | while IFS= read -r line; do
65-
echo "$line"
71+
if [ "${PUSH_IMAGE}" = "false" ]; then
72+
echo -n "" > ./CHANGELOG/${SELENIUM_VERSION}/${BROWSER}_${CDP_VERSION}.md
73+
echo "$TAG_LOG_OUTPUT" | while IFS= read -r line; do
74+
echo "$line" >> ./CHANGELOG/${SELENIUM_VERSION}/${BROWSER}_${CDP_VERSION}.md
75+
done ;
76+
else
77+
echo "${TAG_LOG_OUTPUT}"
78+
fi
6679
done

0 commit comments

Comments
 (0)