gitlab-org--gitlab-foss/app/models/ci
Rémy Coutable 4a2a127b5c Merge branch 'artifacts-from-ref-and-build-name-api' into 'master'
API for downloading latest successful build

## What does this MR do?

Implement parts of #4255, particularly the API.

## Are there points in the code the reviewer needs to double check?

I still made it that `ref` could be either branch, tag, or even SHA with:

``` ruby
# ref can't be HEAD, can only be branch/tag name or SHA
scope :latest_successful_for, ->(ref) do
  table = quoted_table_name
  # TODO: Use `where(ref: ref).or(sha: ref)` in Rails 5
  where("#{table}.ref = ? OR #{table}.sha = ?", ref, ref).
    success.order(id: :desc)
end
```

Because the reasons I put in:

* https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13165543
* https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13165921

But if you still think that it's not good to do it this way, I'll drop it and let's think about the other way to satisfy the requirement specified in https://gitlab.com/gitlab-org/gitlab-ce/issues/4255#note_13101233 It could be `status=any` or `sha=DEADBEAF`

## What are the relevant issue numbers?

Part of #4255

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5347
2016-07-21 09:01:47 +00:00
..
build.rb Merge branch 'master' into artifacts-from-ref-and-build-name-api 2016-07-21 01:24:05 +08:00
pipeline.rb Merge branch 'artifacts-from-ref-and-build-name-api' into 'master' 2016-07-21 09:01:47 +00:00
runner.rb Improve implementation of variables 2016-07-20 13:17:21 +02:00
runner_project.rb
trigger.rb
trigger_request.rb Improve implementation of variables 2016-07-20 13:17:21 +02:00
variable.rb add missing attribute to attr_encrypted so it is fully backwards-compatible 2016-06-28 09:55:19 +02:00