summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-08-25 06:46:17 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-08-25 06:50:32 -0700
commitab1a4c9599059e720b4a18dea154bef0dbc817f5 (patch)
tree56117589853635c370c88871580aae4e26bd890e
parentce8b752ed0fc40567d34d27ac0d073eaafe39889 (diff)
Add memcached to Jenkins build environment
Change-Id: Ieb29292035d599c2114f32e0d50bdb4bb463fd29 Issue-id: INT-114 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
-rw-r--r--packer/provision/memcached.sh42
-rw-r--r--packer/templates/memcached.json54
2 files changed, 96 insertions, 0 deletions
diff --git a/packer/provision/memcached.sh b/packer/provision/memcached.sh
new file mode 100644
index 000000000..4f2923722
--- /dev/null
+++ b/packer/provision/memcached.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# This particular environment was created specifically for MultiCloud
+
+# vim: ts=4 sw=4 sts=4 et tw=72 :
+
+# force any errors to cause the script and job to end in failure
+set -xeu -o pipefail
+
+rh_systems() {
+ # memcached
+ yum install -y memcached
+ systemctl enable memcached
+}
+
+ubuntu_systems() {
+ # memcached
+ apt-get install memcached
+}
+
+all_systems() {
+ echo 'No common distribution configuration to perform'
+}
+
+echo "---> Detecting OS"
+ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
+
+case "${ORIGIN}" in
+ fedora|centos|redhat)
+ echo "---> RH type system detected"
+ rh_systems
+ ;;
+ ubuntu)
+ echo "---> Ubuntu system detected"
+ ubuntu_systems
+ ;;
+ *)
+ echo "---> Unknown operating system"
+ ;;
+esac
+
+# execute steps for all systems
+all_systems
diff --git a/packer/templates/memcached.json b/packer/templates/memcached.json
new file mode 100644
index 000000000..722785e62
--- /dev/null
+++ b/packer/templates/memcached.json
@@ -0,0 +1,54 @@
+{
+ "variables": {
+ "stack_tenant": null,
+ "stack_user": null,
+ "stack_pass": null,
+ "stack_network": null,
+ "base_image": null,
+ "cloud_user": null,
+ "distro": null,
+ "cloud_user_data": null
+ },
+ "builders": [
+ {
+ "type": "openstack",
+ "identity_endpoint": "https://auth.vexxhost.net/v2.0/",
+ "tenant_name": "{{user `stack_tenant`}}",
+ "username": "{{user `stack_user`}}",
+ "password": "{{user `stack_pass`}}",
+ "region": "ca-ymq-1",
+ "ssh_username": "{{user `cloud_user`}}",
+ "image_name": "{{user `distro`}} - memcached - {{isotime \"20060102-1504\"}}",
+ "source_image_name": "{{user `base_image`}}",
+ "flavor": "v1-standard-1",
+ "availability_zone": "ca-ymq-2",
+ "networks": [
+ "{{user `stack_network`}}"
+ ],
+ "user_data_file": "{{user `cloud_user_data`}}"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "shell",
+ "inline": [
+ "mkdir -p /tmp/packer"
+ ]
+ },
+ {
+ "type": "file",
+ "source": "provision/basebuild/",
+ "destination": "/tmp/packer"
+ },
+ {
+ "type": "shell",
+ "scripts": [
+ "provision/baseline.sh",
+ "provision/basebuild.sh",
+ "provision/memcached.sh",
+ "provision/system_reseal.sh"
+ ],
+ "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+ }
+ ]
+}