From 39cf947757acc0637dfaad1bdf61333dcc72cd62 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Thu, 7 Oct 2021 12:19:52 +0100 Subject: [PATCH] Run a pre-prod test CI step --- .gitlab-ci.yml | 25 +++++++++++++++++++++++++ Dockerfile | 3 +++ docker/wp-config.php | 32 +++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37d799fd..764ea00b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1 +1,26 @@ include: "https://git.autistici.org/ai3/build-container/raw/master/common.yml" + +# test the newly built container before releasing it. +stages: + - build + - test + - release + +test: + stage: test + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/debian:stable + services: + - name: ${IMAGE_TAG} + alias: noblogs + - name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mysql:latest + alias: mysql + variables: + APACHE_PORT: 8080 + SITE_URL: "http://noblogs:8080" + MYSQL_DATABASE: noblogstest + MYSQL_ROOT_PASSWORD: changeme + script: + - apt -q update + - env DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install mariadb-client curl + - curl -v ${SITE_URL} + diff --git a/Dockerfile b/Dockerfile index 8ead4316..1866a564 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,3 +17,6 @@ COPY docker/post-upgrade.sh /post-upgrade.sh RUN /tmp/build.sh && rm /tmp/build.sh +# For testing purposes (8080 is the default port of apache2-php-base). +EXPOSE 8080/tcp + diff --git a/docker/wp-config.php b/docker/wp-config.php index 1b464007..d9695b9e 100644 --- a/docker/wp-config.php +++ b/docker/wp-config.php @@ -4,8 +4,38 @@ * First of all, read our own configuration file. * * Store the result in an associative array '$noblogs_config'. + * + * If the configuration file does not exist, start with a testing + * configuration that is meant to work with our CI. */ -$noblogs_config = json_decode(file_get_contents('/etc/noblogs/config.json'), true); +$noblogs_config = array( + "secrets" => array( + "auth_key" => "testkey", + "secure_auth_key" => "testkey", + "logged_in_key" => "testkey", + "nonce_key" => "testkey", + "auth_salt" => "testkey", + "secure_auth_salt" => "testkey", + "logged_in_salt" => "testkey", + "nonce_salt" => "testkey" + ), + "db_config" => array( + "backends" => array( + "default" => array( + "host" => "mysql", + "port" => "3306", + "name" => getenv("MYSQL_DATABASE"), + "user" => "root", + "password" => getenv("MYSQL_ROOT_PASSWORD") + ) + ) + ) + ); + +$noblogs_config_json = file_get_contents('/etc/noblogs/config.json'); +if ($noblogs_config_json) { + $noblogs_config = json_decode($noblogs_config_json, true); +} /** * The base configurations of the WordPress. -- GitLab