Add variables API
References #4264 (closed)
Merge request reports
Activity
mentioned in issue #4264 (closed)
Added 1 commit:
- 937567b7 - Add create feature to variables API
Added 1 commit:
- 16bd4df0 - Fix a typo in method description
@ayufan Ready for review
mentioned in merge request !2286 (merged)
Added 1 commit:
- efb3395b - Remove blank line
- lib/api/variables.rb 0 → 100644
37 # Create a new variable in project 38 # 39 # Parameters: 40 # id (required) - The ID of a project 41 # key (required) - The key of variable 42 # value (required) - The value of variable 43 # Example Request: 44 # POST /projects/:id/variables 45 post ':id/variables' do 46 required_attributes! [:key, :value] 47 48 variable = user_project.variables.create(key: params[:key], value: params[:value]) 49 return render_validation_error!(variable) unless variable.valid? 50 variable.save! 51 52 present variable, with: Entities::Variable @DouweM @rspeicher Can you review?
Added 1 commit:
- df548285 - Add some fixes after review
17 18 18 19 belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id 19 20 20 validates_presence_of :key 21 21 validates_uniqueness_of :key, scope: :gl_project_id 22 validates :key, 23 presence: true, 24 length: { within: 0..255 }, 25 format: { with: /\A[a-zA-Z0-9_]+\z/, What stands against lowercase chars in variables names? Technically this set of characters is safe to use as ID in URL and as variable name in shell.
And as for examples - we can (and even we should) add the information about allowed characters in variables API documentation. Example is only an example. The documentation and the validation messages says to user what can they do.
@DouweM Yes, we do want. It is valid to have lowercase environment variables.
Added 1 commit:
- 9e701ccd - Fix some typos
Added 1 commit:
- 2b81248a - Modify builds API documentation style [ci skip]
Added 448 commits:
-
2b81248a...0e344aa2 - 446 commits from branch
master
- 6c4e8536 - Merge branch 'master' into ci/api-variables
- bc1fab45 - Update CHANGELOG [ci skip]
-
2b81248a...0e344aa2 - 446 commits from branch
@rspeicher @DouweM: I've done some modifications according to the suggestions. I also added CHANGELOG entry.
There is still question about
key
validation. What to do with the regexp?I think allowing mixed case is fine.
Pinging @axil - Check out your new API doc standards in action!
Ooh, neat! Thanks @tmaczukin :)
Some general advice (which I forgot to document, so it's my fault):
Do not add headings for
Parameters
,Example of request
andExample of response
, add only for the main calls. Always imagine that the headings end up being referenced in doc.gitlab.com. How would you know what is referenced if your URL isapi/build_variables.md#parameters
? If you have multiple times the same heading you would not know where to go.Other than that I'll leave some inline comments.
- doc/api/build_variables.md 0 → 100644
135 DELETE /projects/:id/variables/:key 136 ``` 137 138 ### Parameters 139 140 | Attribute | Type | required | Description | 141 |-----------|---------|----------|-------------------------| 142 | id | integer | yes | The ID of a project | 143 | key | string | yes | The `key` of variable | 144 145 ### Example of request 146 147 ``` 148 curl -X DELETE -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/variables/VARIABLE_1" 149 ``` 150 Added 2 commits:
- f11ba743 - Add some cosmetic changes to variables API documentation [ci skip]
- 2344e006 - Update CHANGELOG [ci skip]
Added 449 commits:
- 2344e006...d139276a - 448 commits from branch
8-4-stable
- b6f91e4b - Merge branch '8-4-stable' into ci/api-variables
- 2344e006...d139276a - 448 commits from branch
Added 40 commits:
-
eee16ca9...4d64a32c - 39 commits from branch
master
- 0014f193 - Merge branch 'master' into ci/api-variables
-
eee16ca9...4d64a32c - 39 commits from branch
@tmaczukin I changed the target branch back to
master
. All MRs should go intomaster
, stable branches are updated when appropriate by mergingmaster
into them, or by cherry-picking specific commits.Added 1 commit:
- 4435a3a8 - Fix version
Enabled an automatic merge when the build for 4435a3a8 succeeds
mentioned in commit f981da44
mentioned in commit 2a89073c
mentioned in issue #10852 (closed)
mentioned in issue #10421 (moved)
mentioned in merge request gitlab-com/www-gitlab-com!1722 (merged)
Mentioned in commit maxraab/gitlab-ce@2a89073c