Skip to content
Snippets Groups Projects
Commit fa7788f9 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge remote-tracking branch 'ce/8-5-stable' into ce-8-5-stable-to-ee-8-5-stable-ee

parents 0eed4bcb 610a4f91
No related branches found
No related tags found
1 merge request!199[WIP] CE 8-5-stable to EE 8-5-stable-ee
Pipeline #12797178 failed
Showing
with 338 additions and 7 deletions
class AddErasableToCiBuild < ActiveRecord::Migration
def change
add_reference :ci_builds, :erased_by, references: :users, index: true
add_column :ci_builds, :erased_at, :datetime
end
end
Loading
Loading
@@ -160,6 +160,8 @@
t.text "artifacts_file"
t.integer "gl_project_id"
t.text "artifacts_metadata"
t.integer "erased_by_id"
t.datetime "erased_at"
end
 
add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree
Loading
Loading
@@ -167,6 +169,7 @@
add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree
add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree
add_index "ci_builds", ["commit_id"], name: "index_ci_builds_on_commit_id", using: :btree
add_index "ci_builds", ["erased_by_id"], name: "index_ci_builds_on_erased_by_id", using: :btree
add_index "ci_builds", ["gl_project_id"], name: "index_ci_builds_on_gl_project_id", using: :btree
add_index "ci_builds", ["project_id", "commit_id"], name: "index_ci_builds_on_project_id_and_commit_id", using: :btree
add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree
Loading
Loading
@@ -613,6 +616,7 @@
t.text "merge_params"
t.boolean "merge_when_build_succeeds", default: false, null: false
t.integer "merge_user_id"
t.string "merge_commit_sha"
end
 
add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree
Loading
Loading
Loading
Loading
@@ -338,3 +338,53 @@ Example of response
"user": null
}
```
## Erase a build
Erase a single build of a project (remove build artifacts and a build trace)
```
POST /projects/:id/builds/:build_id/erase
```
Parameters
| Attribute | Type | required | Description |
|-------------|---------|----------|---------------------|
| `id` | integer | yes | The ID of a project |
| `build_id` | integer | yes | The ID of a build |
Example of request
```
curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/1/erase"
```
Example of response
```json
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "Test the CI integration.",
"short_id": "0ff3ae19",
"title": "Test the CI integration."
},
"coverage": null,
"download_url": null,
"id": 69,
"name": "rubocop",
"ref": "master",
"runner": null,
"stage": "test",
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": "2016-01-11T10:13:33.506Z",
"finished_at": "2016-01-11T10:15:10.506Z",
"status": "failed",
"tag": false,
"user": null
}
```
Loading
Loading
@@ -33,7 +33,7 @@ The YAML syntax allows for using more complex job specifications than in the
above example:
 
```yaml
image: ruby:2.2
image: ruby:2.1
services:
- postgres
 
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@ We use [these build scripts](https://gitlab.com/gitlab-org/gitlab-ci/blob/master
# Build configuration on [Semaphore](https://semaphoreapp.com/gitlabhq/gitlabhq/) for testing the [GitHub.com repo](https://github.com/gitlabhq/gitlabhq)
 
- Language: Ruby
- Ruby version: 2.2.4
- Ruby version: 2.1.8
- database.yml: pg
 
Build commands
Loading
Loading
Loading
Loading
@@ -107,7 +107,7 @@ Then select 'Internet Site' and press enter to confirm the hostname.
 
## 2. Ruby
 
_**Note:** The current supported Ruby versions are 2.1.x and 2.2.x. Ruby 2.3 is
_**Note:** The current supported Ruby version is 2.1.x. Ruby 2.2 and 2.3 are
currently not supported._
 
The use of Ruby version managers such as [RVM], [rbenv] or [chruby] with GitLab
Loading
Loading
@@ -123,9 +123,9 @@ Remove the old Ruby 1.8 if present:
Download Ruby and compile it:
 
mkdir /tmp/ruby && cd /tmp/ruby
curl -O --progress https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.gz
echo 'b6eff568b48e0fda76e5a36333175df049b204e91217aa32a65153cc0cdcb761 ruby-2.2.4.tar.gz' | sha256sum -c - && tar xzf ruby-2.2.4.tar.gz
cd ruby-2.2.4
curl -O --progress https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz
echo 'c7e50159357afd87b13dc5eaf4ac486a70011149 ruby-2.1.8.tar.gz' | shasum -c - && tar xzf ruby-2.1.8.tar.gz
cd ruby-2.1.8
./configure --disable-install-rdoc
make
sudo make install
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ Please consider using a virtual machine to run GitLab.
 
## Ruby versions
 
GitLab requires Ruby (MRI) 2.1.x or 2.2.x and currently does not work with version 2.3.
GitLab requires Ruby (MRI) 2.1.x and currently does not work with versions 2.2 or 2.3.
 
You will have to use the standard MRI implementation of Ruby.
We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/) but GitLab
Loading
Loading
Loading
Loading
@@ -26,6 +26,7 @@
- [Releases](releases.md)
- [Milestones](milestones.md)
- [Merge Requests](merge_requests.md)
- [Revert changes](revert_changes.md)
- ["Work In Progress" Merge Requests](wip_merge_requests.md)
- [Repository Mirroring](repository_mirroring.md)
- [Merge When Build Succeeds](merge_when_build_succeeds.md)
Loading
Loading
doc/workflow/img/revert_changes_commit.png

352 KiB

doc/workflow/img/revert_changes_commit_modal.png

320 KiB

doc/workflow/img/revert_changes_mr.png

359 KiB

doc/workflow/img/revert_changes_mr_modal.png

327 KiB

# Reverting changes
_**Note:** This feature was [introduced][ce-1990] in GitLab 8.5._
---
GitLab implements Git's powerful feature to [revert any commit][git-revert]
with introducing a **Revert** button in Merge Requests and commit details.
## Reverting a Merge Request
_**Note:** The **Revert** button will only be available for Merge Requests
created since GitLab 8.5. However, you can still revert a Merge Request
by reverting the merge commit from the list of Commits page._
After the Merge Request has been merged, a **Revert** button will be available
to revert the changes introduced by that Merge Request:
![Revert Merge Request](img/revert_changes_mr.png)
---
You can revert the changes directly into the selected branch or you can opt to
create a new Merge Request with the revert changes:
![Revert Merge Request modal](img/revert_changes_mr_modal.png)
---
After the Merge Request has been reverted, the **Revert** button will not be
available anymore.
## Reverting a Commit
You can revert a Commit from the Commit details page:
![Revert commit](img/revert_changes_commit.png)
---
Similar to reverting a Merge Request, you can opt to revert the changes
directly into the target branch or create a new Merge Request to revert the
changes:
![Revert commit modal](img/revert_changes_commit_modal.png)
---
After the Commit has been reverted, the **Revert** button will not be available
anymore.
Please note that when reverting merge commits, the mainline will always be the
first parent. If you want to use a different mainline then you need to do that
from the command line.
Here is a quick example to revert a merge commit using the second parent as the
mainline:
```bash
git revert -m 2 7a39eb0
```
[ce-1990]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1990 "Revert button Merge Request"
[git-revert]: https://git-scm.com/docs/git-revert "Git revert documentation"
Loading
Loading
@@ -13,3 +13,12 @@ Feature: Project Builds Summary
Scenario: I browse project builds page
When I visit project builds page
Then I see button to CI Lint
Scenario: I erase a build
Given recent build is successful
And recent build has a build trace
When I visit recent build details page
And I click erase build button
Then recent build has been erased
And recent build summary does not have artifacts widget
And recent build summary contains information saying that build has been erased
@project_commits
Feature: Revert Commits
Background:
Given I sign in as a user
And I own a project
And I visit my project's commits page
Scenario: I revert a commit
Given I click on commit link
And I click on the revert button
And I revert the changes directly
Then I should see the revert commit notice
Scenario: I revert a commit that was previously reverted
Given I click on commit link
And I click on the revert button
And I revert the changes directly
And I visit my project's commits page
And I click on commit link
And I click on the revert button
And I revert the changes directly
Then I should see a revert error
Scenario: I revert a commit in a new merge request
Given I click on commit link
And I click on the revert button
And I revert the changes in a new merge request
Then I should see the new merge request notice
@project_merge_requests
Feature: Revert Merge Requests
Background:
Given There is an open Merge Request
And I am signed in as a developer of the project
And I am on the Merge Request detail page
And I click on Accept Merge Request
@javascript
Scenario: I revert a merge request
Given I click on the revert button
And I revert the changes directly
Then I should see the revert merge request notice
@javascript
Scenario: I revert a merge request that was previously reverted
Given I click on the revert button
And I revert the changes directly
And I am on the Merge Request detail page
And I click on the revert button
And I revert the changes directly
Then I should see a revert error
@javascript
Scenario: I revert a merge request in a new merge request
Given I click on the revert button
And I am on the Merge Request detail page
And I click on the revert button
And I revert the changes in a new merge request
Then I should see the new merge request notice
Feature: Project Milestone
Background:
Given I sign in as a user
And I own project "Shop"
And project "Shop" has labels: "bug", "feature", "enhancement"
And project "Shop" has milestone "v2.2"
And milestone has issue "Bugfix1" with labels: "bug", "feature"
And milestone has issue "Bugfix2" with labels: "bug", "enhancement"
@javascript
Scenario: Listing issues from issues tab
Given I visit project "Shop" milestones page
And I click link "v2.2"
Then I should see the labels "bug", "enhancement" and "feature"
@javascript
Scenario: Listing labels from labels tab
Given I visit project "Shop" milestones page
And I click link "v2.2"
And I click link "Labels"
Then I should see the list of labels
And I should see the labels "bug", "enhancement" and "feature"
Loading
Loading
@@ -10,4 +10,24 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
expect(ci_lint_tool_link[:href]).to eq ci_lint_path
end
end
step 'I click erase build button' do
click_link 'Erase'
end
step 'recent build has been erased' do
expect(@build.artifacts_file.exists?).to be_falsy
expect(@build.artifacts_metadata.exists?).to be_falsy
expect(@build.trace).to be_empty
end
step 'recent build summary does not have artifacts widget' do
expect(page).to have_no_css('.artifacts')
end
step 'recent build summary contains information saying that build has been erased' do
page.within('.erased') do
expect(page).to have_content 'Build has been erased'
end
end
end
class Spinach::Features::RevertCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
include SharedDiffNote
include RepoHelpers
step 'I click on commit link' do
visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
end
step 'I click on the revert button' do
find("a[href='#modal-revert-commit']").click
end
step 'I revert the changes directly' do
page.within('#modal-revert-commit') do
uncheck 'create_merge_request'
click_button 'Revert'
end
end
step 'I should see the revert commit notice' do
page.should have_content('The commit has been successfully reverted.')
end
step 'I should see a revert error' do
page.should have_content('Sorry, we cannot revert this commit automatically.')
end
step 'I revert the changes in a new merge request' do
page.within('#modal-revert-commit') do
click_button 'Revert'
end
end
step 'I should see the new merge request notice' do
page.should have_content('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.')
end
end
class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps
include LoginHelpers
include GitlabRoutingHelper
step 'I click on the revert button' do
find("a[href='#modal-revert-commit']").click
end
step 'I revert the changes directly' do
page.within('#modal-revert-commit') do
uncheck 'create_merge_request'
click_button 'Revert'
end
end
step 'I should see the revert merge request notice' do
page.should have_content('The merge request has been successfully reverted.')
end
step 'I should not see the revert button' do
expect(page).not_to have_selector(:xpath, "a[href='#modal-revert-commit']")
end
step 'I am on the Merge Request detail page' do
visit merge_request_path(@merge_request)
end
step 'I click on Accept Merge Request' do
click_button('Accept Merge Request')
end
step 'I am signed in as a developer of the project' do
login_as(@user)
end
step 'There is an open Merge Request' do
@user = create(:user)
@project = create(:project, :public)
@project_member = create(:project_member, user: @user, project: @project, access_level: ProjectMember::DEVELOPER)
@merge_request = create(:merge_request, :with_diffs, :simple, source_project: @project)
end
step 'I should see a revert error' do
page.should have_content('Sorry, we cannot revert this merge request automatically.')
end
step 'I revert the changes in a new merge request' do
page.within('#modal-revert-commit') do
click_button 'Revert'
end
end
step 'I should see the new merge request notice' do
page.should have_content('The merge request has been successfully reverted. You can now submit a merge request to get this change into the original branch.')
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment