Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 873e8f7

Browse files
committed
Tests: CI: Add logic for untrusted PRs
1 parent fdc41b2 commit 873e8f7

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Note image ids also change after scm-source.json has being updated which trigger
1010
## TBD_DOCKER_TAG
1111
+ **Changes:** https://github.com/elgalu/docker-selenium/compare/3.5.3-p8...3.5.3-p9 (TBD_DATE)
1212
+ Tests: Upgrade python bindings from 3.5.0 to selenium==3.6.0
13+
+ Tests: CI: Add logic for untrusted PRs
1314
+ **Image tag details:**
1415
+ Selenium version: TBD_SELENIUM_3_VERSION (TBD_SELENIUM_3_REVISION)
1516
+ Chrome stable: TBD_CHROME_STABLE

test/before_install_build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ set -xe
77
docker --version
88
docker-compose --version
99

10-
./host-scripts/gen-scm-source.sh
10+
if [[ ${TRAVIS_PULL_REQUEST_SLUG} != "" && \
11+
${TRAVIS_PULL_REQUEST_SLUG} != ${TRAVIS_REPO_SLUG} && \
12+
${TRAVIS_PULL_REQUEST} != "false" ]]; then
13+
echo "WARN: External PRs are untrusted by default therefore we need can't reuse and push the image"
14+
exit 0
15+
fi
1116

17+
./host-scripts/gen-scm-source.sh
1218
docker build -t selenium .
1319
docker images selenium
1420

test/before_install_pull

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ docker-compose --version
1919

2020
[ "${TRAVIS_BUILD_NUMBER}" == "" ] && die "Need env var TRAVIS_BUILD_NUMBER to know where to pull from"
2121

22-
docker pull elgalu/build_selenium:${TRAVIS_BUILD_NUMBER}
23-
docker tag elgalu/build_selenium:${TRAVIS_BUILD_NUMBER} selenium:latest
22+
if [[ ${TRAVIS_PULL_REQUEST_SLUG} != "" && \
23+
${TRAVIS_PULL_REQUEST_SLUG} != ${TRAVIS_REPO_SLUG} && \
24+
${TRAVIS_PULL_REQUEST} != "false" ]]; then
25+
echo "WARN: External PRs are untrusted by default therefore we need can't reuse and pull the image so building it from scratch..."
26+
./host-scripts/gen-scm-source.sh
27+
docker build -t selenium .
28+
else
29+
docker pull elgalu/build_selenium:${TRAVIS_BUILD_NUMBER}
30+
docker tag elgalu/build_selenium:${TRAVIS_BUILD_NUMBER} selenium:latest
31+
fi
32+
2433
docker images selenium

0 commit comments

Comments
 (0)