Add .pipeline/ with dev image variant
authorBrennen Bearnes <bbearnes@wikimedia.org>
Wed, 15 May 2019 00:14:11 +0000 (18:14 -0600)
committerBrennen Bearnes <bbearnes@wikimedia.org>
Tue, 24 Sep 2019 23:20:10 +0000 (17:20 -0600)
This adds a .pipeline/, containing:

  - blubber.yaml which, for now, defines a single variant for creating
    a Docker image to be used by the local-charts[0] environment.  This
    image is built on dev-stretch-php72-fpm-apache2, which is defined in
    dev-images[1].

  - dev_prereq.sh which installs some extensions, runs composer, and
    creates a stub LocalSettings.php in the dev image as a blubber builder
    command.

  - config.yaml for building the dev image.

This depends on publication of dev/stretch-php72-fpm-apache2 to
docker-registry.wikimedia.org:

  - https://phabricator.wikimedia.org/T223327
  - https://phabricator.wikimedia.org/T223329

It can be tested locally by:

  1. Installing Docker, blubber[2], and Minikube

  2. Building the images in dev-images with `make`

  3. Saving a copy of the dev-stretch-php72-fpm-apache2 image:

     $ docker save -o dev-stretch-php72-fpm-apache2.tar
       docker-registry.wikimedia.org/dev/dev-stretch-php72-fpm-apache2

  4. Importing that image into Minikube's docker:

     $ eval $(minikube docker-env)
     $ docker load --input ./dev-stretch-php72-fpm-apache2.tar

  5. Building an image tagged "docker-registry.wikimedia.org/dev/mediawiki"
     from the root of this repository:

     $ blubber .pipeline/blubber.yaml dev | docker build --pull=false -t docker-registry.wikimedia.org/dev/mediawiki -f - .

That image should now be usable by local-charts.

[0]. https://gerrit.wikimedia.org/r/plugins/gitiles/releng/local-charts/
[1]. https://gerrit.wikimedia.org/r/plugins/gitiles/releng/dev-images/
[2]. https://wikitech.wikimedia.org/wiki/Blubber/Download

Bug: T218360
Change-Id: I1c8192e67c39e86c4903a9137dba7c02faee3145
Depends-On: I8a5a5f2c24d81fb94b104a3a98627d9fbe6059bf

.pipeline/blubber.yaml [new file with mode: 0644]
.pipeline/config.yaml [new file with mode: 0644]
.pipeline/dev_prereq.sh [new file with mode: 0755]

diff --git a/.pipeline/blubber.yaml b/.pipeline/blubber.yaml
new file mode 100644 (file)
index 0000000..13ad966
--- /dev/null
@@ -0,0 +1,14 @@
+version: v4
+base: docker-registry.wikimedia.org/dev/stretch-php72-fpm-apache2
+
+lives:
+  in: /var/www/html
+
+variants:
+  dev:
+    runs:
+      insecurely: true
+    builder:
+      command: [.pipeline/dev_prereq.sh]
+      requirements: [.pipeline, .pipeline/dev_prereq.sh, composer.json]
+    copies: [local]
diff --git a/.pipeline/config.yaml b/.pipeline/config.yaml
new file mode 100644 (file)
index 0000000..08f1db8
--- /dev/null
@@ -0,0 +1,9 @@
+pipelines:
+  publish:
+    blubberfile: blubber.yaml
+    stages:
+      - name: dev
+        build: dev
+        publish:
+          image: true
+          tags: [dev]
diff --git a/.pipeline/dev_prereq.sh b/.pipeline/dev_prereq.sh
new file mode 100755 (executable)
index 0000000..a1f4bd0
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+mkdir /tmp/php
+mkdir -p extensions
+
+git clone --depth 1 https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor.git /var/www/html/extensions/VisualEditor
+git clone --depth 1 https://gerrit.wikimedia.org/r/mediawiki/skins/Vector /var/www/html/skins/Vector
+cd /var/www/html/extensions/VisualEditor
+git submodule update --depth 1 --init
+
+cd /var/www/html
+composer install
+cat <<PHP > LocalSettings.php
+<?php
+require_once '/var/config/LocalSettings.php';
+PHP