Compare commits

...

11 Commits

Author SHA1 Message Date
Markus Opolka
806f92df4b Updating to Version 3.8.1+180524 2018-05-29 21:03:40 +02:00
Markus Opolka
107c57f82c Updating to Version 3.8.0+180522 2018-05-25 09:29:05 +02:00
Markus Opolka
8d96eee149 Updating to Version 3.7.3+180516 2018-05-23 08:51:38 +02:00
Markus Opolka
038ccda1f5 Update container-structure-test download path 2018-05-16 12:59:05 +02:00
Markus Opolka
4cf3ada28d Updating to Version 3.7.2+180508 2018-05-16 12:00:26 +02:00
Markus Opolka
1422a7f90c Updating to Version 3.7.1+180424 2018-05-09 09:47:34 +02:00
Markus Opolka
60c137bbb0 Update Update-Script 2018-05-03 18:11:24 +02:00
Markus Opolka
eab1b832b6 Add CONTRIBUTING.md 2018-04-30 13:47:22 +02:00
Markus Opolka
89068ea89d Merge pull request #6 from martialblog/extend-tests
Add container-structore tests
2018-04-30 13:13:07 +02:00
Markus Opolka
c7f1bee380 Add container-structore tests
- Fixes issue #4
2018-04-30 13:06:19 +02:00
Markus Opolka
cb3f54eb90 Add requirements file for Python 2018-04-24 16:06:14 +02:00
9 changed files with 148 additions and 9 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
\#*
.\#*
.venv/
.venv/
container-structure-test

View File

@@ -2,9 +2,10 @@ sudo: required
language: bash
services:
- docker
matrix:
include:
- env: TEST=limesurvey-apache
script: docker build -t martialblog/limesurvey-apache -f apache/Dockerfile .
- env: TEST=limesurvey-fpm
script: docker build -t martialblog/limesurvey-fpm -f fpm/Dockerfile .
- env: TAG=martialblog/limesurvey-apache
script: docker build -q -t $TAG -f apache/Dockerfile . && tests/run.sh $TAG
- env: TAG=martialblog/limesurvey-fpm
script: docker build -q -t $TAG -f fpm/Dockerfile . && tests/run.sh $TAG

34
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,34 @@
# Contributing
Every Pull Request is welcome.
## Upgrading the Version
To upgrade the LimeSurvey Version the ARG variable needs to be changed.
```bash
$ grep Agrep ARG apache/Dockerfile
ARG version='3.7.0+180418'
```
Since this is a reoccuring and boring task, a script is provided.
```bash
# Dependencies
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
# Upgrades to latest Limesurvey version
./upgrade.py
```
## Testing
In order to make sure the image works as promised, some tests are provided:
```bash
./tests/run.sh
```
For further information: https://github.com/GoogleContainerTools/container-structure-test

View File

@@ -1,6 +1,6 @@
FROM php:7.2-apache
LABEL maintainer="markus@martialblog.de"
ARG version='3.7.0+180418'
ARG version='3.8.1+180524'
# Install OS dependencies
RUN apt-get update && \

View File

@@ -1,6 +1,6 @@
FROM php:7.2-fpm
LABEL maintainer="markus@martialblog.de"
ARG version='3.7.0+180418'
ARG version='3.8.1+180524'
# Install OS dependencies
RUN apt-get update && \

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
feedparser==5.2.1

77
tests/image_tests.yaml Normal file
View File

@@ -0,0 +1,77 @@
schemaVersion: "2.0.0"
globalEnvVars:
- key: "PATH"
value: "/env/bin:$PATH"
fileContentTests:
- name: 'Limesurvey admin file content'
path: '/var/www/html/admin/index.php'
expectedContents: ['LimeSurvey']
fileExistenceTests:
- name: 'Limesurvey files'
path: '/var/www/html/index.php'
shouldExist: true
permissions: '-rw-rw-r--'
- name: 'Limesurvey admin files'
path: '/var/www/html/admin/index.php'
shouldExist: true
permissions: '-rw-rw-r--'
- name: 'Ldap syslink'
path: '/usr/lib/x86_64-linux-gnu/libldap.so'
shouldExist: true
- name: "Dependencies - PHP - gd"
path: '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini'
shouldExist: true
- name: "Dependencies - PHP - imap"
path: '/usr/local/etc/php/conf.d/docker-php-ext-imap.ini'
shouldExist: true
- name: "Dependencies - PHP - ldap"
path: '/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini'
shouldExist: true
- name: "Dependencies - PHP - pgsql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pgsql.ini'
shouldExist: true
- name: "Dependencies - PHP - zip"
path: '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini'
shouldExist: true
- name: "Dependencies - PHP - sodium"
path: '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini'
shouldExist: true
- name: "Dependencies - PHP - pdo_mysql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini'
shouldExist: true
- name: "Dependencies - PHP - pdo_pgsql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini'
shouldExist: true
commandTests:
- name: "Dependencies - libldap2-dev"
command: "dpkg"
args: ["-l", "libldap2-dev"]
exitCode: 0
- name: "Dependencies - zlib1g-dev"
command: "dpkg"
args: ["-l", "zlib1g-dev"]
exitCode: 0
- name: "Dependencies - libc-client-dev"
command: "dpkg"
args: ["-l", "libc-client-dev"]
exitCode: 0
- name: "Dependencies - libkrb5-dev"
command: "dpkg"
args: ["-l", "libkrb5-dev"]
exitCode: 0
- name: "Dependencies - libpng-dev"
command: "dpkg"
args: ["-l", "libpng-dev"]
exitCode: 0
- name: "Dependencies - libpq-dev"
command: "dpkg"
args: ["-l", "libpq-dev"]
exitCode: 0
- name: "Dependencies - PHP Modules"
command: "php"
args: ["-m"]
expectedOutput: ["ldap", "zip", "pdo_mysql", "pdo_sqlite", "gd", "mbstring", "PDO", "imap"]

11
tests/run.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
IMAGE=$1
if [ ! -f container-structure-test ]; then
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
mv container-structure-test-linux-amd64 container-structure-test
chmod +x container-structure-test
fi
./container-structure-test test --image $IMAGE --config tests/image_tests.yaml

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
import feedparser
import sys
import subprocess
@@ -17,12 +18,22 @@ docker_feed = feedparser.parse(docker_feed_url)
limesv_current_release = limesv_feed.entries[0].title_detail.value
docker_current_release = docker_feed.entries[0].title_detail.value
argumentparser = argparse.ArgumentParser(description='Updates the LimeSurvey Version in the Dockerfiles')
argumentparser.add_argument('--noop', dest='noop', action="store_true", required=False, help="Don't push just commit")
argumentparser.add_argument('--check', dest='check', action="store_true", required=False, help="Only check if there's a new version available")
cmdargs = argumentparser.parse_args()
if limesv_current_release == docker_current_release:
print('Nothing to do.')
sys.exit(0)
print('New Version {} available. Upgrading...'.format(limesv_current_release))
commit_message = 'Update to Version {}'.format(limesv_current_release)
print('New Version {} available.'.format(limesv_current_release))
if cmdargs.check:
sys.exit(0)
commit_message = 'Updating to Version {}'.format(limesv_current_release)
# Dockerfiles
regexp = 's/[0-9]\.[0-9]\.[0-9]+[0-9]*/{new_version}/'.format(new_version=limesv_current_release)
@@ -38,6 +49,9 @@ subprocess.call(['git', 'commit', '-m', commit_message])
subprocess.call(['git', 'tag', limesv_current_release])
print('> Created new Commit and Tag')
if cmdargs.noop:
sys.exit(0)
# Git Push
# subprocess.call(['git', 'push', 'origin', limesv_current_release])
subprocess.call(['git', 'push'])