Newer
Older
Herman van Rink
committed
#
# CI for Aegir Hosting System
#
# For docs see http://docs.aegirproject.org
# and http://docs.aegirproject.org/en/3.x/community/release-process/#setting-up-a-gitlab-runner
# Is performed before the scripts in the stages step
before_script:
- source /etc/profile
# Defines stages which are to be executed
stages:
- build
- test
Herman van Rink
committed
- upgradetest
Herman van Rink
committed
image: bobey/docker-gitlab-ci-runner-php5.6
script:
- composer require phplint/phplint
- echo "Syntax checking PHP files"
- echo "For more information http://www.icosaedro.it/phplint/"
- vendor/bin/phplint ./ --exclude "vendor"
Herman van Rink
committed
#
### Stage "build"
#
build:deb:
stage: build
image: aegir/hostmaster:packaging_base
script:
- export commit=$(git log -n 1 --oneline | sed 's/ .*$//')
- export version=$(sed -ne 's/^[^(]*(\([^)]*\)).*/\1/;1p' debian/changelog)
- export new_version="${version}+${CI_BUILD_ID}.${commit}"
- dch -D unstable --newversion "$new_version" "automatic GitLab CI build ${CI_BUILD_ID}"
- dpkg-buildpackage
- mkdir build
- mv -v ../aegir3*.deb build/
- mv -v ../aegir-archive-keyring*.deb build/
# The files which are to be made available in GitLab as artifacts.
artifacts:
paths:
- build/*
Herman van Rink
committed
#
### Stage "test"
#
test:debian-jessie-aegir3-apt:
stage: test
image: debian:jessie
dependencies:
- build:deb
Herman van Rink
committed
only:
Herman van Rink
committed
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-debian8.sh"
test:debian-stretch-aegir3-apt:
stage: test
image: debian:stretch
dependencies:
- build:deb
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-debian9.sh"
test:ubuntu-xenial-aegir3-apt:
stage: test
image: ubuntu:xenial
dependencies:
- build:deb
Herman van Rink
committed
only:
Herman van Rink
committed
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-ubuntu-xenial.sh"
stage: test
image: ubuntu:artful
dependencies:
- build:deb
Herman van Rink
committed
only:
- 7.x-3.x
- /^7\.x-3\.\d+\.x/
Herman van Rink
committed
- /-runalltests$/
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-ubuntu-artful.sh"
test:debian-stretch-aegir3-cluster-slave-apt:
stage: test
image: debian:stretch
allow_failure: false
dependencies:
- build:deb
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
- apt-get install --yes sudo curl
script: "scripts/ci-aegir-dev-install-apt-debian9-cluster-slave.sh"
image: aegir/hostmaster:packaging_base
allow_failure: true
- sudo apt-get install --yes apt-transport-https ca-certificates curl gnupg2 software-properties-common
- curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
- sudo apt-key fingerprint 0EBFCD88
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
- sudo apt-get install --yes docker-ce
- docker info
- git clone http://github.com/aegir-project/tests.git tests
- cd tests
- git checkout $AEGIR_TESTS_VERSION
# Run prepare scripts.
- cd travis
- sudo bash prepare-docker.sh
- bash prepare-testenv.sh
script:
# Tests are included in the docker-compose.yml file in the tests repo.
- sudo docker-compose -f docker-compose-provision.yml run hostmaster
Herman van Rink
committed
#
### Stage "publish"
#
publish:unstable-repo:
stage: publish
dependencies:
- build:deb
- /^7\.x-3\.\d+\.x/
image: ruby:2.1
before_script:
# install ssh-agent
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- scp build/* ci@aegir0.aegir.coop:/var/www/repos/incoming/
# reprepro should pick this up in seconds and update the repository index.
Herman van Rink
committed
Herman van Rink
committed
#
### Stage "upgradetest"
#
Herman van Rink
committed
# Upgrade the latest stable Aegir to our unstable repo.
upgradetest:debian-jessie-aegir3-apt-upgrade:
stage: upgradetest
image: debian:jessie
dependencies:
Herman van Rink
committed
Herman van Rink
committed
before_script:
- apt-get update
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
- echo "#!/bin/sh" > /usr/sbin/policy-rc.d
- echo "exit 0" >> /usr/sbin/policy-rc.d
Herman van Rink
committed
script:
- "scripts/ci-aegir-stable-install-apt-debian8.sh"
- sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
- sudo su aegir --login --command 'drush @hostmaster hosting-tasks --force'
- sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
- sudo su aegir --login --command 'drush @hostmaster hosting-tasks --force'
- sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count();"'
- sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count_running();"'
- sleep 2m
- sudo su aegir --login --command 'drush @hostmaster php-eval "echo hosting_task_count_running();"'
Herman van Rink
committed
# upgrade to the latest version from the unstable repo.
- rm -v /etc/apt/sources.list.d/aegir-stable.list
- echo "deb http://debian.aegirproject.org unstable main" | sudo tee -a /etc/apt/sources.list.d/aegir-unstable.list
Herman van Rink
committed
- sudo apt-get update
- sudo apt-get --yes upgrade