gecko-dev/testing/web-platform/tests/tools/docker/start.sh
jgraham 35dc367cd6 Bug 1540306 [wpt PR 16110] - Don't use HEAD or FETCH_HEAD to checkout specific revisions. (#16066), a=testonly
Automatic update from web-platform-tests
Don't use HEAD or FETCH_HEAD to checkout specific revisions. (#16066)

FETCH_HEAD is unreliable because it's a global variable that can be
accidentially clobbered by adding an additional fetch anywhere in the
pipeline. As a result running tests in CI has been broken since we
chose the wrong revisions. HEAD is more reliable but doesn't exist
until we first check something out.

Instead, do the following:

* Fetch the initial commits into a branch called task_head and check
  this out unconditionally.

* For PRs, create branches called base_head and pr_head pointing to
  the two parents of the merge commit that we test on PRs.

* Express all the other revisions in terms of task_head, pr_head and
  base_head, since they are both correct and more descriptive than
  using complex revision specifiers.

* Move as much logic as possible out of the script baked in to the
  docker image since that's hardest to update.

--

wpt-commits: e5044ace1ad217e683fb239ce6f88806f05139e3
wpt-pr: 16110
2019-04-24 11:31:24 +01:00

29 lines
765 B
Bash
Executable file

#!/bin/bash
# This script is embedded in the docker image, and so the image must be updated when changes
# to the script are made. To do this, assuming you have docker installed:
# In tools/docker/ :
# docker build .
# docker ps # and look for the id of the image you just built
# docker tag <image> <tag>
# docker push <tag>
# Update the `image` specified in the project's .taskcluster.yml file
set -ex
REMOTE=${1:-https://github.com/web-platform-tests/wpt}
REF=${2:-master}
cd ~
mkdir web-platform-tests
cd web-platform-tests
git init
git remote add origin ${REMOTE}
# Initially we just fetch 50 commits in order to save several minutes of fetching
retry git fetch --quiet --depth=50 --tags origin ${REF}:task_head
git checkout --quiet task_head