Skip to content

Instantly share code, notes, and snippets.

@seif
Created December 27, 2012 16:06
Show Gist options
  • Save seif/4389373 to your computer and use it in GitHub Desktop.
Save seif/4389373 to your computer and use it in GitHub Desktop.
Mofied chef recipe
tc = Teamcity::Utility.new(:server=>"#{node.teamcity.server}", :port => 80, :username => "#{node.teamcity.username}", :password => "#{node.teamcity.password}")
build_version = tc.get_latest_build('bt134')
teamcity_build_type = 'bt134'
windows_batch "run_dropkick" do
code <<-EOH
cd C:\\Temp\\#{teamcity_build_type}\\#{build_version}\\Deployment
execute-#{node.chef_environment}-all.bat
EOH
action :nothing
end
teamcity_build "download-artefact" do
build_type teamcity_build_type
version build_version
destination "C:\\Temp\\#{teamcity_build_type}\\#{build_version}.zip"
overwrite true
action :download
not_if {::File.exists?("C:\\Temp\\#{teamcity_build_type}\\#{build_version}.zip")}
notifies :unzip, "windows_zipfile[unzip_artefacts]", :immediately
end
windows_zipfile "unzip_artefacts" do
path "C:\\Temp\\#{teamcity_build_type}\\#{build_version}\\"
source "C:\\Temp\\#{teamcity_build_type}\\#{build_version}.zip"
action :unzip
notifies :run, "windows_batch[run_dropkick]", :immediately
end
localhost [2012-12-27T16:00:48+00:00] INFO: Processing windows_batch[run_dropkick] action nothing (Wiggle_Billing::default line /chef/cache/cookbooks/Wiggle_Billing/recipes/default.rb)
localhost [2012-12-27T16:00:48+00:00] DEBUG: Doing nothing for windows_batch[run_dropkick]
localhost [2012-12-27T16:00:48+00:00] INFO: Processing teamcity_build[download-artefact] action download (Wiggle_Billing::default line /chef/cache/cookbooks/Wiggle_Billing/recipes/default.rb)
localhost [2012-12-27T16:00:49+00:00] INFO: Downloading file to C:\Temp\bt134\1.8.8.zip. This may take a while...
localhost [2012-12-27T16:00:49+00:00] DEBUG: Starting HTTP session...
localhost [2012-12-27T16:00:49+00:00] DEBUG: Getting HTTP Response
localhost [2012-12-27T16:00:49+00:00] DEBUG: Response was successful with code 200
localhost [2012-12-27T16:00:49+00:00] DEBUG: Recursively creating C:\Temp\bt134\1.8.8.zip
localhost [2012-12-27T16:00:49+00:00] DEBUG: Downloaded chunk of size 2480
calhost [2012-12-27T16:01:35+00:00] DEBUG: Downloaded chunk of size 5544
localhost [2012-12-27T16:01:35+00:00] DEBUG: Downloaded chunk of size 1880
localhost [2012-12-27T16:01:35+00:00] INFO: Processing windows_zipfile[unzip_artefacts] action unzip (Wiggle_Billing::default line /chef/cache/cookbooks/Wiggle_Billing/recipes/default.rb)
localhost [2012-12-27T16:01:35+00:00] DEBUG: unzip C:\Temp\bt134\1.8.8.zip => C:\Temp\bt134\1.8.8\ (overwrite=false)
localhost [2012-12-27T16:01:42+00:00] INFO: windows_zipfile[unzip_artefacts] sending run action to windows_batch[run_dropkick] (immediate)
localhost [2012-12-27T16:01:42+00:00] INFO: Processing windows_batch[run_dropkick] action run (Wiggle_Billing::default line /chef/cache/cookbooks/Wiggle_Billing/recipes/default.rb)
localhost [2012-12-27T16:01:42+00:00] INFO: Processing execute[run_dropkick] action run (dynamically defined)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment