Skip to content

Commit

Permalink
Fix to test the new milestone offset
Browse files Browse the repository at this point in the history
  • Loading branch information
mars committed Aug 23, 2024
1 parent f6c43a1 commit 5792c69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ FROM --platform=linux/amd64 heroku/heroku:${STACK_VERSION}-build as build
ARG STACK_VERSION
ENV STACK="heroku-${STACK_VERSION}"

ARG GOOGLE_CHROME_MILESTONE_OFFSET

# On Heroku-24 and later the default user is not root.
# Once support for Heroku-22 and older is removed, the `useradd` steps below can be removed.
USER root
Expand All @@ -15,6 +17,9 @@ USER non-root-user
RUN mkdir -p /tmp/build /tmp/cache /tmp/env
COPY --chown=non-root-user . /buildpack

# Emulate the platform providing app config vars via env directory
RUN if [ -n "${GOOGLE_CHROME_MILESTONE_OFFSET}" ]; then echo "${GOOGLE_CHROME_MILESTONE_OFFSET}" > /tmp/env/GOOGLE_CHROME_MILESTONE_OFFSET; fi

# Sanitize the environment seen by the buildpack, to prevent reliance on
# environment variables that won't be present when it's run by Heroku CI.
RUN env -i PATH=$PATH HOME=$HOME STACK=$STACK /buildpack/bin/detect /tmp/build
Expand Down
6 changes: 4 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ if [ -f "$ENV_DIR/GOOGLE_CHROME_MILESTONE_OFFSET" ]; then
fi

latest_version_per_milestone="$(curl --silent --show-error --fail --retry 3 --retry-connrefused --connect-timeout 10 "https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json")"
VERSION="$(echo $latest_version_per_milestone | jq --arg milestone_offset="$milestone_offset" value '.milestones | map(.) | sort_by(.milestone)[($milestone_offset | tonumber)] | .version')"
VERSION="$(echo $latest_version_per_milestone | jq --raw-output --arg milestone_offset "$milestone_offset" '.milestones | map(.) | sort_by(.milestone)[($milestone_offset | tonumber)] | .version')"
echo "Resolved milestone offset $milestone_offset to version $VERSION" | indent
INSTALLED_DESCRIPTION="milestone offset $milestone_offset"

else
# Detect requested channel or default to stable
Expand All @@ -80,6 +81,7 @@ else
CHANNEL="$(echo -n "$channel" | awk '{ print toupper($0) }')"
VERSION="$(curl --silent --show-error --fail --retry 3 --retry-connrefused --connect-timeout 10 "https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_$CHANNEL")"
echo "Resolved $CHANNEL version $VERSION" | indent
INSTALLED_DESCRIPTION="$CHANNEL"
fi

echo "Downloading Chrome" | indent
Expand Down Expand Up @@ -107,4 +109,4 @@ export PATH="$BUILD_DIR/.chrome-for-testing/chrome-linux64:$BUILD_DIR/.chrome-fo
which chrome | indent
which chromedriver | indent

echo "Installed Chrome for Testing $CHANNEL version $VERSION" | indent
echo "Installed Chrome for Testing $INSTALLED_DESCRIPTION version $VERSION" | indent

0 comments on commit 5792c69

Please sign in to comment.