summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-30 15:31:23 -0700
committerelijah <elijah@riseup.net>2016-09-01 10:13:31 -0700
commitc4afb0b63fdfaef6a7d67917f5b93e353902d36d (patch)
tree90f8cb671a175dadb81a63d8de1f0fa262119035
parent441a488ac13a6a3cf50d2185f4611f13b54483e7 (diff)
fix paths for gitlab ci
-rw-r--r--.gitlab-ci.yml5
-rwxr-xr-xbin/ci-build.sh22
-rw-r--r--tests/platform-ci/README.md4
-rwxr-xr-xtests/platform-ci/ci-build.sh51
-rw-r--r--tests/platform-ci/provider/.platform-test.conf13
-rw-r--r--tests/platform-ci/provider/Leapfile2
-rwxr-xr-xtests/platform-ci/setup.sh2
7 files changed, 60 insertions, 39 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f2a763c0..fcfd1be9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
before_script:
- echo 'Running global before_script'
- - bundle install --path vendor/bundle --jobs $(nproc) "${FLAGS[@]}"
+ - cd tests/platform-ci
+ - ./setup.sh
stages:
- syntax
@@ -42,4 +43,4 @@ catalog:
build:
stage: build
script:
- - ./bin/ci-build.sh
+ - ./ci-build.sh
diff --git a/bin/ci-build.sh b/bin/ci-build.sh
deleted file mode 100755
index 248bd9f8..00000000
--- a/bin/ci-build.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-. tests/puppet/provider/.platform-test.conf
-
-# break on every error
-set -e
-
-# create node(s) with unique id so we can run tests in parallel
-export TAG="build${CI_BUILD_ID}"
-[ -d "${PROVIDERDIR}/tags" ] || mkdir "${PROVIDERDIR}/tags"
-echo '{}' > "${PROVIDERDIR}/tags/${TAG}.json"
-
-export IP_SUFFIX_START='100'
-#NODES='rewdevcouch1:couchdb,soledad rewdevmx1:mx rewdevvpn1:openvpn,tor rewdevweb1:webapp,monitor rewdevplain1: rewdevstatic1:static'
-export NODES="single${TAG}:couchdb,soledad,mx,webapp,openvpn,tor,monitor,obfsproxy"
-leap-platform-test add_nodes "$NODES"
-
-leap-platform-test -v init_deploy
-leap-platform-test -v test
-cd tests/puppet/provider
-bundle exec leap info "${TAG}"
-bundle exec leap local destroy "${TAG}"
diff --git a/tests/platform-ci/README.md b/tests/platform-ci/README.md
index bc48b21f..60c17e41 100644
--- a/tests/platform-ci/README.md
+++ b/tests/platform-ci/README.md
@@ -9,3 +9,7 @@ Usage:
For a list of all tasks:
bin/rake -T
+
+To create a virtual provider, run tests on it, then tear it down:
+
+ ./ci-build.sh
diff --git a/tests/platform-ci/ci-build.sh b/tests/platform-ci/ci-build.sh
new file mode 100755
index 00000000..38040716
--- /dev/null
+++ b/tests/platform-ci/ci-build.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# This script will run create a virtual provider
+# and run tests on it.
+#
+# This script is triggered by .gitlab-ci.yml
+#
+# It depends on:
+# * leap_platform: in ../..
+# * test provider: in provider/
+# * leap-platform-test: installed in path
+#
+
+# leap_platform/tests/platform-ci
+export ROOTDIR=$(readlink -f "$(dirname $0)")
+
+# leap_platform/tests/platform-ci/provider
+export PROVIDERDIR="${ROOTDIR}/provider"
+
+# leap_platform
+export PLATFORMDIR=$(readlink -f "${ROOTDIR}/../..")
+
+# leap_platform/builds
+export BUILDSDIR="${PLATFORMDIR}/builds"
+export LOCKDIR="${PLATFORMDIR}/builds/lock"
+export LOGDIR="${PLATFORMDIR}/builds/log"
+
+export CONTACTS="sysdev@leap.se"
+export MAIL_TO=$CONTACTS
+export OPTS='--yes'
+export FILTER_COMMON=""
+export LEAP_CMD="bundle exec leap"
+
+echo "CI directory: ${ROOTDIR}"
+echo "Provider directory: ${PROVIDERDIR}"
+echo "Platform directory: ${PLATFORMDIR}"
+
+# create node(s) with unique id so we can run tests in parallel
+export TAG="build${CI_BUILD_ID}"
+[ -d "${PROVIDERDIR}/tags" ] || mkdir "${PROVIDERDIR}/tags"
+echo '{}' > "${PROVIDERDIR}/tags/${TAG}.json"
+
+export IP_SUFFIX_START='100'
+export NODES="single${TAG}:couchdb,soledad,mx,webapp,openvpn,tor,monitor,obfsproxy"
+leap-platform-test add_nodes "$NODES"
+leap-platform-test -v init_deploy
+leap-platform-test -v test
+
+cd $PROVIDERDIR
+$LEAP_CMD info "${TAG}"
+$LEAP_CMD local destroy "${TAG}"
diff --git a/tests/platform-ci/provider/.platform-test.conf b/tests/platform-ci/provider/.platform-test.conf
deleted file mode 100644
index 621fb7b7..00000000
--- a/tests/platform-ci/provider/.platform-test.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-export ROOTDIR=$(pwd)
-
-export PROVIDERDIR="${ROOTDIR}/tests/puppet/provider"
-export PLATFORMDIR="$ROOTDIR"
-export LOGDIR="$ROOTDIR/builds/log"
-
-export CONTACTS="sysdev@leap.se"
-export MAIL_TO=$CONTACTS
-
-export OPTS='--yes'
-export FILTER_COMMON=""
-
-export LEAP_CMD="bundle exec leap"
diff --git a/tests/platform-ci/provider/Leapfile b/tests/platform-ci/provider/Leapfile
index f54c9293..4852aed7 100644
--- a/tests/platform-ci/provider/Leapfile
+++ b/tests/platform-ci/provider/Leapfile
@@ -1 +1 @@
-@platform_directory_path = "../../.."
+@platform_directory_path = File.expand_path("../../../..", __FILE__)
diff --git a/tests/platform-ci/setup.sh b/tests/platform-ci/setup.sh
index 69a348b8..e676ca37 100755
--- a/tests/platform-ci/setup.sh
+++ b/tests/platform-ci/setup.sh
@@ -1,4 +1,4 @@
#!/bin/sh
which bundle || apt install bundle
-bundle install --binstubs --path=vendor --with=test \ No newline at end of file
+bundle install --binstubs --path=vendor --with=test --jobs $(nproc) \ No newline at end of file