diff --git a/flavours/jenkins/README.md b/flavours/jenkins/README.md new file mode 100644 index 00000000..a80d8c43 --- /dev/null +++ b/flavours/jenkins/README.md @@ -0,0 +1,25 @@ +Provisions a jenkins for doing tests of openstack cloud images +============================================================== + +After deploying the image, jenkins should be available on port 8080. + +*The following is fiction* + +To use this, add a new application at +`https://github.com/organizations/$ORGANISATION/settings/applications` and grab +the client id and secret it provides. + +Config options +-------------- + +XXX: These should be passed in via cloud-init or salt, not on image build. For +now, export before building the image. + +* export `GITHUB_ORGANISATION` to set the which organisation to look for github + committers from. + +* export `GITHUB_ADMINS` to set a list of github users to be jenkins admins. + +* export `GITHUB_CLIENT_ID` to set the github OAuth client id. + +* export `GITHUB_SECRET` to set the github OAuth secret. diff --git a/flavours/jenkins/first-boot.d/10-jenkins b/flavours/jenkins/first-boot.d/10-jenkins new file mode 100755 index 00000000..675e0c78 --- /dev/null +++ b/flavours/jenkins/first-boot.d/10-jenkins @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e +set -o xtrace + +# jenkins installs into /var/lib/jenkins which is rather restrictive. +mv /var/lib/jenkins /mnt/ +ln -s /mnt/jenkins /var/lib/jenkins + + diff --git a/flavours/jenkins/install.d/10-jenkins b/flavours/jenkins/install.d/10-jenkins new file mode 100755 index 00000000..a30c3923 --- /dev/null +++ b/flavours/jenkins/install.d/10-jenkins @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e +set -o xtrace + +apt-get -y install jenkins + +# jenkins installs into /var/lib/jenkins which is rather restrictive. +mv /var/lib/jenkins /mnt/ +ln -s /mnt/jenkins /var/lib/jenkins diff --git a/flavours/jenkins/pre-install.d/10-jenkins b/flavours/jenkins/pre-install.d/10-jenkins new file mode 100755 index 00000000..c5b049f9 --- /dev/null +++ b/flavours/jenkins/pre-install.d/10-jenkins @@ -0,0 +1,8 @@ +#!/bin/bash +# Add the Jenkins package archive + +set -e +set -o xtrace + +wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add - +echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list diff --git a/flavours/local-config/install.d/61-http-proxy b/flavours/local-config/install.d/61-http-proxy index a7df942a..809606ca 100755 --- a/flavours/local-config/install.d/61-http-proxy +++ b/flavours/local-config/install.d/61-http-proxy @@ -6,11 +6,9 @@ set -e set -o xtrace if [ -n "$http_proxy" ]; then - sudo -Hiu stack dd of=~stack/.profile oflag=append conv=notrunc << EOF -export no_proxy=192.0.2.1 -export http_proxy=$http_proxy -EOF - sudo dd of=/etc/apt/apt.conf.d/61-use-http-proxy << _EOF_ - Acquire::http::Proxy "$http_proxy"; -_EOF_ + if [ -d ~stack ]; then + echo export no_proxy=192.0.2.1 >> ~stack/.profile + echo export http_proxy=$http_proxy >> ~stack/.profile + fi + echo Acquire::http::Proxy \"$http_proxy\"; > /etc/apt/apt.conf.d/61-use-http-proxy fi diff --git a/flavours/local-config/install.d/62-ssh-key b/flavours/local-config/install.d/62-ssh-key index 1f31ef81..e4f01a07 100755 --- a/flavours/local-config/install.d/62-ssh-key +++ b/flavours/local-config/install.d/62-ssh-key @@ -5,6 +5,8 @@ set -e if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then - sudo -u stack mkdir ~stack/.ssh - sudo -Hiu stack dd of=~stack/.ssh/authorized_keys oflag=append conv=notrunc if=/tmp/in_target.d/ssh-authorized-keys + if [ -d ~stack ]; then + sudo -u stack mkdir ~stack/.ssh + sudo -Hiu stack dd of=~stack/.ssh/authorized_keys oflag=append conv=notrunc if=/tmp/in_target.d/ssh-authorized-keys + fi fi