Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T361227 - Release WMDE.19 #636

Merged
merged 19 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ jobs:
"WMDE15",
"WMDE15_BUNDLE",
# Previous 1.40
"WMDE14",
"WMDE14_BUNDLE",
"WMDE16",
"WMDE16_BUNDLE",
]

steps:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/build_test_publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: 📦 Build Test Tag and Publish Release

on:
push:
pull_request:
types:
- closed
branches:
- "mw-*"

Expand All @@ -12,10 +14,15 @@ permissions:

jobs:
_:
if: github.event.pull_request.merged == true

uses: ./.github/workflows/_build_test.yml

tag-release:
if: github.event.pull_request.merged == true

needs: _

runs-on: ubuntu-latest

steps:
Expand All @@ -42,9 +49,12 @@ jobs:
fi

publish-dockerhub:
if: github.event.pull_request.merged == true

needs: tag-release

runs-on: ubuntu-latest

timeout-minutes: 30

steps:
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
This file is only intended to serve the developers of this repository and of the releases.
This provides an overview of the releases that have been made using this release pipeline.

## April 2024: Security releases for 1.40.3

- [MediaWiki security and maintenance release announcement: 1.39.7 / 1.40.3](https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/V3WXEPXV2DU6WTVEKK4XHW4QXD5OFKD7/)
- [MediaWiki full release notes](https://www.mediawiki.org/wiki/Release_notes/1.40)
- [Release task T361227](https://phabricator.wikimedia.org/T361227)

| Suite Version | Version Info | Date available | Release task |
| --- | --- | --- | --- |
| wmde.19 ([spec](https://github.com/wmde/wikibase-release-pipeline/blob/wmde.19/variables.env)) | MediaWiki (1.40.3, PHP 8.1.27, debian/apache 2.4.57-2), WDQS (0.3.137) | XX April 2024 | [T361227](https://phabricator.wikimedia.org/T361227) |

## February 2024: Security releases for 1.40.2
- [MediaWiki security and maintenance release announcement: 1.35.14 / 1.39.6 / 1.40.2](https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/message/TDBUBCCOQJUT4SCHJNPHKQNPBUUETY52/)
- [MediaWiki full release notes](https://www.mediawiki.org/wiki/Release_notes/1.40)
Expand Down
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ source ./versions.inc.sh

DOCKER_BUILD_CACHE_OPT=""

# ℹ️ Update Commit Hashes
function update_commit_hashes {
docker build ./test -t wikibase-test-runner
docker run --rm -v "$(pwd)":/workspace wikibase-test-runner bash -c "
cd /workspace
python3 update_commits.py
"
}

# wikibase/wdqs -> wdqs
function image_url_to_image_name {
Expand Down Expand Up @@ -205,6 +213,10 @@ for arg in "$@"; do
build_all
build_target_set=true
;;
update_hashes)
update_commit_hashes
exit 0
;;
-n|--no-cache)
DOCKER_BUILD_CACHE_OPT="--no-cache"
;;
Expand Down
5 changes: 4 additions & 1 deletion test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* && \
pip3 install --no-cache-dir --upgrade \
pip \
setuptools
setuptools \
requests \
bs4 \
lxml

WORKDIR /usr/src/test/

Expand Down
2 changes: 2 additions & 0 deletions test/specs/repo/special-property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ describe( 'Special:NewProperty', function () {
} );

it( `Should be able to create a new property of datatype ${dataType.name}`, async () => {
this.retries( 4 );

await SpecialNewPropertyPage.open();

await SpecialNewPropertyPage.labelInput.setValue(
Expand Down
3 changes: 3 additions & 0 deletions test/suites/upgrade/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export const versions = {
WMDE16: 'wikibase/wikibase:1.40.2-wmde.16',
WMDE16_BUNDLE: 'wikibase/wikibase-bundle:1.40.2-wmde.16',

WMDE19: 'wikibase/wikibase:1.40.3-wmde.19',
WMDE19_BUNDLE: 'wikibase/wikibase-bundle:1.40.3-wmde.19',

LOCAL_BUILD: 'wikibase/wikibase',
LOCAL_BUILD_BUNDLE: 'wikibase/wikibase-bundle'
};
Expand Down
109 changes: 109 additions & 0 deletions update_commits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import re, requests, json
from bs4 import BeautifulSoup


def get_commit(variable: str, url: str, parse_commit: callable, previous_commit: str):
print(f"Variable:\t{variable}")
print(f"\tURL:\t{url}")
try:
response = requests.get(url)
commit = parse_commit(response)
if previous_commit != commit:
print(f"\tOld Commit:\t{previous_commit}")
print(f"\tNew Commit:\t{commit}")
return commit
else:
print(f"\tCommit:\t{commit}")
return False
except Exception as exc:
print(f"\tError:\t{exc}")
return False


gerrit_pattern = re.compile(
r"# (https://gerrit.*)[ \t\r\n]*([A-Z_]+_COMMIT)=([0-9a-f]+)"
)


def parse_gerrit_commit(response: requests.Response) -> str:
"""Parse webpage using BeautifulSoup"""
soup = BeautifulSoup(response.content, "lxml")
return soup.find("th", string="commit").next_sibling.text


github_pattern = re.compile(
r"# (https://github\.com/(.*/commits.*))[ \t\r\n]*([A-Z_]+_COMMIT)=([0-9a-f]+)"
)


def parse_github_commit(response: requests.Response) -> str:
"""Fetch from API"""
data = json.loads(response.content)
return data["sha"]


bitbucket_pattern = re.compile(
r"# (https://bitbucket\.org/(.*/commits)/branch/master)[ \t\r\n]*([A-Z_]+_COMMIT)=([0-9a-f]+)"
)


def parse_bitbucket_commit(response: requests.Response) -> str:
"""Fetch from API"""
data = json.loads(response.content)
return data["values"][0]["hash"]


def run():
with open("variables.env", "r") as variable_file:
variable_contents = variable_file.read()

mediawiki_match = re.search(r"MEDIAWIKI_VERSION=(\d+)\.(\d+)", variable_contents)
rel = f"REL{mediawiki_match.group(1)}_{mediawiki_match.group(2)}"
print(f"Mediawiki Version:\t{mediawiki_match.group(1)}.{mediawiki_match.group(2)}")
variable_contents = re.sub(r"\bREL\d+_\d+", rel, variable_contents)

for gerrit_commit in re.findall(gerrit_pattern, variable_contents):
if commit := get_commit(
gerrit_commit[1],
gerrit_commit[0],
parse_gerrit_commit,
gerrit_commit[2],
):
variable_contents = re.sub(
f"{gerrit_commit[1]}=[0-9a-f]+",
f"{gerrit_commit[1]}={commit}",
variable_contents,
)

for github_commit in re.findall(github_pattern, variable_contents):
if commit := get_commit(
github_commit[2],
f"https://api.github.com/repos/{github_commit[1]}",
parse_github_commit,
github_commit[3],
):
variable_contents = re.sub(
f"{github_commit[2]}=[0-9a-f]+",
f"{github_commit[2]}={commit}",
variable_contents,
)

for bitbucket_commit in re.findall(bitbucket_pattern, variable_contents):
if commit := get_commit(
bitbucket_commit[2],
f"https://bitbucket.org/!api/2.0/repositories/{bitbucket_commit[1]}",
parse_bitbucket_commit,
bitbucket_commit[3],
):
variable_contents = re.sub(
f"{bitbucket_commit[2]}=[0-9a-f]+",
f"{bitbucket_commit[2]}={commit}",
variable_contents,
)

with open("variables.env", "w") as variable_file:
variable_file.write(variable_contents)


if __name__ == "__main__":
run()