-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
938 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | ||
VAGRANTFILE_API_VERSION = "2" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
config.vm.box_url = 'https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box' | ||
config.vm.box = 'centos65-x86_64-20140116' | ||
|
||
config.vm.provider :virtualbox do |vb| | ||
vb.customize ['modifyvm', :id, '--memory', '512'] | ||
end | ||
|
||
config.vm.network 'forwarded_port', guest: 8080, host: 8080 | ||
config.vm.provision :shell, :inline => (<<-SCRIPT).gsub(/^ */, '') | ||
curl -o /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo >/dev/null 2&>1 | ||
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key | ||
yum -y install java-1.7.0-openjdk jenkins | ||
service jenkins start | ||
SCRIPT | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
Feature: Configuring Jobs | ||
|
||
Scenario: Configuring jobs to newly created Jenkins | ||
Given the plain Jenkins server | ||
And a file named "Capfile" with: | ||
""" | ||
require 'jenkins-capistrano' | ||
load 'config/deploy' | ||
""" | ||
And a file named "config/deploy.rb" with: | ||
""" | ||
set :jenkins_host, 'http://localhost:8080' | ||
""" | ||
And a file named "config/jenkins/jobs/job1.xml" with: | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?><project> | ||
<actions/> | ||
<description>Created</description> | ||
<keepDependencies>false</keepDependencies> | ||
<properties/> | ||
<scm class="hudson.scm.NullSCM"/> | ||
<canRoam>true</canRoam> | ||
<disabled>false</disabled> | ||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | ||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | ||
<jdk>Default</jdk> | ||
<triggers/> | ||
<concurrentBuild>false</concurrentBuild> | ||
<builders/> | ||
<publishers/> | ||
</project> | ||
""" | ||
When I successfully run `bundle exec cap jenkins:config_jobs` | ||
Then the output should contain: | ||
""" | ||
job job1 created. | ||
""" | ||
And the Jenkins has following jobs: | ||
| Name | Description | Disabled | | ||
| job1 | Created | false | | ||
|
||
Scenario: Configuring jobs already created | ||
Given the Jenkins server has following jobs: | ||
| Name | Description | Disabled | | ||
| job1 | Created | false | | ||
And a file named "Capfile" with: | ||
""" | ||
require 'jenkins-capistrano' | ||
load 'config/deploy' | ||
""" | ||
And a file named "config/deploy.rb" with: | ||
""" | ||
set :jenkins_host, 'http://localhost:8080' | ||
""" | ||
And a file named "config/jenkins/jobs/job1.xml" with: | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?><project> | ||
<actions/> | ||
<description>Updated</description> | ||
<keepDependencies>false</keepDependencies> | ||
<properties/> | ||
<scm class="hudson.scm.NullSCM"/> | ||
<canRoam>true</canRoam> | ||
<disabled>false</disabled> | ||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | ||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | ||
<jdk>Default</jdk> | ||
<triggers/> | ||
<concurrentBuild>false</concurrentBuild> | ||
<builders/> | ||
<publishers/> | ||
</project> | ||
""" | ||
When I successfully run `bundle exec cap jenkins:config_jobs` | ||
Then the Jenkins has following jobs: | ||
| Name | Description | Disabled | | ||
| job1 | Updated | false | | ||
And the output should contain: | ||
""" | ||
job job1 created. | ||
""" | ||
|
||
Scenario: Disabling the specified job | ||
Given the plain Jenkins server | ||
And a file named "Capfile" with: | ||
""" | ||
require 'jenkins-capistrano' | ||
load 'config/deploy' | ||
""" | ||
And a file named "config/deploy.rb" with: | ||
""" | ||
set :jenkins_host, 'http://localhost:8080' | ||
set :disabled_jobs, %w(job1) | ||
""" | ||
And a file named "config/jenkins/jobs/job1.xml" with: | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?><project> | ||
<actions/> | ||
<description>Disabled</description> | ||
<keepDependencies>false</keepDependencies> | ||
<properties/> | ||
<scm class="hudson.scm.NullSCM"/> | ||
<canRoam>true</canRoam> | ||
<disabled>false</disabled> | ||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | ||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | ||
<jdk>Default</jdk> | ||
<triggers/> | ||
<concurrentBuild>false</concurrentBuild> | ||
<builders/> | ||
<publishers/> | ||
</project> | ||
""" | ||
When I successfully run `bundle exec cap jenkins:config_jobs` | ||
Then the Jenkins has following jobs: | ||
| Name | Description | Disabled | | ||
| job1 | Disabled | true | | ||
And the output should contain: | ||
""" | ||
job job1 created. | ||
-> disabled | ||
""" | ||
|
||
Scenario: Configuring the jobs with teamplated config.xmls | ||
Given the plain Jenkins server | ||
And a file named "Capfile" with: | ||
""" | ||
require 'jenkins-capistrano' | ||
load 'config/deploy' | ||
""" | ||
And a file named "config/deploy.rb" with: | ||
""" | ||
set :jenkins_host, 'http://localhost:8080' | ||
set :jenkins_template_vars, { :templated => 'Yay!!' } | ||
""" | ||
And a file named "config/jenkins/jobs/job1.xml.erb" with: | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?><project> | ||
<actions/> | ||
<description><%= @templated %></description> | ||
<keepDependencies>false</keepDependencies> | ||
<properties/> | ||
<scm class="hudson.scm.NullSCM"/> | ||
<canRoam>true</canRoam> | ||
<disabled>false</disabled> | ||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | ||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | ||
<jdk>Default</jdk> | ||
<triggers/> | ||
<concurrentBuild>false</concurrentBuild> | ||
<builders/> | ||
<publishers/> | ||
</project> | ||
""" | ||
When I successfully run `bundle exec cap jenkins:config_jobs` | ||
Then the Jenkins has following jobs: | ||
| Name | Description | Disabled | | ||
| job1 | Yay!! | false | | ||
And the output should contain: | ||
""" | ||
job job1 created. | ||
""" |
Oops, something went wrong.