Skip to content

Commit 83f303f

Browse files
authored
Merge pull request #90 from OpenVoxProject/rake
Delete unused rake tasks
2 parents a3d3682 + 00f9b3e commit 83f303f

1 file changed

Lines changed: 0 additions & 85 deletions

File tree

  • resources/puppetlabs/lein-ezbake/template/global/tasks
Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
require 'json'
22

3-
def get_auth_info(job_url)
4-
<<-DOC
5-
You need to pass the environment variable JENKINS_USER_AUTH
6-
It should be in the format <LDAP username>:<access token>
7-
To find your access token, go to http://<jenkins-url>/me/configure
8-
DOC
9-
end
10-
113
namespace :pl do
124
desc "do a local build"
135
task :local_build => "pl:fetch" do
@@ -82,81 +74,4 @@ namespace :pl do
8274
FileUtils.cp(props, "#{args[:output_dir]}/BUILD_PROPERTIES")
8375
FileUtils.cp(bundle, "#{args[:output_dir]}/PROJECT_BUNDLE")
8476
end
85-
86-
namespace :jenkins do
87-
desc "trigger jenkins packaging job"
88-
task :trigger_build, [:auth_string, :job_url] do |t, args|
89-
unless args[:auth_string] =~ /:/
90-
# Old-style bare-token "build?token=<foo>" is no longer supported.
91-
raise "JENKINS_USER_AUTH must have the format <LDAP username>:<access token>"
92-
end
93-
94-
Pkg::Util::RakeUtils.invoke_task("pl:prep_artifacts", Dir.pwd)
95-
96-
curl_opts = [
97-
'--location',
98-
"--user #{args[:auth_string]}",
99-
'--request POST',
100-
"--form file0=@#{Dir.pwd}/BUILD_PROPERTIES",
101-
"--form file1=@#{Dir.pwd}/PROJECT_BUNDLE",
102-
]
103-
104-
parameter_json = {
105-
parameter: [
106-
{
107-
name: 'BUILD_PROPERTIES',
108-
file: 'file0'
109-
},
110-
{
111-
name: 'PROJECT_BUNDLE',
112-
file: 'file1'
113-
},
114-
{
115-
name: 'COWS',
116-
value: Pkg::Config.cows
117-
},
118-
{
119-
name: 'MOCKS',
120-
value: Pkg::Config.final_mocks
121-
}
122-
]
123-
}
124-
125-
curl_opts << %(--form json='#{parameter_json.to_json}')
126-
curl_url = "#{args[:job_url]}/build"
127-
128-
output, _ = Pkg::Util::Net.curl_form_data(curl_url, curl_opts)
129-
http_response = output.scan(/^HTTP.*$/).last
130-
131-
# Print an error unless it looks like we curl'd successfully
132-
unless http_response =~ /2\d\d/
133-
raise "HTTP response: #{http_response}\n\n#{get_auth_info(args[:job_url])}"
134-
end
135-
136-
Pkg::Util::Net.print_url_info(args[:job_url])
137-
package_url = "#{Pkg::Config.builds_server}/#{Pkg::Config.project}/#{Pkg::Config.ref}"
138-
puts "After the build job is completed, packages will be available at:"
139-
puts package_url
140-
end
141-
142-
desc "trigger jenkins packaging job with local auth"
143-
task :trigger_build_local_auth => "pl:fetch" do
144-
jenkins_hostname = 'jenkins-platform.delivery.puppetlabs.net'
145-
stream = 'platform'
146-
job_url = "https://#{jenkins_hostname}/job/#{stream}_various-packaging-jobs_packaging-os-clj_lein-ezbake-generic"
147-
148-
begin
149-
auth = Pkg::Util.check_var('JENKINS_USER_AUTH', ENV['JENKINS_USER_AUTH'])
150-
rescue
151-
STDERR.puts(get_auth_info(job_url))
152-
end
153-
154-
begin
155-
Pkg::Util::RakeUtils.invoke_task("pl:jenkins:trigger_build", auth, job_url)
156-
rescue => e
157-
STDERR.puts("\nError triggering job: #{job_url}")
158-
STDERR.puts(e)
159-
end
160-
end
161-
end
16277
end

0 commit comments

Comments
 (0)