summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-02-03 16:55:20 +0100
committerJames Lopez <james@jameslopez.es>2016-02-03 16:55:20 +0100
commit5fe354ef8374290d47a5ad35d50c084f0a96cd92 (patch)
tree8d22c1aab50e8d99c26ab38dc81c10153c5095bf
parent63a950a5a07a399a1d99c2bf30a55385e7dfe984 (diff)
downloadgitlab-ce-5fe354ef8374290d47a5ad35d50c084f0a96cd92.tar.gz
refactored rake task and make build pass
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--app/models/project.rb3
-rw-r--r--lib/tasks/ci/slack.rake6
3 files changed, 5 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9caa3135377..d78d87cb18c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -183,7 +183,7 @@ spinach:ruby21:
notify:slack:
stage: notifications
script:
- - bundle exec rake ci:slack:error
+ - bundle exec rake ci:slack:error["#ci-test","Build failed for master/tags"]
when: on_failure
# only:
# - master
diff --git a/app/models/project.rb b/app/models/project.rb
index 2313cad05d3..043f08b9a13 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -42,8 +42,7 @@
require 'carrierwave/orm/activerecord'
require 'file_size_validator'
-
-lass Project < ActiveRecord::Base
+class Project < ActiveRecord::Base
include Gitlab::ConfigHelper
include Gitlab::ShellAdapter
include Gitlab::VisibilityLevel
diff --git a/lib/tasks/ci/slack.rake b/lib/tasks/ci/slack.rake
index c4edda466ac..0afc0e908d1 100644
--- a/lib/tasks/ci/slack.rake
+++ b/lib/tasks/ci/slack.rake
@@ -1,9 +1,9 @@
namespace :ci do
namespace :slack do
desc "GitLab CI | Send slack notification on build failure"
- task error: :environment do
- error_text = 'Build failed for master/tags'
- Kernel.system "curl -X POST --data-urlencode 'payload={\"channel\": \"#ci-test\", \"username\": \"gitlab-ci\", \"text\": \"#{error_text}\", \"icon_emoji\": \":gitlab:\"}' $CI_SLACK_WEBHOOK_URL"
+ task :error, [:channel, :error] do |t, args|
+ next unless !"#{ENV['CI_SLACK_WEBHOOK_URL']}".blank? && args.channel && args.error
+ Kernel.system "curl -X POST --data-urlencode 'payload={\"channel\": \"#{args.channel}\", \"username\": \"gitlab-ci\", \"text\": \"#{args.error}\", \"icon_emoji\": \":gitlab:\"}' $CI_SLACK_WEBHOOK_URL"
end
end
end