diff options
author | Ash McKenzie <ash@the-rebellion.net> | 2019-07-17 06:56:46 +0300 |
---|---|---|
committer | Ash McKenzie <ash@the-rebellion.net> | 2019-07-17 12:02:28 +0300 |
commit | c1d7a3f1b760ed37a1a8c192c2a5a1ad9357add8 (patch) | |
tree | 70b45b630d243e0119804dca4587fc8b61f787a9 | |
parent | e8e429dfefa3e4c03dbd551e517a4d5645618a3c (diff) |
Move CI install/update logic into support/ci/xxx
-rw-r--r-- | .gitlab-ci.yml | 40 | ||||
-rw-r--r-- | support/ci/functions | 47 | ||||
-rwxr-xr-x | support/ci/test_install | 11 | ||||
-rwxr-xr-x | support/ci/test_update | 15 |
4 files changed, 77 insertions, 36 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 457d7472136..21e52a5e6eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,51 +87,19 @@ test:install: stage: test artifacts: paths: - - ./*.log - - ./gitlab/log/*.log + - ./gitlab-development-kit/gitlab/log/*.log expire_in: 2 days when: always script: - - source /home/gdk/.bash_profile - - gem install -N bundler:1.17.3 - - cd gem - - gem build gitlab-development-kit.gemspec - - gem install gitlab-development-kit-*.gem - - cd /home/gdk - - gdk init - - cd gitlab-development-kit - - git remote set-url origin $CI_REPOSITORY_URL - - git fetch - - git checkout $CI_COMMIT_SHA - - netstat -lpt - - IGNORE_INSTALL_WARNINGS=true gdk install - - support/set-gitlab-upstream - - killall node || true - - gdk run & - - sleep 30 - - curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/users/sign_in + - support/ci/test_install test:update: image: $TEST_IMAGE stage: test artifacts: paths: - - ./*.log - - ./gitlab/log/*.log + - ./gitlab-development-kit/gitlab/log/*.log expire_in: 2 days when: always script: - - source /home/gdk/.bash_profile - - gem install -N bundler:1.17.3 - - gem install gitlab-development-kit - - cd /home/gdk - - gdk init - - cd gitlab-development-kit - - netstat -lpt - - IGNORE_INSTALL_WARNINGS=true gdk install - - support/set-gitlab-upstream - - killall node || true - - gdk run & - - sleep 30 - - curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/users/sign_in - - IGNORE_INSTALL_WARNINGS=true gdk update + - support/ci/test_update diff --git a/support/ci/functions b/support/ci/functions new file mode 100644 index 00000000000..d7989475dd4 --- /dev/null +++ b/support/ci/functions @@ -0,0 +1,47 @@ +# vim: filetype=sh + +GDK_CHECKOUT_PATH="$(pwd)/gitlab-development-kit" + +init() { + source ${HOME}/.bash_profile + gem install -N bundler:1.17.3 + cd gem + gem build gitlab-development-kit.gemspec + gem install gitlab-development-kit-*.gem + gdk init ${GDK_CHECKOUT_PATH} +} + +checkout() { + cd ${GDK_CHECKOUT_PATH} + git remote set-url origin ${CI_REPOSITORY_URL} + git fetch + git checkout ${1} +} + +install() { + cd ${GDK_CHECKOUT_PATH} + netstat -lpt + echo "> Installing GDK.." + IGNORE_INSTALL_WARNINGS=true gdk install + support/set-gitlab-upstream +} + +update() { + cd ${GDK_CHECKOUT_PATH} + netstat -lpt + echo "> Updating GDK.." + IGNORE_INSTALL_WARNINGS=true gdk update + support/set-gitlab-upstream +} + +run() { + cd ${GDK_CHECKOUT_PATH} + killall node || true + echo "> Starting up GDK.." + gdk run +} + +test_url() { + echo "> Testing GDK.." + curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/users/sign_in +} diff --git a/support/ci/test_install b/support/ci/test_install new file mode 100755 index 00000000000..733d2411bba --- /dev/null +++ b/support/ci/test_install @@ -0,0 +1,11 @@ +#!/bin/bash -e + +source support/ci/functions + +init +checkout ${CI_COMMIT_SHA} +install +run & +echo "> Waiting 45 secs to give GDK a change to boot up.." +sleep 45 +test_url diff --git a/support/ci/test_update b/support/ci/test_update new file mode 100755 index 00000000000..508c590c028 --- /dev/null +++ b/support/ci/test_update @@ -0,0 +1,15 @@ +#!/bin/bash -e + +source support/ci/functions + +init +checkout "master" +install +run & +echo "> Waiting 45 secs to give GDK a change to boot up.." +sleep 45 +checkout ${CI_COMMIT_SHA} +update +echo "> Waiting 60 secs to give GDK a change to boot up.." +sleep 60 +test_url |