]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
initial take on supporting declarative requirements per job
authorAlfredo Deza <adeza@redhat.com>
Wed, 24 Jun 2015 16:18:46 +0000 (12:18 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 24 Jun 2015 16:57:42 +0000 (12:57 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph-deploy-pull-requests/build/build [new file with mode: 0644]
ceph-deploy-pull-requests/setup/playbooks/setup.yml [new file with mode: 0644]
ceph-deploy-pull-requests/setup/playbooks/tasks/ubuntu.yml [new file with mode: 0644]

diff --git a/ceph-deploy-pull-requests/build/build b/ceph-deploy-pull-requests/build/build
new file mode 100644 (file)
index 0000000..dd345e4
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -ex
+
+# Create the virtualenv
+virtualenv venv
+. venv/bin/activate
+
+# Define and ensure the PIP cache
+PIP_SDIST_INDEX="$HOME/.cache/pip"
+mkdir -p $PIP_SDIST_INDEX
+
+# Define and ensure a GIT Ansible cache
+REPO_CACHE="$HOME/.cache/git/ceph-build"
+mkdir -p $REPO_CACHE
+
+# Clone the ceph-build repo or pull if it exists
+if [ -d "$REPO_CACHE/.git" ]; then
+    cd "$REPO_CACHE" && git pull
+    cd -
+else
+    git clone https://github.com/ceph/ceph-build.git "$REPO_CACHE"
+fi
+
+# Install the package by trying with the cache first, otherwise doing a download only, and then
+# trying to install from the cache again.
+if ! venv/bin/pip install --find-links="file://$PIP_SDIST_INDEX" --no-index ansible; then
+    venv/bin/pip install --download-directory="$PIP_SDIST_INDEX" ansible
+    venv/bin/pip install --find-links="file://$PIP_SDIST_INDEX" --no-index ansible
+fi
+
+# run ansible to get this current host to meet our requirements, specifying
+# a local connection and 'localhost' as the host where to execute
+cd "$REPO_CACHE/ceph-deploy-pull-requests/setup/playbooks"
+ansible-playbook -i "localhost," -c local setup.yml
diff --git a/ceph-deploy-pull-requests/setup/playbooks/setup.yml b/ceph-deploy-pull-requests/setup/playbooks/setup.yml
new file mode 100644 (file)
index 0000000..f45d5f9
--- /dev/null
@@ -0,0 +1,11 @@
+---
+
+- hosts: localhost
+  user: jenkins-build
+  sudo: True
+
+  tasks:
+     - include: tasks/ubuntu.yml
+       when: ansible_distribution == "Ubuntu"
+
+     # TODO: maybe add RPM or Debian handling?
diff --git a/ceph-deploy-pull-requests/setup/playbooks/tasks/ubuntu.yml b/ceph-deploy-pull-requests/setup/playbooks/tasks/ubuntu.yml
new file mode 100644 (file)
index 0000000..cfcebbb
--- /dev/null
@@ -0,0 +1,18 @@
+---
+  - name: add deadsnakes ppa
+    action: apt_repository repo=ppa:fkrull/deadsnakes state=present
+
+  - name: "update apt repo"
+    action: apt update-cache=yes
+
+  - name: install python requirements
+    action: apt pkg=$item state=installed
+    with_items:
+      - python-software-properties
+      - python-dev
+      - python-setuptools
+      - python2.6
+      - python2.7
+
+  - name: install pip
+    action: easy_install name=pip