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

Combine extensions and skin to contents.yaml file #481

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
APACHE_LOG_DIR=/var/log/apache2

# System setup
RUN set x; \

Check failure on line 18 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 18 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`

Check failure on line 18 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3047 info: Avoid use of wget without progress bar. Use `wget --progress=dot:giga <url>`.Or consider using `-q` or `-nv` (shorthands for `--quiet` or `--no-verbose`).
apt-get clean \
&& apt-get update \
&& apt-get install -y aptitude \
Expand Down Expand Up @@ -91,11 +91,11 @@
&& mkdir -p $MW_VOLUME

# Composer
RUN set -x; \

Check failure on line 94 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL4001 warning: Either use Wget or Curl but not both
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer self-update 2.1.3

RUN set -x; \

Check failure on line 98 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`

Check failure on line 98 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

Check failure on line 98 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3027 warning: Do not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead

Check failure on line 98 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 98 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

DL3009 info: Delete the apt-get lists after installing something
# Preconfigure Postfix to avoid the interactive prompt
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections \
&& echo "postfix postfix/mailname string $MAILNAME" | debconf-set-selections \
Expand All @@ -116,14 +116,12 @@
# Skins
COPY _sources/scripts/extensions-skins.php /tmp/extensions-skins.php
COPY _sources/patches/* /tmp/
COPY _sources/configs/skins.yaml /tmp/skins.yaml
RUN php /tmp/extensions-skins.php "skins" "/tmp/skins.yaml"

# Extensions
# The following extensions are downloaded via Composer and also do not need to be downloaded here:
# Bootstrap, DataValues (and related extensions like DataValuesCommon), ParserHooks.
COPY _sources/configs/extensions.yaml /tmp/extensions.yaml
RUN php /tmp/extensions-skins.php "extensions" "/tmp/extensions.yaml"
COPY _sources/configs/contents.yaml /tmp/contents.yaml
RUN php /tmp/extensions-skins.php "/tmp/contents.yaml"

# Patch composer
RUN set -x; \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
# Canasta YAML file for extensions for MediaWiki 1.39.
# Where the repository is not specified, the Wikimedia Git repository for the
# extension with that name is used, and the default branch used is REL1_39.
# extension/skin with that name is used, and the default branch used is REL1_39.
# Where the repository *is* specified, the default branch used is master.
skins:
- chameleon:
commit: f34a56528ada14ac07e1b03beda41f775ef27606 # v. 4.2.1
repository: https://github.com/ProfessionalWiki/chameleon
additional steps:
- composer update
- CologneBlue:
commit: 4d588eb78d7e64e574f631c5897579537305437d
- MinervaNeue:
bundled: true
- Modern:
commit: fb6c2831b5f150e9b82d98d661710695a2d0f8f2
- MonoBook:
bundled: true
- Pivot:
branch: v2.3.0
commit: d79af7514347eb5272936243d4013118354c85c1
- Refreshed:
commit: 86f33620f25335eb62289aa18d342ff3b980d8b8
- Timeless:
bundled: true
- Vector:
bundled: true
extensions:
- AbuseFilter:
bundled: true
Expand Down
27 changes: 0 additions & 27 deletions _sources/configs/skins.yaml

This file was deleted.

97 changes: 49 additions & 48 deletions _sources/scripts/extensions-skins.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,65 @@
$MW_VERSION = getenv("MW_VERSION");
$MW_VOLUME = getenv("MW_VOLUME");
$MW_ORIGIN_FILES = getenv("MW_ORIGIN_FILES");
$type = $argv[1];
$path = $argv[2];
$path = $argv[1];

$yamlData = yaml_parse_file($path);

foreach ($yamlData[$type] as $obj) {
$name = key($obj);
$data = $obj[$name];

$repository = $data['repository'] ?? null;
$commit = $data['commit'] ?? null;
$branch = $data['branch'] ?? null;
$patches = $data['patches'] ?? null;
$persistentDirectories = $data['persistent-directories'] ?? null;
$additionalSteps = $data['additional steps'] ?? null;
$bundled = $data['bundled'] ?? false;

if ($persistentDirectories !== null) {
exec("mkdir -p $MW_ORIGIN_FILES/canasta-$type/$name");
foreach ($directory as $persistentDirectories) {
exec("mv $MW_HOME/canasta-$type/$name/$directory $MW_ORIGIN_FILES/canasta-$type/$name/");
exec("ln -s $MW_VOLUME/canasta-$type/$name/$directory $MW_HOME/canasta-$type/$name/$directory");
}
}

if (!$bundled) {
$gitCloneCmd = "git clone ";
foreach (["skins", "extensions"] as $type) {
foreach ($yamlData[$type] as $obj) {
$name = key($obj);
$data = $obj[$name];

if ($repository === null) {
$repository = "https://github.com/wikimedia/mediawiki-$type-$name";
if ($branch === null) {
$branch = $MW_VERSION;
$gitCloneCmd .= "--single-branch -b $branch ";
$repository = $data['repository'] ?? null;
$commit = $data['commit'] ?? null;
$branch = $data['branch'] ?? null;
$patches = $data['patches'] ?? null;
$persistentDirectories = $data['persistent-directories'] ?? null;
$additionalSteps = $data['additional steps'] ?? null;
$bundled = $data['bundled'] ?? false;

if (!$bundled) {
$gitCloneCmd = "git clone ";

if ($repository === null) {
$repository = "https://github.com/wikimedia/mediawiki-$type-$name";
if ($branch === null) {
$branch = $MW_VERSION;
$gitCloneCmd .= "--single-branch -b $branch ";
}
}
}

$gitCloneCmd .= "$repository $MW_HOME/$type/$name";
$gitCheckoutCmd = "cd $MW_HOME/$type/$name && git checkout -q $commit";

$gitCloneCmd .= "$repository $MW_HOME/$type/$name";
$gitCheckoutCmd = "cd $MW_HOME/$type/$name && git checkout -q $commit";

exec($gitCloneCmd);
exec($gitCheckoutCmd);
exec($gitCloneCmd);
exec($gitCheckoutCmd);

if ($patches !== null) {
foreach ($patches as $patch) {
$gitApplyCmd = "cd $MW_HOME/$type/$name && git apply /tmp/$patch";
exec($gitApplyCmd);
if ($patches !== null) {
foreach ($patches as $patch) {
$gitApplyCmd = "cd $MW_HOME/$type/$name && git apply /tmp/$patch";
exec($gitApplyCmd);
}
}
}

if ($additionalSteps !== null) {
foreach ($additionalSteps as $step) {
if ($step === "composer update") {
$composerUpdateCmd = "cd $MW_HOME/$type/$name && composer update --no-dev";
exec($composerUpdateCmd);
} elseif ($step === "git submodule update") {
$submoduleUpdateCmd = "cd $MW_HOME/$type/$name && git submodule update --init";
exec($submoduleUpdateCmd);
}
}
}
}

if ($additionalSteps !== null) {
foreach ($additionalSteps as $step) {
if ($step === "composer update") {
$composerUpdateCmd = "cd $MW_HOME/$type/$name && composer update --no-dev";
exec($composerUpdateCmd);
} elseif ($step === "git submodule update") {
$submoduleUpdateCmd = "cd $MW_HOME/$type/$name && git submodule update --init";
exec($submoduleUpdateCmd);
if ($persistentDirectories !== null) {
exec("mkdir -p $MW_ORIGIN_FILES/canasta-$type/$name");
foreach ($directory as $persistentDirectories) {
exec("mv $MW_HOME/canasta-$type/$name/$directory $MW_ORIGIN_FILES/canasta-$type/$name/");
exec("ln -s $MW_VOLUME/canasta-$type/$name/$directory $MW_HOME/canasta-$type/$name/$directory");
}
}
}
Expand Down
Loading