Verified Commit 9c5e763b authored by Alexandre Morin's avatar Alexandre Morin
Browse files

feat (12468) : auto update docker image

parent 6d61c43c
Pipeline #5426 failed with stages
in 1 minute and 6 seconds
services:
- postgres:9.4
image: docker:19.03.1
services:
- docker:19.03.1-dind
stages:
- build
- tests
- push
variables:
POSTGRES_DB: "maarchRMtest"
POSTGRES_USER: maarch
POSTGRES_PASSWORD: ""
npm_config_cache: /builds/cypress-io/cypress-example-docker-gitlab/.npm
CYPRESS_CACHE_FOLDER: /builds/cypress-io/cypress-example-docker-gitlab/cache/Cypress
before_script:
- docker info
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
......@@ -21,119 +24,141 @@ cache:
- node_modules
- vendor/
unit-tests:php-7.2:
image: php:7.2-apache
stage: tests
before_script:
- apt-get update > /dev/null
- mkdir -p /usr/share/man/man1
- mkdir -p /usr/share/man/man7
- apt-get install cron -yqq > /dev/null
- bash tests/ci/docker_install_php.sh > /dev/null
- bash tests/ci/docker_install_database.sh > /dev/null
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
build:
stage: build
script:
- useradd -m -g www-data maarch
- echo "export APACHE_RUN_USER=maarch" >> /etc/apache2/envvars
- mkdir -p /var/www/html/
- cp -R /builds/maarch/maarchRM/ /var/www/maarchRM/
- mv /var/www/maarchRM/ /var/www/laabs/
- cd /var/www/laabs
- cp data/maarchRM/conf/vhost.conf.default data/maarchRM/conf/vhost.conf
- cp data/maarchRM/conf/configuration.ini.default data/maarchRM/conf/configuration.ini
- cp data/maarchRM/conf/confvars.ini.default data/maarchRM/conf/confvars.ini
- sed -i -e 's!localhost!postgres!' data/maarchRM/conf/confvars.ini
- sed -i -e 's!maarchRM!maarchRMtest!' data/maarchRM/conf/confvars.ini
- mkdir -p /var/www/laabs/data/maarchRM/repository/archives_1 /var/www/laabs/data/maarchRM/repository/archives_2
- chown -R maarch:www-data /var/www
- chmod -R 777 /var/www
- cd /etc/apache2/sites-available/
- touch maarchRM.conf
- echo "Include /var/www/laabs/data/maarchRM/conf/vhost.conf" >> maarchRM.conf
- echo "127.0.0.1 maarchrm" >> /etc/hosts
- a2ensite maarchRM.conf
- a2dissite 000-default.conf
- a2enmod rewrite
- a2enmod env
- service apache2 start
- cd /var/www/laabs
- composer install
- sed -i -e 's!pgsql:host=localhost;dbname=maarchRMtest;port=5432!pgsql:host=postgres;dbname=maarchRMtest;port=5432!' /var/www/laabs/codeception.yml
- vendor/bin/codecept run
artifacts:
paths:
- tests/codeception/_output/
expire_in: 1 week
when: always
functional-test:cypress:
image: cypress/base:10
stage: tests
script:
- mv /builds/maarch/maarchRM/cypress.json /builds/maarch/maarchRM/cypress.json.old
- mv /builds/maarch/maarchRM/cypress.json.ci /builds/maarch/maarchRM/cypress.json
- npm install
- npm ci
- $(npm bin)/cypress verify
- $(npm bin)/cypress run
only:
- schedules
artifacts:
expire_in: 1 week
when: always
paths:
- tests/cypress/screenshots
- tests/cypress/videos
syntax-test:php-metrics:
image: jakzal/phpqa
stage: tests
script: phpmetrics --report-html=var/php-metrics src
- docker build --build-arg APP_VERSION=${CI_COMMIT_REF_NAME} --build-arg CACHE_DATE="$(date)" $CI_DOCKERFILE -t "$CI_REGISTRY_IMAGE_TEST"
- docker push "$CI_REGISTRY_IMAGE_TEST"
except:
- schedules
only:
- develop
artifacts:
paths:
- var/php-metrics/
allow_failure: true
syntax-test:php-phpmd:
image: jakzal/phpqa
tests:
stage: tests
script:
- mkdir var/
- phpmd src html phpmd.xml --reportfile var/phpmd.html --exclude --ignore-violations-on-exit
except:
- schedules
only:
- develop
- docker pull "$CI_REGISTRY_IMAGE_TEST"
- docker run $CI_REGISTRY_IMAGE_TEST bash -c "echo \"127.0.0.1 maarchrm\" >> /etc/hosts
&& service apache2 start
&& service postgresql start
&& cd /var/www/laabs/
&& composer install
&& vendor/bin/codecept run"
artifacts:
paths:
- var/phpmd.html
allow_failure: true
- tests/codeception/_output/
expire_in: 1 week
when: always
syntax-test:php-deprecation-detector:
image: jakzal/phpqa
stage: tests
push:
stage: push
script:
- deprecation-detector check src vendor/
- docker pull "$CI_REGISTRY_IMAGE_TEST"
- docker tag "$CI_REGISTRY_IMAGE_TEST" "$CI_REGISTRY_IMAGE"
- docker push "$CI_REGISTRY_IMAGE"
only:
- feat/autopush_dockerhub
except:
- schedules
only:
- develop
allow_failure: true
#build-dockerhub:
# stage: push
#unit-tests:php-7.2:
# image: php:7.2-apache
# stage: tests
# before_script:
# - apt-get update > /dev/null
# - mkdir -p /usr/share/man/man1
# - mkdir -p /usr/share/man/man7
# - apt-get install cron -yqq > /dev/null
# - bash tests/ci/docker_install_php.sh > /dev/null
# - bash tests/ci/docker_install_database.sh > /dev/null
# - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# script:
# - useradd -m -g www-data maarch
# - echo "export APACHE_RUN_USER=maarch" >> /etc/apache2/envvars
# - mkdir -p /var/www/html/
# - cp -R /builds/maarch/maarchRM/ /var/www/maarchRM/
# - mv /var/www/maarchRM/ /var/www/laabs/
# - cd /var/www/laabs
# - cp data/maarchRM/conf/vhost.conf.default data/maarchRM/conf/vhost.conf
# - cp data/maarchRM/conf/configuration.ini.default data/maarchRM/conf/configuration.ini
# - cp data/maarchRM/conf/confvars.ini.default data/maarchRM/conf/confvars.ini
# - sed -i -e 's!localhost!postgres!' data/maarchRM/conf/confvars.ini
# - sed -i -e 's!maarchRM!maarchRMtest!' data/maarchRM/conf/confvars.ini
# - mkdir -p /var/www/laabs/data/maarchRM/repository/archives_1 /var/www/laabs/data/maarchRM/repository/archives_2
# - chown -R maarch:www-data /var/www
# - chmod -R 777 /var/www
# - cd /etc/apache2/sites-available/
# - touch maarchRM.conf
# - echo "Include /var/www/laabs/data/maarchRM/conf/vhost.conf" >> maarchRM.conf
# - echo "127.0.0.1 maarchrm" >> /etc/hosts
# - a2ensite maarchRM.conf
# - a2dissite 000-default.conf
# - a2enmod rewrite
# - a2enmod env
# - service apache2 start
# - cd /var/www/laabs
# - composer install
# - sed -i -e 's!pgsql:host=localhost;dbname=maarchRMtest;port=5432!pgsql:host=postgres;dbname=maarchRMtest;port=5432!' /var/www/laabs/codeception.yml
# - vendor/bin/codecept run
# artifacts:
# paths:
# - tests/codeception/_output/
# expire_in: 1 week
# when: always
#
#functional-test:cypress:
# image: cypress/base:10
# stage: tests
# script:
# - mv /builds/maarch/maarchRM/cypress.json /builds/maarch/maarchRM/cypress.json.old
# - mv /builds/maarch/maarchRM/cypress.json.ci /builds/maarch/maarchRM/cypress.json
# - npm install
# - npm ci
# - $(npm bin)/cypress verify
# - $(npm bin)/cypress run
# only:
# - schedules
# artifacts:
# expire_in: 1 week
# when: always
# paths:
# - tests/cypress/screenshots
# - tests/cypress/videos
#
#syntax-test:php-metrics:
# image: jakzal/phpqa
# stage: tests
# script: phpmetrics --report-html=var/php-metrics src
# except:
# - schedules
# only:
# - develop
# artifacts:
# paths:
# - var/php-metrics/
# allow_failure: true
#
#syntax-test:php-phpmd:
# image: jakzal/phpqa
# stage: tests
# script:
# - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
# - docker build tests/dockerfile/ -t "$CI_REGISTRY_IMAGE"
# - docker tag "$CI_REGISTRY_IMAGE"
# - docker push "$CI_REGISTRY_IMAGE"
# - mkdir var/
# - phpmd src html phpmd.xml --reportfile var/phpmd.html --exclude --ignore-violations-on-exit
# except:
# - schedules
# only:
# - feat/codeception
# - develop
# artifacts:
# paths:
# - var/phpmd.html
# allow_failure: true
#
#
#syntax-test:php-deprecation-detector:
# image: jakzal/phpqa
# stage: tests
# script:
# - deprecation-detector check src vendor/
# except:
# - schedules
\ No newline at end of file
# - schedules
# only:
# - develop
# allow_failure: true
......@@ -22,10 +22,10 @@ settings:
modules:
enabled:
- Db:
dsn: 'pgsql:host=localhost;dbname=maarchRMtest;port=5432'
dsn: 'pgsql:host=localhost;dbname=maarchRM;port=5432'
user: 'maarch'
password: 'maarch'
dump: 'tests/codeception/_data/dump.sql'
cleanup: false # run populator before each test
populate: true # run populator before all test
populator: 'psql -U $user -h $host -d $dbname < $dump'
\ No newline at end of file
populator: 'PGPASSWORD=maarch psql -U $user -h $host -d $dbname < $dump'
\ No newline at end of file
# suite config
suites:
api:
actor: ApiTester
path: .
modules:
enabled:
- REST:
url: http://maarchrm
depends: PhpBrowser
paths:
tests: tests/codeception
output: tests/codeception/_output
data: tests/codeception/_data
support: tests/codeception/_support
settings:
shuffle: false
lint: true
modules:
enabled:
- Db:
dsn: 'pgsql:host=postgres;dbname=maarchRMtest;port=5432'
user: 'maarch'
password: 'maarch'
dump: 'tests/codeception/_data/dump.sql'
cleanup: false # run populator before each test
populate: true # run populator before all test
populator: 'psql -U $user -h $host -d $dbname < $dump'
\ No newline at end of file
#!/bin/bash
[[ ! -e /.dockerenv ]] && exit 0
set -xe
apt-get install postgresql-client -yqq
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/audit/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/auth/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/batchProcessing/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/contact/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/filePlan/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/lifeCycle/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/organization/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/recordsManagement/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/src/bundle/digitalResource/Resources/sql/schema.pgsql.sql
psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -w < /builds/maarch/maarchRM/data/maarchRM/sql/pgsql/demo.sql
#!/usr/bin/env bash
# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && exit 0
set -xe
apt-get update -yqq
apt-get install git p7zip-full default-jre -yqq
apt-get install -y libpq-dev libxml2-dev libxslt1-dev libpng-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo_pgsql pgsql xsl zip
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment