Integrations set at Admin level don't take effect on existing projects
Summary
Setting up a Service (in my case JIRA) globally, will mark the service active on all projects, but will not replace the issue tracker because the active state is cached in the service.
Steps to reproduce
- Enable the JIRA service from the Admin area by adding all information and activating,
admin/application_settings/services/1144/edit
- Go to any repository which has issues enabled and click the issues tab, you will be directed to the Gitlab issue tracker
- Go to the services settings of the repository (replace
issues
with/services/jira/edit
) and click "Save changes" - Click the issues tab again, it will redirect you to the JIRA instance.
Expected behavior
Having enabled JIRA globally would either:
- Replace all Gitlab issue trackers with the JIRA one, least preferably I would imagine
- The JIRA service settings page in each repository would not mark the service Active.
Actual behavior
Only after saving the JIRA service in the repository, was the issue tracker saved.
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
4/3 ... ok
4/4 ... ok
4/5 ... ok
4/6 ... ok
4/7 ... ok
4/8 ... ok
4/9 ... ok
4/10 ... ok
4/11 ... ok
4/12 ... ok
4/13 ... ok
4/14 ... ok
4/15 ... ok
4/16 ... ok
4/17 ... ok
6/18 ... ok
7/19 ... ok
2/20 ... ok
8/21 ... ok
8/22 ... ok
8/23 ... ok
8/24 ... ok
8/25 ... ok
8/26 ... ok
8/27 ... ok
8/28 ... ok
8/29 ... ok
8/30 ... ok
8/31 ... ok
8/32 ... ok
9/35 ... ok
6/38 ... ok
11/39 ... ok
8/44 ... ok
7/45 ... ok
12/46 ... ok
7/47 ... ok
7/48 ... ok
13/49 ... ok
14/50 ... ok
8/51 ... ok
15/52 ... ok
5/53 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
4/3 ... yes
4/4 ... yes
4/5 ... yes
4/6 ... yes
4/7 ... yes
4/8 ... yes
4/9 ... yes
4/10 ... yes
4/11 ... yes
4/12 ... yes
4/13 ... yes
4/14 ... yes
4/15 ... yes
4/16 ... yes
4/17 ... yes
6/18 ... yes
7/19 ... yes
2/20 ... yes
8/21 ... yes
8/22 ... yes
8/23 ... yes
8/24 ... yes
8/25 ... yes
8/26 ... yes
8/27 ... yes
8/28 ... yes
8/29 ... yes
8/30 ... yes
8/31 ... yes
8/32 ... yes
9/35 ... yes
6/38 ... yes
11/39 ... yes
8/44 ... yes
7/45 ... yes
12/46 ... yes
7/47 ... yes
7/48 ... yes
13/49 ... yes
14/50 ... yes
8/51 ... yes
15/52 ... yes
5/53 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.8.4)
Active users: N
Checking GitLab ... Finished
Results of GitLab environment info
System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Sidekiq Version:4.2.7
GitLab information
Version: 8.15.2
Revision: 790035f
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://git.example.com
HTTP Clone URL: https://git.example.com/some-group/some-project.git
SSH Clone URL: git@git.example.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Possible fixes
I'm not sure how to fix this. From what I've read the Service only caches the active state after saving again. The preferred solution (disabling active state) would probably be easier. https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/service.rb#L241
I noticed there was a clean up issue around a month ago by @adamniedzielski . But it seems this issue was never reported or found.