Commit f76c4c82 authored by Bryce Johnson's avatar Bryce Johnson

Merge branch 'master' into issues-filters-reset-btn

parents 34ba9e41 57c4036d
...@@ -248,6 +248,21 @@ bundler:audit: ...@@ -248,6 +248,21 @@ bundler:audit:
script: script:
- "bundle exec bundle-audit check --update --ignore OSVDB-115941" - "bundle exec bundle-audit check --update --ignore OSVDB-115941"
migration paths:
stage: test
<<: *use-db
only:
- master@gitlab-org/gitlab-ce
script:
- git checkout HEAD .
- git fetch --tags
- git checkout v8.5.9
- 'echo test: unix:/var/opt/gitlab/redis/redis.socket > config/resque.yml'
- bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" --retry=3
- rake db:drop db:create db:schema:load db:seed_fu
- git checkout $CI_BUILD_REF
- rake db:migrate
coverage: coverage:
stage: post-test stage: post-test
services: [] services: []
...@@ -263,7 +278,6 @@ coverage: ...@@ -263,7 +278,6 @@ coverage:
- coverage/index.html - coverage/index.html
- coverage/assets/ - coverage/assets/
# Notify slack in the end # Notify slack in the end
notify:slack: notify:slack:
......
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (unreleased) v 8.12.0 (unreleased)
- Add ability to fork to a specific namespace using API. (ritave)
- Cleanup misalignments in Issue list view !6206
- Prepend blank line to `Closes` message on merge request linked to issue (lukehowell) - Prepend blank line to `Closes` message on merge request linked to issue (lukehowell)
- Filter tags by name !6121 - Filter tags by name !6121
- Make push events have equal vertical spacing. - Make push events have equal vertical spacing.
...@@ -9,6 +11,7 @@ v 8.12.0 (unreleased) ...@@ -9,6 +11,7 @@ v 8.12.0 (unreleased)
- Add font color contrast to external label in admin area (ClemMakesApps) - Add font color contrast to external label in admin area (ClemMakesApps)
- Change logo animation to CSS (ClemMakesApps) - Change logo animation to CSS (ClemMakesApps)
- Instructions for enabling Git packfile bitmaps !6104 - Instructions for enabling Git packfile bitmaps !6104
- Fix pagination on user snippets page
- Change merge_error column from string to text type - Change merge_error column from string to text type
- Reduce contributions calendar data payload (ClemMakesApps) - Reduce contributions calendar data payload (ClemMakesApps)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel) - Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
...@@ -24,6 +27,7 @@ v 8.12.0 (unreleased) ...@@ -24,6 +27,7 @@ v 8.12.0 (unreleased)
- Add white background for no readme container (ClemMakesApps) - Add white background for no readme container (ClemMakesApps)
- API: Expose issue confidentiality flag. (Robert Schilling) - API: Expose issue confidentiality flag. (Robert Schilling)
- Fix markdown anchor icon interaction (ClemMakesApps) - Fix markdown anchor icon interaction (ClemMakesApps)
- Test migration paths from 8.5 until current release !4874
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention) - Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel) - Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Remove Gitorious import - Remove Gitorious import
...@@ -82,8 +86,12 @@ v 8.12.0 (unreleased) ...@@ -82,8 +86,12 @@ v 8.12.0 (unreleased)
- Adds response mime type to transaction metric action when it's not HTML - Adds response mime type to transaction metric action when it's not HTML
- Fix hover leading space bug in pipeline graph !5980 - Fix hover leading space bug in pipeline graph !5980
- User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496 - User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496
- Fix repository page ui issues
- Fixed invisible scroll controls on build page on iPhone - Fixed invisible scroll controls on build page on iPhone
- Fix error on raw build trace download for old builds stored in database !4822 - Fix error on raw build trace download for old builds stored in database !4822
- Refactor the triggers page and documentation !6217
- Show values of CI trigger variables only when clicked (Katarzyna Kobierska Ula Budziszewska)
- Use default clone protocol on "check out, review, and merge locally" help page URL
v 8.11.5 (unreleased) v 8.11.5 (unreleased)
- Optimize branch lookups and force a repository reload for Repository#find_branch - Optimize branch lookups and force a repository reload for Repository#find_branch
......
...@@ -53,7 +53,7 @@ gem 'browser', '~> 2.2' ...@@ -53,7 +53,7 @@ gem 'browser', '~> 2.2'
# Extracting information from a git repository # Extracting information from a git repository
# Provide access to Gitlab::Git library # Provide access to Gitlab::Git library
gem 'gitlab_git', '~> 10.5' gem 'gitlab_git', '~> 10.6.3'
# LDAP Auth # LDAP Auth
# GitLab fork with several improvements to original library. For full list of changes # GitLab fork with several improvements to original library. For full list of changes
......
...@@ -279,7 +279,7 @@ GEM ...@@ -279,7 +279,7 @@ GEM
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab_git (10.5.0) gitlab_git (10.6.3)
activesupport (~> 4.0) activesupport (~> 4.0)
charlock_holmes (~> 0.7.3) charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
...@@ -858,7 +858,7 @@ DEPENDENCIES ...@@ -858,7 +858,7 @@ DEPENDENCIES
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
github-markup (~> 1.4) github-markup (~> 1.4)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab_git (~> 10.5) gitlab_git (~> 10.6.3)
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (~> 1.2.1) gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.2) gollum-lib (~> 4.2)
......
Vue.http.interceptors.push((request, next) => { Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1; Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
Vue.nextTick(() => { next(function (response) {
setTimeout(() => { Vue.activeResources--;
Vue.activeResources--;
}, 500);
}); });
next();
}); });
$(function(){
$('.reveal-variables').off('click').on('click',function(){
$('.js-build').toggle().niceScroll();
$(this).hide();
});
});
(global => {
global.gl = global.gl || {};
gl.SnippetsList = function() {
var $holder = $('.snippets-list-holder');
$holder.find('.pagination').on('ajax:success', (e, data) => {
$holder.replaceWith(data.html);
});
}
})(window);
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
} }
li a { li a {
padding: 16px 10px 11px; padding: 16px 15px 11px;
} }
/* Small devices (phones, tablets, 768px and lower) */ /* Small devices (phones, tablets, 768px and lower) */
......
...@@ -101,6 +101,7 @@ $gl-icon-color: $gl-placeholder-color; ...@@ -101,6 +101,7 @@ $gl-icon-color: $gl-placeholder-color;
$gl-grayish-blue: #7f8fa4; $gl-grayish-blue: #7f8fa4;
$gl-gray: $gl-text-color; $gl-gray: $gl-text-color;
$gl-gray-dark: #313236; $gl-gray-dark: #313236;
$gl-gray-light: $gl-placeholder-color;
$gl-header-color: $gl-title-color; $gl-header-color: $gl-title-color;
/* /*
......
...@@ -115,6 +115,16 @@ ...@@ -115,6 +115,16 @@
width: 100%; width: 100%;
} }
.js-build-variable {
color: $code-color;
}
.js-build-value {
padding: 2px 4px;
color: $black;
background-color: $white-light;
}
.build-sidebar-header { .build-sidebar-header {
padding: 0 $gl-padding $gl-padding; padding: 0 $gl-padding $gl-padding;
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
} }
.commit-row-title { .commit-row-title {
line-height: 1; line-height: 1.35;
margin-bottom: 7px;
.notes_count { .notes_count {
float: right; float: right;
...@@ -43,6 +42,7 @@ ...@@ -43,6 +42,7 @@
border: 1px solid $border-gray-dark; border: 1px solid $border-gray-dark;
border-radius: $border-radius-default; border-radius: $border-radius-default;
margin-left: 5px; margin-left: 5px;
line-height: 1;
&:hover { &:hover {
background-color: darken($gray-light, 10%); background-color: darken($gray-light, 10%);
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
.commit-row-info { .commit-row-info {
color: $gl-gray; color: $gl-gray;
line-height: 1; line-height: 1.35;
a { a {
color: $gl-gray; color: $gl-gray;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
.issue-check { .issue-check {
float: left; float: left;
padding-right: 8px; padding-right: 16px;
margin-bottom: 10px; margin-bottom: 10px;
min-width: 15px; min-width: 15px;
......
...@@ -15,16 +15,6 @@ ...@@ -15,16 +15,6 @@
vertical-align: top; vertical-align: top;
} }
.last-commit {
max-width: 506px;
.last-commit-content {
@include str-truncated;
width: calc(100% - 140px);
margin-left: 3px;
}
}
.tree-table { .tree-table {
margin-bottom: 0; margin-bottom: 0;
...@@ -36,6 +26,15 @@ ...@@ -36,6 +26,15 @@
line-height: 21px; line-height: 21px;
} }
.last-commit {
@include str-truncated(60%);
}
.commit-history-link-spacer {
margin: 0 10px;
color: $table-border-color;
}
&:hover { &:hover {
td { td {
background-color: $row-hover; background-color: $row-hover;
...@@ -91,11 +90,17 @@ ...@@ -91,11 +90,17 @@
} }
} }
.tree_commit { .tree-time-ago {
color: $gl-gray; min-width: 135px;
color: $gl-gray-light;
}
.tree-commit {
max-width: 320px;
color: $gl-gray-light;
.tree-commit-link { .tree-commit-link {
color: $gl-gray; color: $gl-gray-light;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
......
...@@ -90,12 +90,13 @@ ...@@ -90,12 +90,13 @@
- if @build.trigger_request.variables - if @build.trigger_request.variables
%p %p
%span.build-light-text Variables: %button.btn.group.btn-group-justified.reveal-variables Reveal Variables
- @build.trigger_request.variables.each do |key, value| - @build.trigger_request.variables.each do |key, value|
%code .hide.js-build
#{key}=#{value} .js-build-variable= key
.js-build-value= value
.block .block
.title .title
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
%pre.dark#merge-info-1 %pre.dark#merge-info-1
- if @merge_request.for_fork? - if @merge_request.for_fork?
:preserve :preserve
git fetch #{h @merge_request.source_project.http_url_to_repo} #{h @merge_request.source_branch} git fetch #{h default_url_to_repo(@merge_request.source_project)} #{h @merge_request.source_branch}
git checkout -b #{h @merge_request.source_project_path}-#{h @merge_request.source_branch} FETCH_HEAD git checkout -b #{h @merge_request.source_project_path}-#{h @merge_request.source_branch} FETCH_HEAD
- else - else
:preserve :preserve
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
:plain :plain
var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}'); row.find("td.tree-time-ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); row.find("td.tree-commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}');
- if @more_log_url - if @more_log_url
:plain :plain
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
- file_name = blob_item.name - file_name = blob_item.name
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@id || @commit.id, blob_item.name)), title: file_name do = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@id || @commit.id, blob_item.name)), title: file_name do
%span.str-truncated= file_name %span.str-truncated= file_name
%td.tree_time_ago.cgray %td.hidden-xs.tree-commit
= render 'projects/tree/spinner' %td.tree-time-ago.cgray.text-right
%td.hidden-xs.tree_commit = render 'projects/tree/spinner'
\ No newline at end of file
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
%thead %thead
%tr %tr
%th Name %th Name
%th Last Update %th.hidden-xs
%th.hidden-xs.last-commit .pull-left Last Commit
Last Commit .last-commit.hidden-sm.pull-left
.last-commit-content.hidden-sm &nbsp;
%i.fa.fa-angle-right %i.fa.fa-angle-right
&nbsp; &nbsp;
%small.light %small.light
= link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace" = link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace"
&ndash; &ndash;
= time_ago_with_tooltip(@commit.committed_date) = time_ago_with_tooltip(@commit.committed_date)
&ndash;
= @commit.full_title = @commit.full_title
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'pull-right' %small.commit-history-link-spacer &#124;
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'commit-history-link'
%th.text-right Last Update
- if @path.present? - if @path.present?
%tr.tree-item %tr.tree-item
%td.tree-item-file-name %td.tree-item-file-name
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
- path = flatten_tree(tree_item) - path = flatten_tree(tree_item)
= link_to namespace_project_tree_path(@project.namespace, @project, tree_join(@id || @commit.id, path)), title: path do = link_to namespace_project_tree_path(@project.namespace, @project, tree_join(@id || @commit.id, path)), title: path do
%span.str-truncated= path %span.str-truncated= path
%td.tree_time_ago.cgray %td.hidden-xs.tree-commit
= render 'projects/tree/spinner' %td.tree-time-ago.text-right
%td.hidden-xs.tree_commit = render 'projects/tree/spinner'
\ No newline at end of file
...@@ -4,65 +4,89 @@ ...@@ -4,65 +4,89 @@
.col-lg-3 .col-lg-3
%h4.prepend-top-0 %h4.prepend-top-0
= page_title = page_title
%p %p.prepend-top-20
Triggers can force a specific branch or tag to rebuild with an API call. Triggers can force a specific branch or tag to get rebuilt with an API call.
%p.append-bottom-0
= succeed '.' do
Learn more in the
= link_to 'triggers documentation', help_page_path('ci/triggers/README'), target: '_blank'
.col-lg-9 .col-lg-9
%h5.prepend-top-0 .panel.panel-default
Your triggers .panel-heading
- if @triggers.any? %h4.panel-title
.table-responsive Manage your project's triggers
%table.table .panel-body
%thead - if @triggers.any?
%th Token .table-responsive
%th Last used %table.table
%th %thead
= render partial: 'trigger', collection: @triggers, as: :trigger %th
- else %strong Token
%p.settings-message.text-center.append-bottom-default %th
No triggers have been created yet. Add one using the button below. %strong Last used
%th
= render partial: 'trigger', collection: @triggers, as: :trigger
- else
%p.settings-message.text-center.append-bottom-default
No triggers have been created yet. Add one using the button below.
= form_for @trigger, url: url_for(controller: 'projects/triggers', action: 'create') do |f| = form_for @trigger, url: url_for(controller: 'projects/triggers', action: 'create') do |f|
= f.submit "Add Trigger", class: 'btn btn-success' = f.submit "Add trigger", class: 'btn btn-success'
%h5.prepend-top-default .panel-footer
Use CURL
%p.light %p
Copy the token above, set your branch or tag name, and that reference will be rebuilt. In the following examples, you can see the exact API call you need to
make in order to rebuild a specific
%code ref
(branch or tag) with a trigger token.
%p
All you need to do is replace the
%code TOKEN
and
%code REF_NAME
with the trigger token and the branch or tag name respectively.
%pre %h5.prepend-top-default
:plain Use cURL
curl -X POST \
-F token=TOKEN \
-F ref=REF_NAME \
#{builds_trigger_url(@project.id)}
%h5.prepend-top-default
Use .gitlab-ci.yml
%p.light %p.light
In the Copy one of the tokens above, set your branch or tag name, and that
%code .gitlab-ci.yml reference will be rebuilt.
of the dependent project, include the following snippet.
The project will rebuild at the end of the build.
%pre %pre
:plain :plain
trigger: curl -X POST \
type: deploy -F token=TOKEN \
script: -F ref=REF_NAME \
- "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}" #{builds_trigger_url(@project.id)}
%h5.prepend-top-default %h5.prepend-top-default
Pass build variables Use .gitlab-ci.yml
%p.light %p.light
Add In the
%code variables[VARIABLE]=VALUE %code .gitlab-ci.yml
to an API request. Variable values can be used to distinguish between triggered builds and normal builds. of another project, include the following snippet.
The project will be rebuilt at the end of the build.
%pre.append-bottom-0 %pre
:plain :plain
curl -X POST \ trigger_build:
-F token=TOKEN \ stage: deploy
-F "ref=REF_NAME" \ script:
-F "variables[RUN_NIGHTLY_BUILD]=true" \ - "curl -X POST -F token=TOKEN -F ref=REF_NAME #{builds_trigger_url(@project.id)}"
#{builds_trigger_url(@project.id)} %h5.prepend-top-default
Pass build variables
%p.light
Add
%code variables[VARIABLE]=VALUE
to an API request. Variable values can be used to distinguish between triggered builds and normal builds.
%pre.append-bottom-0
:plain
curl -X POST \
-F token=TOKEN \
-F "ref=REF_NAME" \
-F "variables[RUN_NIGHTLY_BUILD]=true" \
#{builds_trigger_url(@project.id)}
%ul.content-list .snippets-list-holder
= render partial: 'shared/snippets/snippet', collection: @snippets %ul.content-list
- if @snippets.empty? = render partial: 'shared/snippets/snippet', collection: @snippets
%li - if @snippets.empty?
.nothing-here-block Nothing here. %li
.nothing-here-block Nothing here.
= paginate @snippets, theme: 'gitlab' = paginate @snippets, theme: 'gitlab', remote: true
:javascript
gl.SnippetsList();
...@@ -8,12 +8,11 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration ...@@ -8,12 +8,11 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
require 'yaml' require 'yaml'
import_sources = connection.execute('SELECT import_sources FROM application_settings;') import_sources = connection.execute('SELECT import_sources FROM application_settings;')
return unless import_sources.first # support empty databases
yaml = if Gitlab::Database.postgresql? yaml = if Gitlab::Database.postgresql?
import_sources.values[0][0] import_sources.values[0][0]
else else
return unless import_sources.first
import_sources.first[0] import_sources.first[0]
end end
......
...@@ -514,7 +514,7 @@ invalid, 400 is returned. ...@@ -514,7 +514,7 @@ invalid, 400 is returned.
### Fork project ### Fork project
Forks a project into the user namespace of the authenticated user. Forks a project into the user namespace of the authenticated user or the one provided.
``` ```
POST /projects/fork/:id POST /projects/fork/:id
...@@ -523,6 +523,7 @@ POST /projects/fork/:id ...@@ -523,6 +523,7 @@ POST /projects/fork/:id
Parameters: Parameters:
- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of the project to be forked - `id` (required) - The ID or NAMESPACE/PROJECT_NAME of the project to be forked
- `namespace` (optional) - The ID or path of the namespace that the project will be forked to
### Star a project ### Star a project
......
doc/ci/triggers/img/builds_page.png

32.5 KB | W: | H:

doc/ci/triggers/img/builds_page.png

74.4 KB | W: | H:

doc/ci/triggers/img/builds_page.png
doc/ci/triggers/img/builds_page.png
doc/ci/triggers/img/builds_page.png
doc/ci/triggers/img/builds_page.png
  • 2-up
  • Swipe
  • Onion skin
doc/ci/triggers/img/triggers_page.png

12.6 KB | W: | H:

doc/ci/triggers/img/triggers_page.png

11.7 KB | W: | H:

doc/ci/triggers/img/triggers_page.png
doc/ci/triggers/img/triggers_page.png
doc/ci/triggers/img/triggers_page.png
doc/ci/triggers/img/triggers_page.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -6,50 +6,6 @@ GitLab Runner to manage your project's builds. ...@@ -6,50 +6,6 @@ GitLab Runner to manage your project's builds.
If you want a quick introduction to GitLab CI, follow our If you want a quick introduction to GitLab CI, follow our
[quick start guide](../quick_start/README.md). [quick start guide](../quick_start/README.md).
---
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [.gitlab-ci.yml](#gitlab-ci-yml)
- [image and services](#image-and-services)
- [before_script](#before_script)
- [after_script](#after_script)
- [stages](#stages)
- [types](#types)
- [variables](#variables)
- [cache](#cache)
- [cache:key](#cache-key)
- [Jobs](#jobs)
- [script](#script)
- [stage](#stage)
- [only and except](#only-and-except)
- [job variables](#job-variables)
- [tags](#tags)
- [allow_failure](#allow_failure)
- [when](#when)
- [Manual actions](#manual-actions)
- [environment](#environment)
- [artifacts](#artifacts)
- [artifacts:name](#artifacts-name)
- [artifacts:when](#artifacts-when)
- [artifacts:expire_in](#artifacts-expire_in)
- [dependencies](#dependencies)
- [before_script and after_script](#before_script-and-after_script)
- [Git Strategy](#git-strategy)
- [Shallow cloning](#shallow-cloning)
- [Hidden keys](#hidden-keys)
- [Special YAML features](#special-yaml-features)
- [Anchors](#anchors)
- [Validate the .gitlab-ci.yml](#validate-the-gitlab-ci-yml)
- [Skipping builds](#skipping-builds)
- [Examples](#examples)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
---
## .gitlab-ci.yml ## .gitlab-ci.yml
From version 7.12, GitLab CI uses a [YAML](https://en.wikipedia.org/wiki/YAML) From version 7.12, GitLab CI uses a [YAML](https://en.wikipedia.org/wiki/YAML)
...@@ -183,7 +139,7 @@ Alias for [stages](#stages). ...@@ -183,7 +139,7 @@ Alias for [stages](#stages).
Introduced in GitLab Runner v0.5.0. Introduced in GitLab Runner v0.5.0.
GitLab CI allows you to add variables to `.gitlab-ci.yml` that are set in the GitLab CI allows you to add variables to `.gitlab-ci.yml` that are set in the
build environment. The variables are stored in the git repository and are meant build environment. The variables are stored in the Git repository and are meant
to store non-sensitive project configuration, for example: to store non-sensitive project configuration, for example:
```yaml ```yaml
...@@ -198,6 +154,8 @@ thus allowing to fine tune them. ...@@ -198,6 +154,8 @@ thus allowing to fine tune them.
Variables can be also defined on [job level](#job-variables). Variables can be also defined on [job level](#job-variables).
[Learn more about variables.](../variables/README.md)
### cache ### cache
>**Note:** >**Note:**
...@@ -1086,6 +1044,13 @@ test:mysql: ...@@ -1086,6 +1044,13 @@ test:mysql:
You can see that the hidden keys are conveniently used as templates. You can see that the hidden keys are conveniently used as templates.
## Triggers
Triggers can be used to force a rebuild of a specific branch, tag or commit,
with an API call.
[Read more in the triggers documentation.](../triggers/README.md)
## Validate the .gitlab-ci.yml ## Validate the .gitlab-ci.yml
Each instance of GitLab CI has an embedded debug tool called Lint. Each instance of GitLab CI has an embedded debug tool called Lint.
......
...@@ -189,16 +189,30 @@ module API ...@@ -189,16 +189,30 @@ module API
end end
end end
# Fork new project for the current user. # Fork new project for the current user or provided namespace.
# #
# Parameters: # Parameters:
# id (required) - The ID of a project # id (required) - The ID of a project
# namespace (optional) - The ID or name of the namespace that the project will be forked into.
# Example Request # Example Request
# POST /projects/fork/:id # POST /projects/fork/:id
post 'fork/:id' do post 'fork/:id' do
attrs = {}
namespace_id = params[:namespace]
if namespace_id.present?
namespace = Namespace.find_by(id: namespace_id) || Namespace.find_by_path_or_name(namespace_id)
not_found!('Target Namespace') unless namespace
attrs[:namespace] = namespace
end
@forked_project = @forked_project =
::Projects::ForkService.new(user_project, ::Projects::ForkService.new(user_project,
current_user).execute current_user,
attrs).execute
if @forked_project.errors.any? if @forked_project.errors.any?
conflict!(@forked_project.errors.messages) conflict!(@forked_project.errors.messages)
else else
......
...@@ -164,6 +164,26 @@ describe "Builds" do ...@@ -164,6 +164,26 @@ describe "Builds" do
expect(page).to have_link 'Raw' expect(page).to have_link 'Raw'
end end
end end
describe 'Variables' do
before do
@trigger_request = create :ci_trigger_request_with_variables
@build = create :ci_build, pipeline: @commit, trigger_request: @trigger_request
visit namespace_project_build_path(@project.namespace, @project, @build)
end
it 'shows variable key and value after click', js: true do
expect(page).to have_css('.reveal-variables')
expect(page).not_to have_css('.js-build-variable')
expect(page).not_to have_css('.js-build-value')
click_button 'Reveal Variables'
expect(page).not_to have_css('.reveal-variables')
expect(page).to have_selector('.js-build-variable', text: 'TRIGGER_KEY_1')
expect(page).to have_selector('.js-build-value', text: 'TRIGGER_VALUE_1')
end
end
end end
describe "POST /:project/builds/:id/cancel" do describe "POST /:project/builds/:id/cancel" do
......
...@@ -12,7 +12,7 @@ describe 'Triggers' do ...@@ -12,7 +12,7 @@ describe 'Triggers' do
context 'create a trigger' do context 'create a trigger' do
before do before do
click_on 'Add Trigger' click_on 'Add trigger'
expect(@project.triggers.count).to eq(1) expect(@project.triggers.count).to eq(1)
end end
......
require 'spec_helper'
describe 'Snippets tab on a user profile', feature: true, js: true do
include WaitForAjax
let(:user) { create(:user) }
context 'when the user has snippets' do
before do
create_list(:snippet, 25, :public, author: user)
visit user_path(user)
page.within('.user-profile-nav') { click_link 'Snippets' }
wait_for_ajax
end
it 'is limited to 20 items per page' do
expect(page.all('.snippets-list-holder .snippet-row').count).to eq(20)
end
context 'clicking on the link to the second page' do
before { click_link('2') }
it 'shows the remaining snippets' do
expect(page.all('.snippets-list-holder .snippet-row').count).to eq(5)
end
end
end
end
...@@ -6,6 +6,12 @@ describe API::API, api: true do ...@@ -6,6 +6,12 @@ describe API::API, api: true do
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:group) { create(:group) }
let(:group2) do
group = create(:group, name: 'group2_name')
group.add_owner(user2)
group
end
let(:project) do let(:project) do
create(:project, creator_id: user.id, namespace: user.namespace) create(:project, creator_id: user.id, namespace: user.namespace)
...@@ -22,6 +28,7 @@ describe API::API, api: true do ...@@ -22,6 +28,7 @@ describe API::API, api: true do
context 'when authenticated' do context 'when authenticated' do
it 'forks if user has sufficient access to project' do it 'forks if user has sufficient access to project' do
post api("/projects/fork/#{project.id}", user2) post api("/projects/fork/#{project.id}", user2)
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response['name']).to eq(project.name) expect(json_response['name']).to eq(project.name)
expect(json_response['path']).to eq(project.path) expect(json_response['path']).to eq(project.path)
...@@ -32,6 +39,7 @@ describe API::API, api: true do ...@@ -32,6 +39,7 @@ describe API::API, api: true do
it 'forks if user is admin' do it 'forks if user is admin' do
post api("/projects/fork/#{project.id}", admin) post api("/projects/fork/#{project.id}", admin)
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response['name']).to eq(project.name) expect(json_response['name']).to eq(project.name)
expect(json_response['path']).to eq(project.path) expect(json_response['path']).to eq(project.path)
...@@ -42,12 +50,14 @@ describe API::API, api: true do ...@@ -42,12 +50,14 @@ describe API::API, api: true do
it 'fails on missing project access for the project to fork' do it 'fails on missing project access for the project to fork' do
post api("/projects/fork/#{project.id}", user3) post api("/projects/fork/#{project.id}", user3)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Project Not Found') expect(json_response['message']).to eq('404 Project Not Found')
end end
it 'fails if forked project exists in the user namespace' do it 'fails if forked project exists in the user namespace' do
post api("/projects/fork/#{project.id}", user) post api("/projects/fork/#{project.id}", user)
expect(response).to have_http_status(409) expect(response).to have_http_status(409)
expect(json_response['message']['name']).to eq(['has already been taken']) expect(json_response['message']['name']).to eq(['has already been taken'])
expect(json_response['message']['path']).to eq(['has already been taken']) expect(json_response['message']['path']).to eq(['has already been taken'])
...@@ -55,14 +65,70 @@ describe API::API, api: true do ...@@ -55,14 +65,70 @@ describe API::API, api: true do
it 'fails if project to fork from does not exist' do it 'fails if project to fork from does not exist' do
post api('/projects/fork/424242', user) post api('/projects/fork/424242', user)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Project Not Found') expect(json_response['message']).to eq('404 Project Not Found')
end end
it 'forks with explicit own user namespace id' do
post api("/projects/fork/#{project.id}", user2), namespace: user2.namespace.id
expect(response).to have_http_status(201)
expect(json_response['owner']['id']).to eq(user2.id)
end
it 'forks with explicit own user name as namespace' do
post api("/projects/fork/#{project.id}", user2), namespace: user2.username
expect(response).to have_http_status(201)
expect(json_response['owner']['id']).to eq(user2.id)
end
it 'forks to another user when admin' do
post api("/projects/fork/#{project.id}", admin), namespace: user2.username
expect(response).to have_http_status(201)
expect(json_response['owner']['id']).to eq(user2.id)
end
it 'fails if trying to fork to another user when not admin' do
post api("/projects/fork/#{project.id}", user2), namespace: admin.namespace.id
expect(response).to have_http_status(409)
end
it 'fails if trying to fork to non-existent namespace' do
post api("/projects/fork/#{project.id}", user2), namespace: 42424242
expect(response).to have_http_status(404)
expect(json_response['message']).to eq('404 Target Namespace Not Found')
end
it 'forks to owned group' do
post api("/projects/fork/#{project.id}", user2), namespace: group2.name
expect(response).to have_http_status(201)
expect(json_response['namespace']['name']).to eq(group2.name)
end
it 'fails to fork to not owned group' do
post api("/projects/fork/#{project.id}", user2), namespace: group.name
expect(response).to have_http_status(409)
end
it 'forks to not owned group when admin' do
post api("/projects/fork/#{project.id}", admin), namespace: group.name
expect(response).to have_http_status(201)
expect(json_response['namespace']['name']).to eq(group.name)
end
end end
context 'when unauthenticated' do context 'when unauthenticated' do
it 'returns authentication error' do it 'returns authentication error' do
post api("/projects/fork/#{project.id}") post api("/projects/fork/#{project.id}")
expect(response).to have_http_status(401) expect(response).to have_http_status(401)
expect(json_response['message']).to eq('401 Unauthorized') expect(json_response['message']).to eq('401 Unauthorized')
end end
......
...@@ -59,14 +59,10 @@ describe 'projects/builds/show' do ...@@ -59,14 +59,10 @@ describe 'projects/builds/show' do
end end
it 'shows trigger variables in separate lines' do it 'shows trigger variables in separate lines' do
expect(rendered).to have_css('code', text: variable_regexp('TRIGGER_KEY_1', 'TRIGGER_VALUE_1')) expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_1')
expect(rendered).to have_css('code', text: variable_regexp('TRIGGER_KEY_2', 'TRIGGER_VALUE_2')) expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_2')
expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_1')
expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_2')
end end
end end
private
def variable_regexp(key, value)
/\A#{Regexp.escape("#{key}=#{value}")}\Z/
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