Skip to content

REST api - variables for pipeline creation cause errors

Summary

While trying to provide variables to POST /api/v4/projects/:id/pipeline, a 500 response is returned

Steps to reproduce

Follow the documentation at https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline

They say to post some kind of structure with fat arrows - maybe that's ruby? I've tried that, i've tried valid JSON (colons instead of fat arrows), i've tried as a parameter to the URL, i've tried form posting, form posting with variables[X] = Y...nothing works.

What is the current bug behavior?

Can't create a pipeline through REST with variables

What is the expected correct behavior?

pipelines can be created through REST with variables, not just through the trigger mechanism

Relevant logs and/or screenshots

Started POST "/api/v4/projects/241/pipeline?variables=[FILTERED]=%3E%20%27BRANCH%27,%20%27value%27%20=%3E%20%27CORE/master%27%7D]&ref=master" for 127.0.0.1 at 2019-03-08 10:38:51 -0500

TypeError (no implicit conversion of Symbol into Integer):
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/nested_attributes.rb:480:in `[]'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/nested_attributes.rb:480:in `block in assign_nested_attributes_for_collection_association'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/nested_attributes.rb:480:in `map'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/nested_attributes.rb:480:in `assign_nested_attributes_for_collection_association'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/nested_attributes.rb:361:in `variables_attributes='
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:46:in `public_send'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:46:in `_assign_attribute'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:39:in `each'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activerecord-5.0.7.1/lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activemodel-5.0.7.1/lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:28:in `perform_attribute_assignment'
  /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:36:in `assign_attributes'
  /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ci/pipeline/chain/build.rb:9:in `perform!'
  /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ci/pipeline/chain/sequence.rb:19:in `block in build!'
  /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ci/pipeline/chain/sequence.rb:16:in `each'
  /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ci/pipeline/chain/sequence.rb:16:in `build!'
  /opt/gitlab/embedded/service/gitlab-rails/app/services/ci/create_pipeline_service.rb:44:in `execute'
  /opt/gitlab/embedded/service/gitlab-rails/lib/api/pipelines.rb:61:in `block (2 levels) in <class:Pipelines>'

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknown

GitLab information Version: 11.8.0 Revision: ce13864 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://git.codemettle.com HTTP Clone URL: http://git.codemettle.com/some-group/some-project.git SSH Clone URL: git@git.codemettle.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2

GitLab Shell Version: 8.4.4 Repository storage paths: default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 8.4.4 ? ... OK (8.4.4) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... yes Init.d configured correctly? ... skipped MailRoom running? ... skipped

Checking Reply by email ... Finished

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... no Try fixing it: sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} ; sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} ; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. 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: ... 27/1 ... yes 28/2 ... yes 28/3 ... yes 27/6 ... yes 28/11 ... yes 6/13 ... yes 6/14 ... yes 1/15 ... yes 17/16 ... yes 4/17 ... yes 1/18 ... yes 1/19 ... yes 6/20 ... yes 8/21 ... yes 1/25 ... yes 1/26 ... yes 1/27 ... yes 1/28 ... yes 1/29 ... yes 18/34 ... yes 1/36 ... yes 34/37 ... yes 36/38 ... yes 2/39 ... yes 27/40 ... yes 1/41 ... yes 8/42 ... yes 2/43 ... yes 2/44 ... yes 1/45 ... yes 1/46 ... yes 30/47 ... yes 28/48 ... yes 27/49 ... yes 1/50 ... yes 1/52 ... yes 39/53 ... yes 39/54 ... yes 2/55 ... yes 27/56 ... yes 1/61 ... yes 8/63 ... yes 1/64 ... yes 8/65 ... yes 15/67 ... yes 39/71 ... yes 39/73 ... yes 39/75 ... yes 39/78 ... yes 39/80 ... yes 39/81 ... yes 1/83 ... yes 1/84 ... yes 1/85 ... yes 16/86 ... yes 16/87 ... yes 37/88 ... yes 28/89 ... yes 27/90 ... yes 45/91 ... yes 1/92 ... yes 38/93 ... yes 27/94 ... yes 12/95 ... yes 28/97 ... yes 28/98 ... yes 28/99 ... yes 27/100 ... yes 53/101 ... yes 28/102 ... yes 53/104 ... yes 2/105 ... yes 28/106 ... yes 28/107 ... yes 27/108 ... yes 2/109 ... yes 2/110 ... yes 28/111 ... yes 2/112 ... yes 28/113 ... yes 28/114 ... yes 69/116 ... yes 70/117 ... yes 69/118 ... yes 76/119 ... yes 35/120 ... yes 2/121 ... yes 76/123 ... yes 27/124 ... yes 26/125 ... yes 26/126 ... yes 53/127 ... yes 26/128 ... yes 42/129 ... yes 1/130 ... yes 53/131 ... yes 31/132 ... yes 39/134 ... yes 79/135 ... yes 80/136 ... yes 78/139 ... yes 15/141 ... yes 15/142 ... yes 8/143 ... yes 78/144 ... yes 2/145 ... yes 83/146 ... yes 83/148 ... yes 83/149 ... yes 83/150 ... yes 27/151 ... yes 1/152 ... yes 28/153 ... yes 50/155 ... yes 28/156 ... yes 39/157 ... yes 2/158 ... yes 60/159 ... yes 80/160 ... yes 97/161 ... yes 97/162 ... yes 1/163 ... yes 58/164 ... yes 37/165 ... yes 106/166 ... yes 80/167 ... yes 71/168 ... yes 103/169 ... yes 106/170 ... yes 106/171 ... yes 27/172 ... yes 78/173 ... yes 114/174 ... yes 114/175 ... yes 56/176 ... yes 115/177 ... yes 120/178 ... yes 120/179 ... yes 78/180 ... yes 28/181 ... yes 2/182 ... yes 136/183 ... yes 106/184 ... yes 18/186 ... yes 18/187 ... yes 18/188 ... yes 18/189 ... yes 106/190 ... yes 106/191 ... yes 80/192 ... yes 80/193 ... yes 27/194 ... yes 28/196 ... yes 2/197 ... yes 144/198 ... yes 144/199 ... yes 144/201 ... yes 144/202 ... yes 148/203 ... yes 144/204 ... yes 144/205 ... yes 144/206 ... yes 144/207 ... yes 144/208 ... yes 144/209 ... yes 144/210 ... yes 144/211 ... yes 144/212 ... yes 144/213 ... yes 144/214 ... yes 144/215 ... yes 144/216 ... yes 144/217 ... yes 144/218 ... yes 144/219 ... yes 144/220 ... yes 144/221 ... yes 144/222 ... yes 144/223 ... yes 144/224 ... yes 144/225 ... yes 144/226 ... yes 144/227 ... yes 144/228 ... yes 144/229 ... yes 144/230 ... yes 144/231 ... yes 144/232 ... yes 144/233 ... yes 144/234 ... yes 144/235 ... yes 144/236 ... yes 144/237 ... yes 18/238 ... yes 144/239 ... yes 27/240 ... yes 1/241 ... yes 155/242 ... yes 151/243 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 132

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Edited by Steven Scott