Commit Graph
47 Commits
Author SHA1 Message Date
Yorick Peterse b4ee6f57b9 Greatly improve external_issue_tracker performance
This greatly improves the performance of Project#external_issue_tracker
by moving most of the fields queried in Ruby to the database and letting
the database handle all logic. Prior to this change the process of
finding an external issue tracker was along the lines of the following:

1. Load all project services into memory.
2. Reduce the list to only services where "issue_tracker?" returns true
3. Reduce the list from step 2 to service where "default?" returns false
4. Find the first service where "activated?" returns true

This has to two big problems:

1. Loading all services into memory only to reduce the list down to a
   single item later on is a waste of memory (and slow timing wise).
2. Calling Array#select followed by Array#reject followed by Array#find
   allocates extra objects when this really isn't needed.

To work around this the following service fields have been moved to the
database (instead of being hardcoded):

* category
* default

This in turn means we can get the external issue tracker using the
following query:

    SELECT *
    FROM services
    WHERE active IS TRUE
    AND default IS FALSE
    AND category = 'issue_tracker'
    AND project_id = XXX
    LIMIT 1

This coupled with memoizing the result (just as before this commit)
greatly reduces the time it takes for Project#external_issue_tracker to
complete. The exact reduction depends on one's environment, but locally
the execution time is reduced from roughly 230 ms to only 2 ms (= a
reduction of almost 180x).

Fixes gitlab-org/gitlab-ce#10771
2016-01-19 14:03:20 +01:00
Stan Hu 79c0e7212a Annotate models 2016-01-06 13:09:55 +00:00
Kamil Trzcinski e80e3f5372 Migrate CI::Project to Project 2015-12-11 18:02:09 +01:00
Kamil Trzcinski 8b4cdc50fc Fix indentation and BuildsEmailService 2015-12-11 18:01:57 +01:00
Kamil Trzcinski 71e6a93db9 Change default values 2015-12-11 13:28:40 +01:00
Kamil Trzcinski c4fa894de2 Fix specs 2015-12-10 16:16:34 +01:00
Kamil Trzcinski 2988e1fbf5 Migrate CI::Services and CI::WebHooks to Services and WebHooks 2015-12-10 16:04:08 +01:00
Alex Lossent 98e666ab6a Improve invalidation of stored service password if the endpoint URL is changed
Password can now be specified at the same time as the new URL, and the service
template admin pages now work.
2015-10-15 12:07:59 +02:00
Valery Sizov b83a18a55c Revert "Improve invalidation of stored service password if the endpoint URL is changed"
This reverts commit b463975480.
2015-10-14 19:21:27 +03:00
Alex Lossent b463975480 Improve invalidation of stored service password if the endpoint URL is changed
It now allows to specify a password at the same time as the new URL, and works
on the service template admin pages.
2015-10-14 15:27:59 +02:00
Valery Sizov 07f6055272 Invalidate stored service password if the endpoint URL is changed 2015-10-12 13:21:57 +03:00
Kirilll Zaitsev 263abda3fd Drone CI service 2015-09-02 05:52:16 +03:00
Stan Hu 2379057002 Provide more feedback what went wrong if HipChat service failed test
Issue gitlab-com/support-forum#213
2015-08-12 07:31:25 -07:00
Stan Hu a3157626f1 Re-annotate models 2015-05-03 13:38:27 -07:00
Robert Speicher 307962a046 Rename last uses of Buildbox to Buildkite 2015-04-11 14:05:22 -04:00
Robert Speicher 4077f66beb Sort available_services_names array alphabetically 2015-04-11 14:05:22 -04:00
Dmitriy Zaporozhets 63d0bf1f5e Fix external wiki service 2015-03-17 22:59:45 -07:00
Dmitriy Zaporozhets 066fb568e7 Align services like in EE for easier merging 2015-03-17 19:06:43 -07:00
Stan Hu 7e204cf389 Added comment notification events to HipChat and Slack services.
Supports four different event types all bundled under the "note" event type:

- comments on a commit
- comments on an issue
- comments on a merge request
- comments on a code snippet
2015-03-06 06:54:00 -08:00
Dmitriy Zaporozhets 66c61f023b Re-annotate models 2015-03-04 14:14:00 -08:00
Douwe Maan d57e809cbd Set supported events per project service. 2015-03-03 11:14:32 +01:00
Stan HuandDouwe Maan afe5d7d209 Issue #595: Support Slack notifications upon issue and merge request events
1) Adds a DB migration for all services to toggle on push, issue, and merge events.

2) Upon an issue or merge request event, fire service hooks.

3) Slack service supports custom messages for each of these events. Other services
not supported at the moment.

4) Label merge request hooks with their corresponding actions.
2015-03-03 11:14:31 +01:00
Aorimn f84b7eef3f Add Irker service
Irker is a gateway which sends IRC messages on git updates. This new
service provides an interface to this gateway, integrated in Gitlab, for
each updates.
As per the guidelines, this commit adds the new feature in the
CHANGELOG, tests and documentation.

See http://www.catb.org/esr/irker/
2015-03-01 20:51:03 +01:00
Marin Jankovski 9f33898f7a All services can have templates. 2015-02-12 09:19:55 -08:00
Marin Jankovski 6b4ddf2cc1 Add admin services templates. 2015-02-11 17:55:33 -08:00
Marin Jankovski 09d3d351a1 Remove not null constraint on project_id in services. 2015-02-11 09:47:21 -08:00
Marin Jankovski 5515366064 Add template boolean to services. 2015-02-11 09:24:40 -08:00
Dmitriy Zaporozhets 62ed1c537e Explicitly define ordering in models using default_scope 2015-02-05 14:20:55 -08:00
Marin Jankovski 68f7302474 Add a scope for visible services, code styling changes for easier readability. 2015-01-28 14:25:55 -08:00
Marin Jankovski a720dde67c Remove configuration option from project settings page for external issue trackers. 2015-01-23 11:55:41 -08:00
Dmitriy Zaporozhets 0d5265bbec Execute project services asynchronously
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-12-07 12:29:37 +02:00
Valery Sizov 82c938ad75 annotate 2014-10-09 18:22:20 +03:00
Drew Blessing 09cdd94322 Fix serialize migration. Fixes #7734 2014-09-11 18:41:03 -05:00
Drew Blessing a0dbcd2365 Serialize services properties 2014-09-10 09:56:39 -05:00
Dmitriy Zaporozhets 04516027df Project services to strong params
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-26 14:49:09 +03:00
Dmitriy Zaporozhets a18ae13e98 Backport CI service refactoring from EE
It allows easier contribution of different CI services

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-28 11:35:43 +03:00
Dmitriy Zaporozhets 36f861f1b1 Re-annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 15:05:03 +03:00
Dmitriy Zaporozhets a355ea6f17 Default values gem
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-26 10:41:44 +02:00
Binsztock RémyandOlivier Gonzalez e7382de108 Add Gemnasium Service for Gitlab
Conflicts:

	db/schema.rb
2014-02-21 16:25:22 +01:00
Ronald van Eede 62ba789545 Added can_test? mehod to Service model and added tests 2013-08-09 22:02:34 +02:00
Dmitriy Zaporozhets 6e35aceff2 Annotated 2013-06-19 15:40:33 +03:00
Dmitriy Zaporozhets 83e2e62490 Mention methods that should be implemented inside service 2013-05-22 17:59:43 +03:00
Dmitriy Zaporozhets 3a22631dd3 Make service code more abstract 2013-05-22 16:58:44 +03:00
Dmitriy Zaporozhets d6036f08aa move activated? method to service 2013-01-03 09:52:14 +02:00
Dmitriy Zaporozhets 93fdc4ca9d Reannotated 2012-11-20 14:19:55 +02:00
Dmitriy Zaporozhets 406a0c809b GitLabCi Service imtegration 2012-11-19 22:34:05 +03:00
Dmitriy Zaporozhets c3b074acab Service model and service hook 2012-11-20 11:33:49 +02:00