Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Refactor deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
viglesiasce committed Nov 8, 2014
1 parent 5a2e038 commit d498f90
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 355 deletions.
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Vagrant.configure("2") do |config|
chef.add_recipe "micro-qa::jenkins"
chef.add_recipe "micro-qa::eutester"
chef.add_recipe "micro-qa::console-tests"
chef.add_recipe "micro-qa::deploy"
chef.json = {}
end
end
43 changes: 38 additions & 5 deletions cookbooks/micro-qa/recipes/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
#
# Cookbook Name:: cookbooks/micro-qa
# Recipe:: deploy
# Recipe:: eutester
#
# Copyright 2014, Eucalyptus Systems
#
# All rights reserved - Do Not Redistribute
#
include_recipe 'micro-qa'
include_recipe 'python'
python_pip 'fabric'
package "git"
include_recipe "micro-qa"

pip_options = ""
if platform?("redhat", "centos", "fedora")
# code for only redhat family systems.
%w{python-devel python-setuptools gcc git unzip wget}.each do |package_name|
package package_name
end
pip_options = "--pre"
chef_dk_url = 'https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chefdk-0.3.2-1.x86_64.rpm'
chef_dk_rpm = '/root/chef-dk.rpm'
remote_file chef_dk_rpm do
source chef_dk_url
end
yum_package "chef-dk" do
action :install
source chef_dk_rpm
end
elsif platform?("ubuntu", "debian")
# code for debian
%w{python-setuptools gcc python-dev git git wget}.each do |package_name|
package package_name
end
chef_dk_url = 'http://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.3.2-1_amd64.deb'
chef_dk_deb = '/root/chef-dk.deb'
remote_file chef_dk_deb do
source chef_dk_url
end
dpkg_package "chef-dk" do
action :install
source chef_dk_deb
end
end

python_pip "fabric"
python_pip "PyYAML"

45 changes: 2 additions & 43 deletions jenkins/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ The will run once per minute and up to the number defined in the concurrent jobs
</listView>
<hudson.plugins.sectioned__view.SectionedView plugin="[email protected]">
<owner class="hudson" reference="../../.."/>
<name>Provisioning</name>
<name>Deploy Eucalyptus</name>
<description>&lt;html&gt;&#xd;
&lt;head&gt;&#xd;
&lt;title&gt;&lt;/title&gt;&#xd;
Expand All @@ -292,8 +292,6 @@ The will run once per minute and up to the number defined in the concurrent jobs
&lt;div style=&quot;font-family: Verdana, Helvetica, &apos;sans serif&apos;; font-size: 11px; background-color: rgb(255, 255, 255);&quot;&gt;&#xd;
&lt;font size=&quot;5&quot;&gt;Steps to deploy Eucalyptus&lt;/font&gt;&lt;/div&gt;&#xd;
&lt;ol&gt;&#xd;
&lt;li style=&quot;font-family: Verdana, Helvetica, &apos;sans serif&apos;; font-size: 11px; background-color: rgb(255, 255, 255);&quot;&gt;&#xd;
&lt;span style=&quot;font-size:16px;&quot;&gt;Upload your SSH keys or set the default password for the nodes you wish to run Eucalyptus on&lt;/span&gt;&lt;/li&gt;&#xd;
&lt;li style=&quot;font-family: Verdana, Helvetica, &apos;sans serif&apos;; font-size: 11px; background-color: rgb(255, 255, 255);&quot;&gt;&#xd;
&lt;span style=&quot;font-size:16px;&quot;&gt;Run the Deploy job&lt;/span&gt;&lt;/li&gt;&#xd;
&lt;li style=&quot;font-family: Verdana, Helvetica, &apos;sans serif&apos;; font-size: 11px; background-color: rgb(255, 255, 255);&quot;&gt;&#xd;
Expand All @@ -315,26 +313,6 @@ The will run once per minute and up to the number defined in the concurrent jobs
<hudson.plugins.sectioned__view.ListViewSection>
<jobNames>
<comparator class="hudson.util.CaseInsensitiveComparator"/>
<string>Set default password</string>
<string>Upload Host Keypair</string>
</jobNames>
<jobFilters/>
<name>Administrate</name>
<width>FULL</width>
<alignment>CENTER</alignment>
<columns>
<hudson.views.StatusColumn/>
<hudson.views.JobColumn/>
<hudson.views.LastSuccessColumn/>
<hudson.views.LastFailureColumn/>
<hudson.views.LastDurationColumn/>
<hudson.views.BuildButtonColumn/>
<jenkins.plugins.extracolumns.LastBuildConsoleColumn plugin="[email protected]"/>
</columns>
</hudson.plugins.sectioned__view.ListViewSection>
<hudson.plugins.sectioned__view.ListViewSection>
<jobNames>
<comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../hudson.plugins.sectioned__view.ListViewSection/jobNames/comparator"/>
<string>Deploy</string>
</jobNames>
<jobFilters/>
Expand All @@ -348,26 +326,7 @@ The will run once per minute and up to the number defined in the concurrent jobs
<hudson.views.LastFailureColumn/>
<hudson.views.LastDurationColumn/>
<hudson.views.BuildButtonColumn/>
<jenkins.plugins.extracolumns.LastBuildConsoleColumn plugin="[email protected]"/>
</columns>
</hudson.plugins.sectioned__view.ListViewSection>
<hudson.plugins.sectioned__view.ListViewSection>
<jobNames>
<comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../hudson.plugins.sectioned__view.ListViewSection/jobNames/comparator"/>
<string>Rebuild</string>
</jobNames>
<jobFilters/>
<name>Rebuild</name>
<width>FULL</width>
<alignment>CENTER</alignment>
<columns>
<hudson.views.StatusColumn/>
<hudson.views.JobColumn/>
<hudson.views.LastSuccessColumn/>
<hudson.views.LastFailureColumn/>
<hudson.views.LastDurationColumn/>
<hudson.views.BuildButtonColumn/>
<jenkins.plugins.extracolumns.LastBuildConsoleColumn plugin="[email protected]"/>
<jenkins.plugins.extracolumns.LastBuildConsoleColumn plugin="[email protected]"/>
</columns>
</hudson.plugins.sectioned__view.ListViewSection>
</sections>
Expand Down
145 changes: 76 additions & 69 deletions jenkins/jobs/Deploy/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,64 +27,71 @@
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.BooleanParameterDefinition>
<name>nuke_before_deploy</name>
<description></description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
<hudson.model.TextParameterDefinition>
<name>environment</name>
<name>config</name>
<description>&lt;font size=&quot;3&quot; color=&quot;blue&quot;&gt;
&lt;a href=&quot;https://github.com/eucalyptus/eucalyptus-cookbook/blob/master/environments/edge-nightly.json&quot;&gt;
Sample environment&lt;/a&gt;
&lt;a href=&quot;https://github.com/eucalyptus/eucalyptus-cookbook/blob/testing/attributes/default.rb&quot;&gt;
For possible attributes that can be set look here.&lt;/a&gt;
&lt;/font&gt;</description>
<defaultValue>{
&quot;name&quot;: &quot;edge-nightly&quot;,
&quot;description&quot;: &quot;4.0 Nightlies EDGE Testing&quot;,
&quot;json_class&quot;: &quot;Chef::Environment&quot;,
&quot;chef_type&quot;: &quot;environment&quot;,
&quot;default_attributes&quot;: {
&quot;eucalyptus&quot;: {
&quot;network&quot;: { &quot;public-ips&quot;: &quot;REQUIRED&quot;},
&quot;topology&quot;: {
&quot;clc-1&quot;: &quot;&lt;CLC-IP&gt;&quot;,
&quot;walrus&quot;: &quot;&lt;WALRUS-IP&gt;&quot;,
&quot;user-facing&quot;: [&quot;&lt;UFS-IP&gt;&quot;],
&quot;clusters&quot;: {
&quot;default&quot;: {
&quot;cc-1&quot;: &quot;&lt;CC-IP&gt;&quot;,
&quot;sc-1&quot;: &quot;&lt;SC-IP&gt;&quot;,
&quot;nodes&quot;: &quot;&lt;NC-IP&gt;&quot;
}
}
},
&quot;eucalyptus-repo&quot;: &quot;http://downloads.eucalyptus.com/software/eucalyptus/4.0/centos/6/x86_64/&quot;,
&quot;euca2ools-repo&quot;: &quot;http://downloads.eucalyptus.com/software/euca2ools/3.1/centos/6/x86_64/&quot;
}
}
}
</defaultValue>
</hudson.model.TextParameterDefinition>
<hudson.model.TextParameterDefinition>
<name>bootstrap</name>
<description>&lt;font size=&quot;3&quot; color=&quot;blue&quot;&gt;
&lt;a href=&quot;https://github.com/eucalyptus/eucalyptus-cookbook/blob/master/bootstrap.json&quot;&gt;
Sample bootstrap&lt;/a&gt;
&lt;/font&gt;</description>
<defaultValue>{
&quot;nodes&quot;: [
{
&quot;groups&quot;: [&quot;cloud::full&quot;,&quot;node::default&quot;],
&quot;hosts&quot;: [&quot;&lt;YOUR MACHINE IP&gt;&quot;]
}
]
}</defaultValue>
<defaultValue>---
name: basic-config
description: Basic Deployment
default_attributes:
eucalyptus:
topology:
clc-1: &lt;ENTER-MACHINE-IP&gt;
walrus: &lt;ENTER-MACHINE-IP&gt;
user-facing:
- &lt;ENTER-MACHINE-IP&gt;
clusters:
one:
cc-1: &lt;ENTER-MACHINE-IP&gt;
sc-1: &lt;ENTER-MACHINE-IP&gt;
### Node Controller list looks like: 192.168.0.1 192.168.0.2 192.168.0.3
nodes: &lt;ENTER-MACHINE-IPS-SPACE-SEPERATED-STRING&gt;
network:
public-ips: &lt;ENTER-PUBLIC-IPS-RANGE&gt;
public-interface: br0
private-interface: br0
### Name of bridge to create on NCs
bridge-interface: br0
### This is the interface on the NCs to attach the bridge to
bridged-nic: eth0</defaultValue>
</hudson.model.TextParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="[email protected]">
<com.sonyericsson.rebuild.RebuildSettings plugin="[email protected]">
<autoRebuild>false</autoRebuild>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="[email protected]">
<maxConcurrentPerNode>0</maxConcurrentPerNode>
<maxConcurrentTotal>0</maxConcurrentTotal>
<throttleEnabled>false</throttleEnabled>
<throttleOption>project</throttleOption>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
<hudson.plugins.disk__usage.DiskUsageProperty plugin="[email protected]"/>
</properties>
<scm class="hudson.scm.NullSCM"/>
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/viglesiasce/euca-deploy.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
Expand All @@ -95,37 +102,37 @@
<hudson.tasks.Shell>
<command>#!/bin/bash

cat &gt; environment.json &lt;&lt;EOF
$environment
cat &gt; config.yml &lt;&lt;EOF
$config
EOF
cat &gt; bootstrap.json &lt;&lt;EOF
$bootstrap
EOF</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>#!/usr/bin/python
import json

environment = json.loads(open(&apos;environment.json&apos;).read())
name = open(&apos;environment-name&apos;,&apos;w&apos;)
name.write(environment[&apos;name&apos;])
name.close()</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>#!/bin/bash
source /etc/profile.d/rbenv.sh
ENV_NAME=`cat environment-name`
mb environment unlock $ENV_NAME
mb environment destroy --force $ENV_NAME
mb environment from environment.json
mb eucalyptus bootstrap bootstrap.json -v -e $ENV_NAME -c /root/.mb/config.json</command>
mkdir -p chef-repo
pushd chef-repo

if [ ! -d &quot;eucalyptus-cookbook&quot; ]; then
git clone https://github.com/eucalyptus/eucalyptus-cookbook.git -b testing
fi
pushd eucalyptus-cookbook
berks vendor $WORKSPACE/chef-repo/cookbooks
popd

mkdir -p nodes
mkdir -p environments
popd

if $nuke_before_deploy; then
$uninstall = &apos;uninstall&apos;
fi

fab $uninstall full_install --parallel --pool-size 20 -p foobar --show=everything</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers>
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.16">
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.24">
<deleteDirs>false</deleteDirs>
<cleanupParameter></cleanupParameter>
<externalDelete></externalDelete>
</hudson.plugins.ws__cleanup.PreBuildCleanup>
</buildWrappers>
</project>
Loading

0 comments on commit d498f90

Please sign in to comment.