Skip to content

Commit

Permalink
Fix CI job javascript-e2e-tests
Browse files Browse the repository at this point in the history
Protractor's downloading of chromedriver is broken
(angular/webdriver-manager#523),
so we add a workaround using a different download tool.

We could do this by changing the CI job definition,
but then we would have to sync this change to every branch.
If we instead change only the Docker image
and hack the npx command (that gets executed by the current CI job)
to do what we need, it will immediately start working again
across all branches, and it will be easy to remove again if necessary.
So while this hack is somewhat ugly, it seems preferable.

Cf. #1141

git-svn-id: https://svn.sosy-lab.org/software/cpachecker/trunk@44685 4712c6d2-40bb-43ae-aa4b-fec3f1bdfe4c
  • Loading branch information
PhilippWendler committed Sep 19, 2023
1 parent 4f0c424 commit 06cf746
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build/gitlab-ci.Dockerfile.java-node
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
zip \
python3-pip \
nodejs \
npm \
openjdk-17-jre-headless \
Expand All @@ -30,3 +32,28 @@ RUN apt-get update && apt-get install -y \
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb

RUN pip3 install webdriver-manager

RUN echo test > /usr/local/bin/npx

# We need to override the command "npx" with a hack
# that installs chromedriver using https://pypi.org/project/webdriver-manager/
# when called as "npx webdriver-manager update --versions.chrome $VERSION",
# because Protractor's webdriver-manager no longer supports downloading
# the latest chromedriver (cf. issue #1141).

RUN printf '#!/bin/bash\n\
set -euo pipefail\n\
\n\
if [[ "${1:-}" = "webdriver-manager" && "${2:-}" = update && "${3:-}" = "--versions.chrome" && ! -z "${4:-}" ]]; then\n\
VERSION="$4"\n\
BINARY=$(python3 -c "from webdriver_manager.chrome import ChromeDriverManager; print(ChromeDriverManager(driver_version=\"$VERSION\").install())")\n\
echo "$BINARY"\n\
mkdir -p node_modules/protractor/node_modules/webdriver-manager/selenium/\n\
zip -j "node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_$VERSION.zip" "$BINARY"\n\
fi\n\
\n\
exec /usr/bin/npx "$@"\n\
' > /usr/local/bin/npx;\
chmod +x /usr/local/bin/npx

0 comments on commit 06cf746

Please sign in to comment.