Skip to content

Commit 89436fb

Browse files
authored
devops(docker): publish stable images from the tip of a release branch (#3333)
1 parent 63cdffb commit 89436fb

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎.azure-pipelines/publish-docker.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Trigger: any `v*` release tag (e.g. v1.40.0).
2-
# Can also be queued manually from the ADO UI.
2+
# Can also be queued manually from the ADO UI. A manual 'stable' run is possible only
3+
# on a `release-*` branch: it publishes the images of the last release tag of that
4+
# branch again, from the tip of the branch.
35
trigger:
46
tags:
57
include:

‎utils/docker/publish_docker.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ if [[ "${RELEASE_CHANNEL}" != "stable" && "${RELEASE_CHANNEL}" != "canary" ]]; t
1616
fi
1717

1818
PW_VERSION=$(python -c "from playwright._repo_version import version;print(version)")
19+
# A stable run on a release branch publishes the images of the last release of that
20+
# branch again, for example with a cherry-picked fix of the image. The commit has no
21+
# tag then, so setuptools-scm gives a dev version: use the version of the last tag,
22+
# also for the wheels that build.sh puts into the image.
23+
if [[ "${RELEASE_CHANNEL}" == "stable" && "${BUILD_SOURCEBRANCH:-}" =~ ^refs/heads/release-([0-9]+\.[0-9]+)$ ]]; then
24+
BRANCH_VERSION="${BASH_REMATCH[1]}"
25+
LAST_TAG=$(git describe --tags --abbrev=0 --match 'v[0-9]*')
26+
if [[ ! "${LAST_TAG}" =~ ^v${BRANCH_VERSION//./\\.}\.[0-9]+$ ]]; then
27+
echo "ERROR: the last tag '${LAST_TAG}' is not a release of ${BUILD_SOURCEBRANCH}"
28+
exit 1
29+
fi
30+
PW_VERSION="${LAST_TAG#v}"
31+
export SETUPTOOLS_SCM_PRETEND_VERSION="${PW_VERSION}"
32+
echo "== STABLE build from ${BUILD_SOURCEBRANCH}: publishing as v${PW_VERSION} =="
33+
fi
1934
if [[ "${RELEASE_CHANNEL}" == "stable" && ! "${PW_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
2035
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
2136
exit 1

0 commit comments

Comments
 (0)