srushti / goldberg

Goldberg is a lightweight CI server written in Ruby which worries about Bundler & RVM so that you don't have to.
Other
243 stars 29 forks source link

Doesn't send any mail notification upon build completion #151

Closed sivagollapalli closed 11 years ago

sivagollapalli commented 11 years ago

I just configured your CI server. Everything works fine and it builds properly. But it doesn't sends any notification upon build completion. I configured action mailer that you have provided on initializers.

My goldberg_config.rb looks like this:

  1 Project.configure do |config|
  2   config.frequency = 20
  3   config.ruby = '1.9.3'                                     # Your server needs to have rvm installed for this setting  to be considered

  4   config.environment_variables = {"FOO" => "bar"}
  5   config.timeout = 10.minutes                               # Defaults to 10.minutes if not configured. Set it to Project::Configuration::NO_TIMEOUT if you don't want it to ever timeout
  6   config.nice = 5                                           # Use this to reduce the scheduling priority (increase niceness) of CPU
  7   # intensive builds that may otherwise leave the Goldberg web application
  8   # unresponsive. Uses the UNIX `nice` command. Defaults to '0'.
  9   # Positive values have lower priority with a max of 19 on OSX and 20 on
 10   # Linux. You can set negative values, but we don't see the point.
 11   config.command = 'bundle exec rake ci:build'                                   # To be used if you're using anything other than rak    e
 12   #config.rake_task = 'ci'                                   # To be used if your CI build runs something other than the default rake.
 13   # Not relevant if you're using config.command.
 14   config.group = 'Test'                                      # Running a lot of projects on one server? Use this to lo        gically group them.
 15   config.use_bundle_exec = true                             # Run 'bundle exec rake', recommended for Rails projects
 16   #config.bundle_options = '--without deployment mac'        # Command-line options for bundle install
 17 end
 18 
 19 Project.configure do |config|
 20   config.on_build_success do |build,notification|
 21     # sending mail
 22     notification.from('ci@test.com').to('sivagollapalli@yahoo.com').with_subject("build for #{build.project.name}     #{build.status}").send
 23   end
 24 end

Could you please let me know where I went wrong. Thanks!!

srushti commented 11 years ago

Have you configured the smtp settings?

If not, take a look at the sample file at (https://github.com/c42/goldberg/blob/master/config/initializers/email.rb.sample) & make a copy of that with a '.rb' extension and your specific values filled in.

Let me know if you have already done that and we can dig in deeper to see what else might have gone wrong.

sivagollapalli commented 11 years ago

I have configured smtp settings with the sample file that you have given on initializers.

I hope there is a bug on mail sending. I just made debugging statements on callbacks in goldberg_config.rb. Before this line it prints whatever the debugging statements we write.

notification.from('ci@test.com').to('sivagollapalli@yahoo.com').with_subject("build for #{build.project.name}     #{build.status}").send

I am confused that neither above line executes nor it generates error. So please help me!!!

srushti commented 11 years ago

@aakashd worked on this stuff. I'm asking him to take a look at this.

sivagollapalli commented 11 years ago

@aakashd One more observation which might help for you to debug.

I just replaced below line with

notification.from('ci@test.com').to('sivagollapalli@yahoo.com').with_subject("build for #{build.project.name}     #{build.status}").send

with

BuildStatusMailer.status_mail!('test@test.com','sivagollapalli@yahoo.com','Test build', build).deliver

which sends mail but there is no content on received mail. I also observed that there is no method with name as 'status_mail!' on entire project. I didn't understand how it works.

sivagollapalli commented 11 years ago

@aakashd Finally it's working. I just deleted entire installation and configure the mail before I start nginx server.

Previously I configured after server started. After configured I restarted the server but somehow it doesn't pick up the mail settings.

srushti commented 11 years ago

Oh cool. Thanks for letting us know. And sorry, we weren't able to help you out. We've been a bit busy just now.