Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2012 15:02
Show Gist options
  • Save anonymous/4388942 to your computer and use it in GitHub Desktop.
Save anonymous/4388942 to your computer and use it in GitHub Desktop.
Recipe for downloading teamcity artefacts and doing a dropkick deploy
tc = Teamcity::Utility.new(:server=>"node.teamcity_server_url", :port => 80, :username => "node.teamcity_username", :password => "node.teamcity_password")
build_version = tc.get_latest_build('bt134')
teamcity_build_type = 'bt134'
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 :nothing
notifies :run, "windows_batch[run_dropkick]", :immediately
end
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment