diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-29 13:54:46 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-29 13:54:46 +0000 |
commit | bcab2430635d12e23b380c4179c41792762dcf6c (patch) | |
tree | 57cef1c2869bd085f4761f4fb364a08fe483a632 | |
parent | 27fc082de4dfe0a4eb1fc1bcf5202db1255e1bf1 (diff) | |
parent | 3a9992ed5cafc85b30d63a7583729f15191be0d9 (diff) | |
download | gitlab-ci-bcab2430635d12e23b380c4179c41792762dcf6c.tar.gz |
Merge branch 'ci-config-docker-support' into 'master'
Adjust CI config to support Docker executors
A shell script (based on the one for GitLab CE) has been added to
support Docker executors. Tags have been added to make sure builds are
only executed on appropriate runners.
This makes it possible to test forks of the GitLab CI repository on
public runners. Previously, builds failed with the following error:
```
$ bundle --without postgres
/builds/eldamir/gitlab-ci.sh: line 29: bundle: command not found
ERROR: Build failed with: exit code 127
```
See merge request !212
-rw-r--r-- | .gitlab-ci.yml | 16 | ||||
-rwxr-xr-x | script/prepare_build.sh | 21 |
2 files changed, 32 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b7d749..69f7289 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,17 +1,23 @@ before_script: - - export PATH=~/bin:/usr/local/bin:/usr/bin:/bin + - ./script/prepare_build.sh - ruby -v - gem install bundler - - cp config/database.yml.mysql config/database.yml - cp config/application.yml.example config/application.yml - cp config/secrets.yml.example config/secrets.yml - - 'sed "s/username\:.*$/username\: runner/" -i config/database.yml' - - 'sed "s/password\:.*$/password\: ''password''/" -i config/database.yml' - bundle --without postgres - RAILS_ENV=test bundle exec rake db:setup specs: script: SIMPLECOV=true RAILS_ENV=test bundle exec rake spec + tags: + - ruby + - mysql rubocop: script: bundle exec rubocop + tags: + - ruby + - mysql brakeman: - script: bundle exec brakeman
\ No newline at end of file + script: bundle exec brakeman + tags: + - ruby + - mysql diff --git a/script/prepare_build.sh b/script/prepare_build.sh new file mode 100755 index 0000000..836e11f --- /dev/null +++ b/script/prepare_build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +if [ -f /.dockerinit ]; then + export FLAGS=(--deployment --path /cache) + + apt-get update -qq + apt-get install -y -qq nodejs + + wget -q http://ftp.de.debian.org/debian/pool/main/p/phantomjs/phantomjs_1.9.0-1+b1_amd64.deb + dpkg -i phantomjs_1.9.0-1+b1_amd64.deb + + cp config/database.yml.mysql config/database.yml + sed -i "s/username:.*/username: root/g" config/database.yml + sed -i "s/password:.*/password:/g" config/database.yml + sed -i "s/# socket:.*/host: mysql/g" config/database.yml +else + export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin + + cp config/database.yml.mysql config/database.yml + sed -i "s/username\:.*$/username\: runner/" config/database.yml + sed -i "s/password\:.*$/password\: 'password'/" config/database.yml +fi |