Commit 8dd312da authored by Marin Jankovski's avatar Marin Jankovski

Merge branch 'merge_ce_7_3_to_ee' into 'master'

Merge 7.3.pre CE to EE

See merge request !177
parents c24f9cb6 2ad67892
v 7.3.0 v 7.3.0
- Always set the 'origin' remote in satellite actions - Always set the 'origin' remote in satellite actions
- Write authorized_keys in tmp/ during tests - Write authorized_keys in tmp/ during tests
- Use sockets to connect to Redis
- Expire Rack sessions after 1 week - Expire Rack sessions after 1 week
- Cleaner signin/signup pages - Cleaner signin/signup pages
- Improved comments UI - Improved comments UI
...@@ -29,6 +30,7 @@ v 7.3.0 ...@@ -29,6 +30,7 @@ v 7.3.0
- Enabled Shibboleth authentication support (Matus Banas) - Enabled Shibboleth authentication support (Matus Banas)
- Zen mode (fullscreen) for issues/MR/notes (Robert Schilling) - Zen mode (fullscreen) for issues/MR/notes (Robert Schilling)
- Add ability to configure webhook timeout via gitlab.yml (Wes Gurney) - Add ability to configure webhook timeout via gitlab.yml (Wes Gurney)
- Sort project merge requests in asc or desc order for updated_at or created_at field (sponsored by O'Reilly Media)
v 7.2.1 v 7.2.1
- Delete orphaned labels during label migration (James Brooks) - Delete orphaned labels during label migration (James Brooks)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
%h4 %h4
Closed by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)} Closed by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)} #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
%p Changes was not merged into target branch %p Changes were not merged into target branch
- if @merge_request.merged? - if @merge_request.merged?
%h4 %h4
......
development: redis://localhost:6379 development: redis://localhost:6379
test: redis://localhost:6379 test: redis://localhost:6379
production: redis://redis.example.com:6379 production: unix:/var/run/redis/redis.sock
...@@ -14,6 +14,8 @@ Parameters: ...@@ -14,6 +14,8 @@ Parameters:
- `id` (required) - The ID of a project - `id` (required) - The ID of a project
- `state` (optional) - Return `all` requests or just those that are `merged`, `opened` or `closed` - `state` (optional) - Return `all` requests or just those that are `merged`, `opened` or `closed`
- `order_by` (optional) - Return requests ordered by `created_at` or `updated_at` fields
- `sort` (optional) - Return requests sorted in `asc` or `desc` order
```json ```json
[ [
......
...@@ -133,7 +133,21 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da ...@@ -133,7 +133,21 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
# Try connecting to the new database with the new user # Try connecting to the new database with the new user
sudo -u git -H psql -d gitlabhq_production sudo -u git -H psql -d gitlabhq_production
## 5. GitLab ## 5. Redis
sudo apt-get install redis-server
# Configure redis to use sockets
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed -e 's/^# unixsocket /unixsocket /' -e 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
# Activate the changes to redis.conf
sudo service redis-server restart
# Add git to the redis group
sudo usermod -aG redis git
## 6. GitLab
# We'll install GitLab into home directory of the user "git" # We'll install GitLab into home directory of the user "git"
cd /home/git cd /home/git
...@@ -196,6 +210,12 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da ...@@ -196,6 +210,12 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global user.email "example@example.com"
sudo -u git -H git config --global core.autocrlf input sudo -u git -H git config --global core.autocrlf input
# Configure Redis connection settings
sudo -u git -H cp config/resque.yml.example config/resque.yml
# Change the Redis socket path if necessary
sudo -u git -H editor config/resque.yml
**Important Note:** Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. **Important Note:** Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
**Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps. **Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
...@@ -291,7 +311,7 @@ Check if GitLab and its environment are configured correctly: ...@@ -291,7 +311,7 @@ Check if GitLab and its environment are configured correctly:
# or # or
sudo /etc/init.d/gitlab restart sudo /etc/init.d/gitlab restart
## 6. Nginx ## 7. Nginx
**Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/). **Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/).
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
sudo gitlab-rake gitlab:import:user_to_projects[username@domain.tld] sudo gitlab-rake gitlab:import:user_to_projects[username@domain.tld]
# installation from source or cookbook # installation from source or cookbook
bundle exec rake gitlab:import:user_to_projects[username@domain.tld] bundle exec rake gitlab:import:user_to_projects[username@domain.tld] RAILS_ENV=production
``` ```
## Add all users to all projects ## Add all users to all projects
...@@ -21,7 +21,7 @@ Notes: ...@@ -21,7 +21,7 @@ Notes:
sudo gitlab-rake gitlab:import:all_users_to_all_projects sudo gitlab-rake gitlab:import:all_users_to_all_projects
# installation from source or cookbook # installation from source or cookbook
bundle exec rake gitlab:import:all_users_to_all_projects bundle exec rake gitlab:import:all_users_to_all_projects RAILS_ENV=production
``` ```
## Add user as a developer to all groups ## Add user as a developer to all groups
...@@ -31,7 +31,7 @@ bundle exec rake gitlab:import:all_users_to_all_projects ...@@ -31,7 +31,7 @@ bundle exec rake gitlab:import:all_users_to_all_projects
sudo gitlab-rake gitlab:import:user_to_groups[username@domain.tld] sudo gitlab-rake gitlab:import:user_to_groups[username@domain.tld]
# installation from source or cookbook # installation from source or cookbook
bundle exec rake gitlab:import:user_to_groups[username@domain.tld] bundle exec rake gitlab:import:user_to_groups[username@domain.tld] RAILS_ENV=production
``` ```
## Add all users to all groups ## Add all users to all groups
...@@ -45,5 +45,5 @@ Notes: ...@@ -45,5 +45,5 @@ Notes:
sudo gitlab-rake gitlab:import:all_users_to_all_groups sudo gitlab-rake gitlab:import:all_users_to_all_groups
# installation from source or cookbook # installation from source or cookbook
bundle exec rake gitlab:import:all_users_to_all_groups bundle exec rake gitlab:import:all_users_to_all_groups RAILS_ENV=production
``` ```
...@@ -7,4 +7,25 @@ This document currently just serves as a place to keep track of updates that wil ...@@ -7,4 +7,25 @@ This document currently just serves as a place to keep track of updates that wil
### Update config files ### Update config files
* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings. * HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting * HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting
\ No newline at end of file
### Configure Redis to use sockets
# Configure redis to use sockets
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed -e 's/^# unixsocket /unixsocket /' -e 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
# Activate the changes to redis.conf
sudo service redis-server restart
# Add git to the redis group
sudo usermod -aG redis git
cd /home/git/gitlab
# Configure Redis connection settings
sudo -u git -H cp config/resque.yml.example config/resque.yml
# Change the Redis socket path if necessary
sudo -u git -H editor config/resque.yml
cd /home/git/gitlab-shell
# Configure gitlab-shell to use Redis sockets
sudo -u git -H sed -i 's|^ # socket.*| socket: /var/run/redis/redis.sock|' config.yml
...@@ -25,6 +25,10 @@ module API ...@@ -25,6 +25,10 @@ module API
# GET /projects/:id/merge_requests # GET /projects/:id/merge_requests
# GET /projects/:id/merge_requests?state=opened # GET /projects/:id/merge_requests?state=opened
# GET /projects/:id/merge_requests?state=closed # GET /projects/:id/merge_requests?state=closed
# GET /projects/:id/merge_requests?order_by=created_at
# GET /projects/:id/merge_requests?order_by=updated_at
# GET /projects/:id/merge_requests?sort=desc
# GET /projects/:id/merge_requests?sort=asc
# #
get ":id/merge_requests" do get ":id/merge_requests" do
authorize! :read_merge_request, user_project authorize! :read_merge_request, user_project
...@@ -36,6 +40,16 @@ module API ...@@ -36,6 +40,16 @@ module API
else user_project.merge_requests else user_project.merge_requests
end end
sort = case params["sort"]
when 'desc' then 'DESC'
else 'ASC'
end
mrs = case params["order_by"]
when 'updated_at' then mrs.order("updated_at #{sort}")
else mrs.order("created_at #{sort}")
end
present paginate(mrs), with: Entities::MergeRequest present paginate(mrs), with: Entities::MergeRequest
end end
......
...@@ -57,6 +57,46 @@ describe API::API, api: true do ...@@ -57,6 +57,46 @@ describe API::API, api: true do
json_response.length.should == 1 json_response.length.should == 1
json_response.first['title'].should == merge_request_merged.title json_response.first['title'].should == merge_request_merged.title
end end
context "with ordering" do
before do
@mr_later = mr_with_later_created_and_updated_at_time
@mr_earlier = mr_with_earlier_created_and_updated_at_time
end
it "should return an array of merge_requests in ascending order" do
get api("/projects/#{project.id}/merge_requests?sort=asc", user)
response.status.should == 200
json_response.should be_an Array
json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id
end
it "should return an array of merge_requests in descending order" do
get api("/projects/#{project.id}/merge_requests?sort=desc", user)
response.status.should == 200
json_response.should be_an Array
json_response.length.should == 3
json_response.first['id'].should == @mr_later.id
json_response.last['id'].should == @mr_earlier.id
end
it "should return an array of merge_requests ordered by updated_at" do
get api("/projects/#{project.id}/merge_requests?order_by=updated_at", user)
response.status.should == 200
json_response.should be_an Array
json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id
end
it "should return an array of merge_requests ordered by created_at" do
get api("/projects/#{project.id}/merge_requests?sort=created_at", user)
response.status.should == 200
json_response.should be_an Array
json_response.length.should == 3
json_response.first['id'].should == @mr_earlier.id
json_response.last['id'].should == @mr_later.id
end
end
end end
end end
...@@ -296,4 +336,20 @@ describe API::API, api: true do ...@@ -296,4 +336,20 @@ describe API::API, api: true do
response.status.should == 404 response.status.should == 404
end end
end end
def mr_with_later_created_and_updated_at_time
merge_request
merge_request.created_at += 1.hour
merge_request.updated_at += 30.minutes
merge_request.save
merge_request
end
def mr_with_earlier_created_and_updated_at_time
merge_request_closed
merge_request_closed.created_at -= 1.hour
merge_request_closed.updated_at -= 30.minutes
merge_request_closed.save
merge_request_closed
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment