Skip to content

Creating a project via JSON API ignores boolean project options

Summary

Creating a new project via JSON API + access token seems to ignore project options specified as JSON booleans (e.g. "issues_enabled":true).

GitLab creates the project, but ignores the boolean options and applies what seem to be defaults.

Steps to reproduce

  1. Create a fresh VM with CentOS 7 and run yum update -y && systemctl reboot.
  2. Install GitLab CE 8.13.1 (Omnibus).
  3. Set root password, log in, and create an access token for the administrator user.
  4. Install curl and jq via yum install -y epel-release && yum install -y curl jq.
  5. Run the following bash command (replace GitLab URL and access token):
curl -X "POST" "http://gitlab.example.com/api/v3/projects" \
     -H "PRIVATE-TOKEN: 3o4jkBw7NmiNcMRNKCxO" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d "{\"name\":\"foo-${RANDOM}\",\"issues_enabled\":true,\"merge_requests_enabled\":true,\"builds_enabled\":true,\"wiki_enabled\":true,\"snippets_enabled\":true,\"shared_runners_enabled\":true,\"public\":true,\"public_builds\":true,\"only_allow_merge_if_build_succeeds\":true,\"lfs_enabled\":true,\"request_access_enabled\":true}" \
| jq . | grep enabled

Expected behavior

"container_registry_enabled": true,
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"builds_enabled": true,
"snippets_enabled": true,
"shared_runners_enabled": true,
"lfs_enabled": true,
"request_access_enabled": true

Actual behavior

The project is created, but some features are not enabled (issues, wiki, snippets, etc):

"container_registry_enabled": true,
"issues_enabled": false,
"merge_requests_enabled": false,
"wiki_enabled": false,
"builds_enabled": false,
"snippets_enabled": false,
"shared_runners_enabled": true,
"lfs_enabled": true,
"request_access_enabled": true

Relevant logs and/or screenshots

Output of checks

Results of GitLab application Check

Checking GitLab Shell ...

GitLab Shell version >= 3.6.6 ? ... OK (3.6.6)
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: ... 
1/1 ... repository is empty
1/2 ... repository is empty
1/3 ... repository is empty
1/4 ... repository is empty
1/5 ... repository is empty
1/6 ... repository is empty
1/7 ... repository is empty
1/8 ... repository is empty
1/9 ... repository is empty
1/10 ... repository is empty
1/11 ... repository is empty
1/12 ... repository is empty
1/13 ... repository is empty
1/14 ... repository is empty
1/15 ... repository is empty
1/16 ... repository is empty
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? ... skipped (no tmp uploads folder yet)
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: ...
1/1 ... yes
1/2 ... yes
1/3 ... yes
1/4 ... yes
1/5 ... yes
1/6 ... yes
1/7 ... yes
1/8 ... yes
1/9 ... yes
1/10 ... yes
1/11 ... yes
1/12 ... yes
1/13 ... yes
1/14 ... yes
1/15 ... yes
1/16 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 1

Checking GitLab ... Finished

Results of GitLab environment info

System information
System:
Current User:	git
Using RVM:	no
Ruby Version:	2.3.1p112
Gem Version:	2.6.6
Bundler Version:1.13.5
Rake Version:	10.5.0
Sidekiq Version:4.2.1

GitLab information
Version:	8.13.1
Revision:	91f25c2
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		http://gitlab.example.com
HTTP Clone URL:	http://gitlab.example.com/some-group/some-project.git
SSH Clone URL:	git@gitlab.example.com:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

GitLab Shell
Version:	3.6.6
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

n/a