summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore12
-rw-r--r--puppet/modules/site_couchdb/files/designs/identities/Identity.json8
-rw-r--r--puppet/modules/site_couchdb/files/designs/invite_codes/InviteCode.json44
-rw-r--r--puppet/modules/site_couchdb/files/designs/messages/Message.json8
-rw-r--r--puppet/modules/site_couchdb/files/designs/tickets/Ticket.json16
-rwxr-xr-xtests/platform-ci/ci-build.sh35
-rw-r--r--tests/platform-ci/provider/users/gitlab-runner-bitmask/gitlab-runner-bitmask_ssh.pub1
-rw-r--r--tests/platform-ci/provider/users/gitlab-runner-ibex/gitlab-runner-ibex_ssh.pub1
-rw-r--r--tests/platform-ci/provider/users/gitlab-runner-platform/gitlab-runner-platform_ssh.pub1
-rw-r--r--tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub1
10 files changed, 77 insertions, 50 deletions
diff --git a/.gitignore b/.gitignore
index 5c9d135a..0dabe1db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,9 +18,15 @@
/tests/platform-ci/provider/tags/*
!/tests/platform-ci/provider/tags/catalogtest.json
/tests/platform-ci/provider/users/*
-!/tests/platform-ci/provider/users/gitlab-runner
-/tests/platform-ci/provider/users/gitlab-runner/*
-!/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub
+!tests/platform-ci/provider/users/gitlab-runner-bitmask
+tests/platform-ci/provider/users/gitlab-runner-bitmask/*
+!tests/platform-ci/provider/users/gitlab-runner-bitmask/gitlab-runner-bitmask_ssh.pub
+!tests/platform-ci/provider/users/gitlab-runner-ibex
+tests/platform-ci/provider/users/gitlab-runner-ibex/*
+!tests/platform-ci/provider/users/gitlab-runner-ibex/gitlab-runner-ibex_ssh.pub
+!tests/platform-ci/provider/users/gitlab-runner-platform
+tests/platform-ci/provider/users/gitlab-runner-platform/*
+!tests/platform-ci/provider/users/gitlab-runner-platform/gitlab-runner-platform_ssh.pub
/tests/platform-ci/provider/test
/builds
diff --git a/puppet/modules/site_couchdb/files/designs/identities/Identity.json b/puppet/modules/site_couchdb/files/designs/identities/Identity.json
index b1c567c1..c099ae4a 100644
--- a/puppet/modules/site_couchdb/files/designs/identities/Identity.json
+++ b/puppet/modules/site_couchdb/files/designs/identities/Identity.json
@@ -9,14 +9,14 @@
"all": {
"map": " function(doc) {\n if (doc['type'] == 'Identity') {\n emit(doc._id, null);\n }\n }\n"
},
- "cert_fingerprints_by_expiry": {
- "map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.cert_fingerprints === \"object\") {\n for (fp in doc.cert_fingerprints) {\n if (doc.cert_fingerprints.hasOwnProperty(fp)) {\n emit(doc.cert_fingerprints[fp], fp);\n }\n }\n }\n}\n"
+ "disabled": {
+ "map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.user_id === \"undefined\") {\n emit(doc._id, 1);\n }\n}\n"
},
"cert_expiry_by_fingerprint": {
"map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.cert_fingerprints === \"object\") {\n for (fp in doc.cert_fingerprints) {\n if (doc.cert_fingerprints.hasOwnProperty(fp)) {\n emit(fp, doc.cert_fingerprints[fp]);\n }\n }\n }\n}\n"
},
- "disabled": {
- "map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.user_id === \"undefined\") {\n emit(doc._id, 1);\n }\n}\n"
+ "cert_fingerprints_by_expiry": {
+ "map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.cert_fingerprints === \"object\") {\n for (fp in doc.cert_fingerprints) {\n if (doc.cert_fingerprints.hasOwnProperty(fp)) {\n emit(doc.cert_fingerprints[fp], fp);\n }\n }\n }\n}\n"
},
"pgp_key_by_email": {
"map": "function(doc) {\n if (doc.type != 'Identity') {\n return;\n }\n if (typeof doc.keys === \"object\") {\n emit(doc.address, doc.keys[\"pgp\"]);\n }\n}\n"
diff --git a/puppet/modules/site_couchdb/files/designs/invite_codes/InviteCode.json b/puppet/modules/site_couchdb/files/designs/invite_codes/InviteCode.json
index 006c1ea1..d6e1e9d5 100644
--- a/puppet/modules/site_couchdb/files/designs/invite_codes/InviteCode.json
+++ b/puppet/modules/site_couchdb/files/designs/invite_codes/InviteCode.json
@@ -1,22 +1,26 @@
{
- "_id": "_design/InviteCode",
- "language": "javascript",
- "views": {
- "by__id": {
- "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['_id'] != null)) {\n emit(doc['_id'], 1);\n }\n }\n",
- "reduce": "_sum"
- },
- "by_invite_code": {
- "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['invite_code'] != null)) {\n emit(doc['invite_code'], 1);\n }\n }\n",
- "reduce": "_sum"
- },
- "by_invite_count": {
- "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['invite_count'] != null)) {\n emit(doc['invite_count'], 1);\n }\n }\n",
- "reduce": "_sum"
- },
- "all": {
- "map": " function(doc) {\n if (doc['type'] == 'InviteCode') {\n emit(doc._id, null);\n }\n }\n"
- }
- },
- "couchrest-hash": "83fb8f504520b4a9c7ddbb7928cd0ce3"
+ "_id": "_design/InviteCode",
+ "language": "javascript",
+ "views": {
+ "by_invite_code": {
+ "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['invite_code'] != null)) {\n emit(doc['invite_code'], 1);\n }\n }\n",
+ "reduce": "_sum"
+ },
+ "by_invite_count": {
+ "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['invite_count'] != null)) {\n emit(doc['invite_count'], 1);\n }\n }\n",
+ "reduce": "_sum"
+ },
+ "by_created_at": {
+ "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['created_at'] != null)) {\n emit(doc['created_at'], 1);\n }\n }\n",
+ "reduce": "_sum"
+ },
+ "by_updated_at": {
+ "map": " function(doc) {\n if ((doc['type'] == 'InviteCode') && (doc['updated_at'] != null)) {\n emit(doc['updated_at'], 1);\n }\n }\n",
+ "reduce": "_sum"
+ },
+ "all": {
+ "map": " function(doc) {\n if (doc['type'] == 'InviteCode') {\n emit(doc._id, null);\n }\n }\n"
+ }
+ },
+ "couchrest-hash": "2d1883c83164a0be127c3a569d9c1902"
} \ No newline at end of file
diff --git a/puppet/modules/site_couchdb/files/designs/messages/Message.json b/puppet/modules/site_couchdb/files/designs/messages/Message.json
index 6a48fc4d..2cb031c6 100644
--- a/puppet/modules/site_couchdb/files/designs/messages/Message.json
+++ b/puppet/modules/site_couchdb/files/designs/messages/Message.json
@@ -2,14 +2,14 @@
"_id": "_design/Message",
"language": "javascript",
"views": {
- "by_user_ids_to_show": {
- "map": "function (doc) {\n if (doc.type === 'Message' && doc.user_ids_to_show && Array.isArray(doc.user_ids_to_show)) {\n doc.user_ids_to_show.forEach(function (userId) {\n emit(userId, 1);\n });\n }\n}\n",
- "reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
- },
"by_user_ids_to_show_and_created_at": {
"map": "// not using at moment\n// call with something like Message.by_user_ids_to_show_and_created_at.startkey([user_id, start_date]).endkey([user_id,end_date])\nfunction (doc) {\n if (doc.type === 'Message' && doc.user_ids_to_show && Array.isArray(doc.user_ids_to_show)) {\n doc.user_ids_to_show.forEach(function (userId) {\n emit([userId, doc.created_at], 1);\n });\n }\n}\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
+ "by_user_ids_to_show": {
+ "map": "function (doc) {\n if (doc.type === 'Message' && doc.user_ids_to_show && Array.isArray(doc.user_ids_to_show)) {\n doc.user_ids_to_show.forEach(function (userId) {\n emit(userId, 1);\n });\n }\n}\n",
+ "reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
+ },
"all": {
"map": " function(doc) {\n if (doc['type'] == 'Message') {\n emit(doc._id, null);\n }\n }\n"
}
diff --git a/puppet/modules/site_couchdb/files/designs/tickets/Ticket.json b/puppet/modules/site_couchdb/files/designs/tickets/Ticket.json
index 578f632b..7ec24634 100644
--- a/puppet/modules/site_couchdb/files/designs/tickets/Ticket.json
+++ b/puppet/modules/site_couchdb/files/designs/tickets/Ticket.json
@@ -22,8 +22,12 @@
"map": " function(doc) {\n if ((doc['type'] == 'Ticket') && (doc['is_open'] != null) && (doc['updated_at'] != null)) {\n emit([doc['is_open'], doc['updated_at']], 1);\n }\n }\n",
"reduce": "_sum"
},
- "by_includes_post_by_and_is_open_and_created_at": {
- "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.is_open, doc.created_at], 1);\n }\n });\n }\n}\n",
+ "by_includes_post_by_and_updated_at": {
+ "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.updated_at], 1);\n }\n });\n }\n}\n",
+ "reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
+ },
+ "by_includes_post_by_and_created_at": {
+ "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.created_at], 1);\n }\n });\n }\n}\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_includes_post_by": {
@@ -34,12 +38,8 @@
"map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.is_open, doc.updated_at], 1);\n }\n });\n }\n}\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
- "by_includes_post_by_and_created_at": {
- "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.created_at], 1);\n }\n });\n }\n}\n",
- "reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
- },
- "by_includes_post_by_and_updated_at": {
- "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.updated_at], 1);\n }\n });\n }\n}\n",
+ "by_includes_post_by_and_is_open_and_created_at": {
+ "map": "function(doc) {\n var arr = {}\n if (doc['type'] == 'Ticket' && doc.comments) {\n doc.comments.forEach(function(comment){\n if (comment.posted_by && !arr[comment.posted_by]) {\n //don't add duplicates\n arr[comment.posted_by] = true;\n emit([comment.posted_by, doc.is_open, doc.created_at], 1);\n }\n });\n }\n}\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"all": {
diff --git a/tests/platform-ci/ci-build.sh b/tests/platform-ci/ci-build.sh
index 06af59ca..843642a4 100755
--- a/tests/platform-ci/ci-build.sh
+++ b/tests/platform-ci/ci-build.sh
@@ -12,9 +12,9 @@
# * AWS credentials as environment variables:
# * `AWS_ACCESS_KEY`
# * `AWS_SECRET_KEY`
-# * ssh private key used to login to remove vm
-# * `SSH_PRIVATE_KEY`
-#
+# * ssh private keys used to clone providers:
+# * `bitmask_PROVIDER_SSH_PRIVATE_KEY`
+# * `ibex_PROVIDER_SSH_PRIVATE_KEY`
# exit if any commands returns non-zero status
set -e
@@ -70,7 +70,26 @@ test() {
LEAP_CMD test "$TAG"
}
+ssh_setup() {
+ # set the provider name from the first argument passed to the function
+ provider_name=$1
+ # set CI_SSH_SECRET_PRIVATE_KEY to the variable name keyed off of the provider_name
+ CI_SSH_SECRET_PRIVATE_KEY=${provider_name}_PROVIDER_SSH_PRIVATE_KEY
+ # Set the SSH_PRIVATE_KEY to the value provided in the CI runner secret variable setting in gitlab
+ SSH_PRIVATE_KEY=${!CI_SSH_SECRET_PRIVATE_KEY}
+ echo "Working with provider: $provider_name"
+ [ -z "$SSH_PRIVATE_KEY" ] && fail "${provider_name}_PROVIDER_SSH_PRIVATE_KEY is not set - please provide it as env variable."
+ # Configure ssh keypair
+ [ -d ~/.ssh ] || /bin/mkdir ~/.ssh
+ /bin/echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
+ /bin/chmod 600 ~/.ssh/id_rsa
+ /bin/cp "${ROOTDIR}/provider/users/gitlab-runner-${provider_name}/gitlab-runner-${provider_name}_ssh.pub" ~/.ssh/id_rsa.pub
+}
+
build_from_scratch() {
+ # setup ssh keys
+ ssh_setup platform
+
# allow passing into the function the services, use a default set if empty
SERVICES=$1
if [ -z "$SERVICES" ]
@@ -100,7 +119,6 @@ build_from_scratch() {
[ -z "$AWS_ACCESS_KEY" ] && fail "\$AWS_ACCESS_KEY is not set - please provide it as env variable."
[ -z "$AWS_SECRET_KEY" ] && fail "\$AWS_SECRET_KEY is not set - please provide it as env variable."
- [ -z "$SSH_PRIVATE_KEY" ] && fail "\$SSH_PRIVATE_KEY is not set - please provide it as env variable."
/usr/bin/jq ".platform_ci.auth |= .+ {\"aws_access_key_id\":\"$AWS_ACCESS_KEY\", \"aws_secret_access_key\":\"$AWS_SECRET_KEY\"}" < cloud.json.template > cloud.json
# Enable xtrace again only if it was set at beginning of script
@@ -140,6 +158,9 @@ run() {
provider_URI=$2
platform_branch=$3
+ # setup ssh keys
+ ssh_setup "$provider_name"
+
# Setup the provider repository
echo "Setting up the provider repository: $provider_name by cloning $provider_URI"
git clone -q --depth 1 "$provider_URI"
@@ -232,12 +253,6 @@ cleanup() {
# Ensure we don't output secret stuff to console even when running in verbose mode with -x
set +x
-# Configure ssh keypair
-[ -d ~/.ssh ] || /bin/mkdir ~/.ssh
-/bin/echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
-/bin/chmod 600 ~/.ssh/id_rsa
-/bin/cp "${ROOTDIR}/provider/users/gitlab-runner/gitlab-runner_ssh.pub" ~/.ssh/id_rsa.pub
-
# Enable xtrace again only if it was set at beginning of script
[[ $xtrace == true ]] && set -x
diff --git a/tests/platform-ci/provider/users/gitlab-runner-bitmask/gitlab-runner-bitmask_ssh.pub b/tests/platform-ci/provider/users/gitlab-runner-bitmask/gitlab-runner-bitmask_ssh.pub
new file mode 100644
index 00000000..eb206639
--- /dev/null
+++ b/tests/platform-ci/provider/users/gitlab-runner-bitmask/gitlab-runner-bitmask_ssh.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8ICt9oOuuuP7Rt1nIy1qcUV/xW7mDmCb0fcKkFDeAo+7UerEMcA+68oDNw+crc1nfoaW++lnDRIYnyJY43hX0P72u8mzIbt7YB0XgrQiofoygp5c72jQGbeV/59HoKiHI/PUsAG8Sy1oynBpzSd9OWi+h9dBdGq/Wisjdw1/0cILCmNZp0bKDnYfAgEUNmtxd6FFs+dx9x9hHBlquXYzOnMq0XBZiKvxdsnK1gFkNp34y3id7flXyOD5ecTNZJlhPwLTo2z22Re2GCqCh2og8tE58eIQXDeKNyyvmslgyJr2GxKpnjWOlNXW+SCX+bCx02GFuAiww5CcDWu1QuowL micah@muck
diff --git a/tests/platform-ci/provider/users/gitlab-runner-ibex/gitlab-runner-ibex_ssh.pub b/tests/platform-ci/provider/users/gitlab-runner-ibex/gitlab-runner-ibex_ssh.pub
new file mode 100644
index 00000000..25f085d2
--- /dev/null
+++ b/tests/platform-ci/provider/users/gitlab-runner-ibex/gitlab-runner-ibex_ssh.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1PAycLznUiMoWyEnb3e4AXT8EaAMW+K3of8EA1+NLQMYots35hmCFG/T9fUMV/j3pf0afG8A6uaJc00gc7otph2DWMboVB9cjvqgSQSZ9VZEy7aoc85jX0RyeKONE1N/aIWu2/8vsFInx4iBS+Sh0/H3nQEMxekOTSeyz3tWN4gLZK5n8i65PpwzlpynGyILq0pdMobfPPuRiCT9Xx4/2NbIYgKZJDYcZeis5FyY6M/TO2u4StDBin8+056NLpS4Q9z5/8K9oT0b7pzx66ebd33Yon4pP2I7Bm2cW+2h4F5bJ7gM8WaiZzuPhEZGzmFiD7XLTvGaoR43jdw6cJP05 micah@muck
diff --git a/tests/platform-ci/provider/users/gitlab-runner-platform/gitlab-runner-platform_ssh.pub b/tests/platform-ci/provider/users/gitlab-runner-platform/gitlab-runner-platform_ssh.pub
new file mode 100644
index 00000000..3347e621
--- /dev/null
+++ b/tests/platform-ci/provider/users/gitlab-runner-platform/gitlab-runner-platform_ssh.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCctVP6O1R6x0KnNpCyIJq7B/M5BWVeCNq1FexHqWBlOabJN+GeUKRkxAjIdPLf3J6Wki7q9hMyIAvKoqaIu3kQ9EHbRwc0znt/ofF9abZ8g+d3v0eg+WFVWopUktp97SfOfHkUUjlWJQUMh4HCl5SStaIBUgrB+l8FGmLYGZvGgoA86AWNo7Zr7D1RHfNYKYAC1uPa+RnxfzGgiy+hz8PmVjaRFmH7UcgsiwinTUSzDsEXVx8NXlEwv1NV86/RZ/EB2nOhYoKOn1WFXVVhtOtqlzoi0M4jLD3nylzyAnX4HdslTIuDB1aoawfTfvdcuqCzs6Z7dFAo0OqUGo7faO1 platform_provider
diff --git a/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub b/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub
deleted file mode 100644
index 3e72b70f..00000000
--- a/tests/platform-ci/provider/users/gitlab-runner/gitlab-runner_ssh.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEtniDgIYEm4WtGgiQsZKBpY8x3tbzDBIoMLbZT496juCu4c3f+F5KkMPLmYRPcAupF8tVf+j7Fns7z69PuTjdGfe/cA9CTw/4sNAu3iLpunGR0d2Wtctez5mwz13bKRu9fck3H9p2F9Z47vMKtRTJJ6iIgaUVWU/eFd/MSMJeUVd2ns4Wr7SkHCBB3PV+QL1xl4+AZsUtnGVQ5cE4MZZFia/g6SlrKQYFtLRVIIpDuuaDSvULg1BFMhSCBDNygts8dKTJsCEQYeGVvHZaDwtKTnMqEIwBP4TkIoP+YWnZTPrGywFEJOlZ8b+4HdgdUAFLcFCycWMM9nVcWX7P2lIN gitlab-runner_ssh