Module: Albacore::Ext::TeamCity
- Defined in:
- lib/albacore/ext/teamcity.rb
Overview
The teamcity module writes appropriate build-script “interaction messages” (see confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-artPublishing) to STDOUT.
Class Method Summary collapse
- .configure ⇒ Object
-
.escape(message) ⇒ Object
Escaped the progress message (see confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages) The Unicode symbol escape is not implemented Character Should be escaped as ‘ (apostrophe) |’ n (line feed) |n r (carriage return) |r uNNNN (unicode symbol with code 0xNNNN) |0xNNNN | (vertical bar) || [ (opening bracket) |[ ] (closing bracket) |].
Class Method Details
.configure ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/albacore/ext/teamcity.rb', line 30 def self.configure Albacore.subscribe :artifact do |artifact| ::Albacore.puts "##teamcity[publishArtifacts '#{artifact.location}']" end Albacore.subscribe :build_version do |version| # tell teamcity our decision ::Albacore.puts "##teamcity[buildNumber '#{version.build_number}']" # available as 'build.number' in TC ::Albacore.puts "##teamcity[setParameter name='build.version' value='#{version.build_version}']" ::Albacore.puts "##teamcity[setParameter name='build.version.formal' value='#{version.formal_version}']" end Albacore.subscribe :progress do |p| # tell teamcity of our progress ::Albacore.puts "##teamcity[progressMessage '#{escape p.}']" end Albacore.subscribe :start_progress do |p| # tell teamcity of our progress start_progress p. end Albacore.subscribe :finish_progress do |p| # tell teamcity of our progress finish_progress p. end Albacore.subscribe :release do |r| ::Albacore.puts 'Pinning build' # https://stackoverflow.com/questions/12681908/is-it-possible-to-automate-the-teamcity-pin-functionality-on-a-run-custom-build uri = URI.parse("%teamcity.serverUrl%/httpAuth/app/rest/builds/id:%teamcity.build.id%/pin -u 'TCuser:TCpass'") # curl -v -H "Content-Type:text/plain" -d "Deliverable" %teamcity.serverUrl%/httpAuth/app/rest/builds/id:%teamcity.build.id%/tags -u "TCuser:TCpass" http = Net::HTTP.new uri.host, uri.port put = Net::HTTP::Put.new uri.request_uri #request["Content-Type"] = "application/json" response = http.request put ::Albacore.puts "Done, server replied #{response.code}" end end |
.escape(message) ⇒ Object
Escaped the progress message (see confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages) The Unicode symbol escape is not implemented Character Should be escaped as ‘ (apostrophe) |’ n (line feed) |n r (carriage return) |r uNNNN (unicode symbol with code 0xNNNN) |0xNNNN | (vertical bar) || [ (opening bracket) |[ ] (closing bracket) |]
26 27 28 |
# File 'lib/albacore/ext/teamcity.rb', line 26 def self.escape .gsub(/([\[|\]|\|'])/, '|\1').gsub(/\n/, '|n').gsub(/\r/, '|r') end |