Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
[build][test]: CI workflow is able fetch fork upstream artifacts via …
Browse files Browse the repository at this point in the history
…`vars.GH_ORG`

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Apr 12, 2024
1 parent a3912b2 commit 6daa776
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
make set_nightly_env
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
echo $BASE_RELEASE $BASE_VERSION
echo "GH_ORG=${GH_ORG}" >> $GITHUB_ENV
env:
GH_ORG: ${{ vars.GH_ORG || 'SeleniumHQ' }}
- name: Build Docker images
run: VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build
- name: Test Docker images
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
env:
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
GH_ORG: ${{ vars.GH_ORG || 'SeleniumHQ' }}
- name: Sets prerelease to false by default
run: echo "PRERELEASE=false" >> $GITHUB_ENV
- name: Build base image to get Grid version
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ jobs:
echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV
make set_nightly_env
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
echo $BASE_RELEASE $BASE_VERSION
echo "GH_ORG=${GH_ORG}" >> $GITHUB_ENV
env:
GH_ORG: ${{ vars.GH_ORG || 'SeleniumHQ' }}
- name: Setup Kubernetes environment
uses: nick-invision/retry@master
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:
run: |
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
echo "GH_ORG=${GH_ORG}" >> $GITHUB_ENV
env:
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
GH_ORG: ${{ vars.GH_ORG || 'SeleniumHQ' }}
- name: Build base image to get Grid version
run: VERSION="local" BUILD_DATE=${BUILD_DATE} make base_nightly
- name: Get Grid version
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:
echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV
make set_nightly_env
cat .env | xargs -I {} echo {} >> $GITHUB_ENV
echo $BASE_RELEASE $BASE_VERSION
echo "GH_ORG=${GH_ORG}" >> $GITHUB_ENV
env:
GH_ORG: ${{ vars.GH_ORG || 'SeleniumHQ' }}
- name: Pre-build to reduce logs in test phase
run: |
VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make hub
Expand Down
3 changes: 2 additions & 1 deletion Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LABEL authors="Selenium <[email protected]>"
# Arguments to define the version of dependencies to download
ARG VERSION
ARG RELEASE=selenium-${VERSION}
ARG GH_ORG=SeleniumHQ
# Default value should be aligned with upstream Selenium (https://github.com/SeleniumHQ/selenium/blob/trunk/java/maven_deps.bzl)
ARG OPENTELEMETRY_VERSION=1.36.0
ARG GRPC_VERSION=1.62.2
Expand Down Expand Up @@ -117,7 +118,7 @@ RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/sup
&& touch /opt/selenium/config.toml \
&& chown -R ${SEL_USER}:${SEL_GROUP} /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
&& chmod -R 775 /opt/selenium /var/run/supervisor /var/log/supervisor /etc/passwd ${HOME} \
&& wget --no-verbose https://github.com/SeleniumHQ/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
&& wget --no-verbose https://github.com/${GH_ORG}/selenium/releases/download/${RELEASE}/selenium-server-${VERSION}.jar \
-O /opt/selenium/selenium-server.jar \
&& echo "${SEL_PASSWD}" > /opt/selenium/initialPasswd \
&& chgrp -R 0 /opt/selenium ${HOME} /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NAME := $(or $(NAME),$(NAME),selenium)
CURRENT_DATE := $(shell date '+%Y%m%d')
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
GH_ORG := $(or $(GH_ORG),$(GH_ORG),SeleniumHQ)
BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.19.0)
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.19.1)
BINDING_VERSION := $(or $(BINDING_VERSION),$(BINDING_VERSION),4.19.0)
Expand Down Expand Up @@ -49,10 +50,10 @@ build: all
ci: build test

base:
cd ./Base && docker build $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION) --build-arg RELEASE=$(BASE_RELEASE) -t $(NAME)/base:$(TAG_VERSION) .
cd ./Base && docker build $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION) --build-arg RELEASE=$(BASE_RELEASE) --build-arg GH_ORG=$(GH_ORG) -t $(NAME)/base:$(TAG_VERSION) .

base_nightly:
cd ./Base && docker build $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION_NIGHTLY) --build-arg RELEASE=$(BASE_RELEASE_NIGHTLY) -t $(NAME)/base:$(TAG_VERSION) .
cd ./Base && docker build $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION_NIGHTLY) --build-arg RELEASE=$(BASE_RELEASE_NIGHTLY) --build-arg GH_ORG=$(GH_ORG) -t $(NAME)/base:$(TAG_VERSION) .

hub: base
cd ./Hub && docker build $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/hub:$(TAG_VERSION) .
Expand Down Expand Up @@ -448,6 +449,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
echo NODE=$$node >> .env ; \
echo UID=$$(id -u) >> .env ; \
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \
export $$(cat .env | xargs) ; \
envsubst < config.toml > ./videos/config.toml ; \
docker compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests --build ; \
Expand Down
7 changes: 4 additions & 3 deletions tests/docker-compose-v3-test-node-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
dns:
- 8.8.8.8
- 1.1.1.1
dns_search:
- selenium-grid.local
- 8.8.4.4
dns_search: selenium-grid.local
extra_hosts:
- "prod.domain.com:${HOST_IP}"
depends_on:
- selenium-hub
environment:
Expand Down

0 comments on commit 6daa776

Please sign in to comment.