@@ -232,6 +232,7 @@ jobs:
232232 flags : test-optimization-mocha-${{ matrix.version }}-${{ matrix.mocha-version }}
233233
234234 integration-webdriverio :
235+ needs : selenium-image
235236 strategy :
236237 fail-fast : false
237238 matrix :
@@ -253,6 +254,11 @@ jobs:
253254 integration-webdriverio (${{ matrix.webdriverio-version }},
254255 node-${{ matrix.node-version }}, ${{ matrix.spec }})
255256 runs-on : ubuntu-latest
257+ container :
258+ image : ${{ needs.selenium-image.outputs.webdriverio_image }}
259+ credentials :
260+ username : ${{ github.actor }}
261+ password : ${{ secrets.GITHUB_TOKEN }}
256262 steps :
257263 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
258264 - uses : ./.github/actions/node
@@ -271,8 +277,10 @@ jobs:
271277 - name : Clear uploaded instrumentation JUnit reports
272278 if : " !cancelled() && steps.webdriverio_instrumentation_upload.outcome == 'success'"
273279 run : rm -f ./*.xml
274- - name : Install FFmpeg for video recording and validation
275- run : sudo apt-get update && sudo apt-get install -y ffmpeg
280+ - name : Configure Git safe directory
281+ # The WebdriverIO job runs in a container where the checkout can be owned by a different UID.
282+ # Git rejects metadata commands in that checkout unless the workspace is marked as safe.
283+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
276284 - name : Use installed Chrome and ChromeDriver
277285 if : matrix.spec == 'webdriverio'
278286 run : |
@@ -382,21 +390,25 @@ jobs:
382390 flags : test-optimization-cucumber-${{ matrix.version }}-${{ matrix.cucumber-version }}
383391
384392 selenium-image :
385- name : Ensure Selenium Docker image
393+ name : Ensure browser Docker images
386394 runs-on : ubuntu-latest
387395 permissions :
388396 contents : read
389397 packages : write
390398 outputs :
391399 image : ${{ steps.image.outputs.image }}
400+ webdriverio_image : ${{ steps.image.outputs.webdriverio_image }}
392401 steps :
393402 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
394403 - name : Determine image tag
395404 id : image
396405 run : |
397- DOCKER_HASH=$(sha256sum .github/selenium/Dockerfile | cut -c1-8)
398- IMAGE="ghcr.io/datadog/dd-trace-js/selenium-tools:${DOCKER_HASH}"
406+ SELENIUM_HASH=$(sha256sum .github/selenium/Dockerfile | cut -c1-8)
407+ WEBDRIVERIO_HASH=$(sha256sum .github/webdriverio/Dockerfile | cut -c1-8)
408+ IMAGE="ghcr.io/datadog/dd-trace-js/selenium-tools:${SELENIUM_HASH}"
409+ WEBDRIVERIO_IMAGE="ghcr.io/datadog/dd-trace-js/webdriverio-tools:${SELENIUM_HASH}-${WEBDRIVERIO_HASH}"
399410 echo "image=$IMAGE" >> "$GITHUB_OUTPUT"
411+ echo "webdriverio_image=$WEBDRIVERIO_IMAGE" >> "$GITHUB_OUTPUT"
400412 - name : Log in to GHCR
401413 uses : docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
402414 with :
@@ -413,6 +425,18 @@ jobs:
413425 docker build -t "${IMAGE}" .github/selenium
414426 docker push "${IMAGE}"
415427 fi
428+ - name : Ensure WebdriverIO image
429+ env :
430+ SELENIUM_IMAGE : ${{ steps.image.outputs.image }}
431+ WEBDRIVERIO_IMAGE : ${{ steps.image.outputs.webdriverio_image }}
432+ run : |
433+ if docker manifest inspect "${WEBDRIVERIO_IMAGE}" > /dev/null 2>&1; then
434+ echo "Image ${WEBDRIVERIO_IMAGE} already exists, skipping build"
435+ else
436+ docker build --build-arg SELENIUM_IMAGE="${SELENIUM_IMAGE}" \
437+ -t "${WEBDRIVERIO_IMAGE}" .github/webdriverio
438+ docker push "${WEBDRIVERIO_IMAGE}"
439+ fi
416440
417441 integration-selenium :
418442 needs : selenium-image
0 commit comments