Commit 7e42ab6f authored by Eric Eastwood's avatar Eric Eastwood
parent 24a8dec1
......@@ -12,7 +12,7 @@ $(() => {
const $container = $(container);
$container
.find('.js-toggle-button .fa')
.find('.js-toggle-button .fa-chevron-up, .js-toggle-button .fa-chevron-down')
.toggleClass('fa-chevron-up', toggleState)
.toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined);
......@@ -22,7 +22,7 @@ $(() => {
}
$('body').on('click', '.js-toggle-button', function toggleButton(e) {
e.target.classList.toggle('open');
e.currentTarget.classList.toggle(e.currentTarget.dataset.toggleOpenClass || 'open');
toggleContainer($(this).closest('.js-toggle-container'));
const targetTag = e.currentTarget.tagName.toLowerCase();
......
......@@ -130,7 +130,7 @@ const bindEvents = () => {
$projectImportUrl.keyup(() => deriveProjectPathFromUrl($projectImportUrl));
$('.import_git').on('click', () => {
$('.js-import-git-toggle-button').on('click', () => {
const $projectMirror = $('#project_mirror');
$projectMirror.attr('disabled', !$projectMirror.attr('disabled'));
......
......@@ -47,7 +47,7 @@ class ProjectsController < Projects::ApplicationController
notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name }
)
else
render 'new', locals: { active_tab: ('import' if project_params[:import_url].present?) }
render 'new', locals: { active_tab: active_new_project_tab }
end
end
......@@ -365,6 +365,10 @@ class ProjectsController < Projects::ApplicationController
{}
end
def active_new_project_tab
project_params[:import_url].present? ? 'import' : 'blank'
end
def repo_exists?
project.repository_exists? && !project.empty_repo?
......
module ImportHelper
def has_ci_cd_only_params?
false
end
def import_project_target(owner, name)
namespace = current_user.can_create_group? ? owner : current_user.namespace_path
"#{namespace}/#{name}"
......@@ -10,6 +14,28 @@ module ImportHelper
link_to path_with_namespace, url, target: '_blank', rel: 'noopener noreferrer'
end
def import_will_timeout_message(_ci_cd_only)
timeout = time_interval_in_words(Gitlab.config.gitlab_shell.git_timeout)
_('The import will time out after %{timeout}. For repositories that take longer, use a clone/push combination.') % { timeout: timeout }
end
def import_svn_message(_ci_cd_only)
svn_link = link_to _('this document'), help_page_path('user/project/import/svn')
_('To import an SVN repository, check out %{svn_link}.').html_safe % { svn_link: svn_link }
end
def import_in_progress_title
if @project.forked?
_('Forking in progress')
else
_('Import in progress')
end
end
def import_wait_and_refresh_message
_('Please wait while we import the repository for you. Refresh at will.')
end
private
def github_project_url(path_with_namespace)
......
- visibility_level = params.dig(:project, :visibility_level) || default_project_visibility
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
.row{ id: project_name_id }
= f.hidden_field :ci_cd_only, value: ci_cd_only
.form-group.project-path.col-sm-6
= f.label :namespace_id, class: 'label-light' do
%span
......
- page_title @project.forked? ? "Forking in progress" : "Import in progress"
- page_title import_in_progress_title
.save-project-loader
.center
%h2
%i.fa.fa-spinner.fa-spin
- if @project.forked?
Forking in progress.
- else
Import in progress.
- if @project.external_import?
= import_in_progress_title
- if !has_ci_cd_only_params? && @project.external_import?
%p.monospace git clone --bare #{@project.safe_import_url}
%p Please wait while we import the repository for you. Refresh at will.
%p
= import_wait_and_refresh_message
......@@ -12,11 +12,17 @@
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4.prepend-top-0
New project
= _('New project')
%p
A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), #{link_to 'among other things', help_page_path("user/project/index.md", anchor: "projects-features"), target: '_blank'}.
- among_other_things_link = link_to _('among other things'), help_page_path("user/project/index.md", anchor: "projects-features"), target: '_blank'
= _('A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}.').html_safe % { among_other_things_link: among_other_things_link }
%p
All features are enabled when you create a project, but you can disable the ones you don’t need in the project settings.
= _('All features are enabled for blank projects, from templates, or when importing, but you can disable them afterward in the project settings.')
-# EE-specific start
- if ci_cd_projects_available?
%p
= _('To only use CI/CD features for an external repository, choose <strong>CI/CD for external repo</strong>.').html_safe
-# EE-specific end
.md
= brand_new_project_guidelines
%p
......@@ -28,36 +34,39 @@
.col-lg-9.js-toggle-container
%ul.nav-links.gitlab-tabs{ role: 'tablist' }
%li{ class: ('active' if active_tab == 'blank'), role: 'presentation' }
%li{ class: active_when(active_tab == 'blank'), role: 'presentation' }
%a{ href: '#blank-project-pane', id: 'blank-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Blank project
%span.visible-xs Blank
%li{ class: ('active' if active_tab == 'template'), role: 'presentation' }
%li{ class: active_when(active_tab == 'template'), role: 'presentation' }
%a{ href: '#create-from-template-pane', id: 'create-from-template-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Create from template
%span.visible-xs Template
%li{ class: ('active' if active_tab == 'import'), role: 'presentation' }
%li{ class: active_when(active_tab == 'import'), role: 'presentation' }
%a{ href: '#import-project-pane', id: 'import-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Import project
%span.visible-xs Import
-# EE-specific start
= render 'new_ci_cd_only_project_tab', active_tab: active_tab
-# EE-specific end
.tab-content.gitlab-tab-content
.tab-pane{ id: 'blank-project-pane', class: ('active' if active_tab == 'blank'), role: 'tabpanel' }
.tab-pane{ id: 'blank-project-pane', class: active_when(active_tab == 'blank'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
= render 'new_project_fields', f: f, project_name_id: "blank-project-name"
.tab-pane.no-padding{ id: 'create-from-template-pane', class: ('active' if active_tab == 'template'), role: 'tabpanel' }
.tab-pane.no-padding{ id: 'create-from-template-pane', class: active_when(active_tab == 'template'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
.project-template
.form-group
%div
= render 'project_templates', f: f
.tab-pane.import-project-pane{ id: 'import-project-pane', class: ('active' if active_tab == 'import'), role: 'tabpanel' }
.tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
- if import_sources_enabled?
.project-import.row
.col-sm-12
.col-lg-12
.form-group.import-btn-container.clearfix
= f.label :visibility_level, class: 'label-light' do #the label here seems wrong
Import project from
......@@ -97,7 +106,7 @@
Gitea
%div
- if git_import_enabled?
%button.btn.js-toggle-button.import_git{ type: "button" }
%button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } }
= icon('git', text: 'Repo by URL')
.col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
......@@ -105,6 +114,11 @@
= render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name"
-# EE-specific start
= render 'new_ci_cd_only_project_pane', active_tab: active_tab
-# EE-specific end
.save-project-loader.hide
.center
%h2
......
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
.form-group.import-url-data
= f.label :import_url, class: 'label-light' do
%span Git repository URL
%span
= _('Git repository URL')
= f.text_field :import_url, autocomplete: 'off', class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
= f.text_field :import_url, autocomplete: 'off', class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git', required: true
.well.prepend-top-20
%ul
%li
The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.
%li
If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.
= _('The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.').html_safe
%li
The import will time out after #{time_interval_in_words(Gitlab.config.gitlab_shell.git_timeout)}.
For repositories that take longer, use a clone/push combination.
= _('If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.').html_safe
%li
To migrate an SVN repository, check out #{link_to "this document", help_page_path('user/project/import/svn')}.
= import_will_timeout_message(ci_cd_only)
%li
The Git LFS objects will <strong>not</strong> be imported.
= import_svn_message(ci_cd_only)
%li
Once imported, repositories can be mirrored over SSH. Read more
= link_to 'here', help_page_path('/workflow/repository_mirroring.md', anchor: 'ssh-authentication')
The Git LFS objects will be ignored.
- unless ci_cd_only
%li
- ssh_link = link_to _('here'), help_page_path('/workflow/repository_mirroring.md', anchor: 'ssh-authentication')
= _('Once imported, repositories can be mirrored over SSH. Read more %{ssh_link}').html_safe % { ssh_link: ssh_link }
= render 'shared/ee/import_form', f: f
-# EE-specific start
= render 'shared/ee/import_form', f: f unless ci_cd_only
-# EE-specific end
......@@ -10,6 +10,7 @@
1. [From Perforce](perforce.md)
1. [From SVN](svn.md)
1. [From TFS](tfs.md)
1. [From repo by URL](repo_by_url.md)
In addition to the specific migration documentation above, you can import any
Git repository via HTTP from the New Project page. Be aware that if the
......
# Import project from repo by URL
You can import your existing repositories by providing the Git URL:
1. From your GitLab dashboard click **New project**
1. Switch to the **Import project** tab
1. Click on the **Repo by URL** button
1. Fill in the "Git repository URL" and the remaining project fields
1. Click **Create project** to being the import process
1. Once complete, you will be redirected to your newly created project
![Import project by repo URL](img/import_projects_from_repo_url.png)
## CI/CD for external repositories
>[Introduced][ee-4642] in [GitLab Premium][eep] 10.6.
Instead of importing the repo directly to GitLab, you can connect your
external repository to get GitLab CI/CD benefits.
This will set up [repository mirroring](../../../workflow/repository_mirroring.md) and create a stripped-down version of a project
that has issues, merge requests, container registry, wiki, and snippets disabled
but [can be re-enabled later on](../settings/index.md#sharing-and-permissions).
1. From your GitLab dashboard click **New project**
1. Switch to the **CI/CD for external repo** tab
1. Follow the same import project steps (see above)
[ee-4642]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4642
[eep]: https://about.gitlab.com/products/
......@@ -35,5 +35,10 @@ module EE
custom_params[:ci_cd_only] = ci_cd_param if ci_cd_param == 'true'
custom_params
end
override :active_new_project_tab
def active_new_project_tab
project_params[:ci_cd_only] == 'true' ? 'ci_cd_only' : super
end
end
end
module EE
module ImportHelper
extend ::Gitlab::Utils::Override
override :has_ci_cd_only_params?
def has_ci_cd_only_params?
params[:ci_cd_only].present?
end
override :import_will_timeout_message
def import_will_timeout_message(ci_cd_only)
if ci_cd_only
timeout = time_interval_in_words(::Gitlab.config.gitlab_shell.git_timeout)
_('The connection will time out after %{timeout}. For repositories that take longer, use a clone/push combination.') % { timeout: timeout }
else
super
end
end
override :import_svn_message
def import_svn_message(ci_cd_only)
if ci_cd_only
svn_link = link_to _('this document'), help_page_path('user/project/import/svn')
_('To connect an SVN repository, check out %{svn_link}.').html_safe % { svn_link: svn_link }
else
super
end
end
override :import_in_progress_title
def import_in_progress_title
if has_ci_cd_only_params?
_('Connecting...')
else
super
end
end
override :import_wait_and_refresh_message
def import_wait_and_refresh_message
if has_ci_cd_only_params?
_('Please wait while we connect to your repository. Refresh at will.')
else
super
end
end
end
end
......@@ -15,5 +15,9 @@ module EE
"default label `%{default_label}` will be used."
) % { default_label: default_label }
end
def ci_cd_projects_available?
::License.feature_available?(:ci_cd_projects) && import_sources_enabled?
end
end
end
- return unless ci_cd_projects_available?
.tab-pane.js-toggle-container{ id: 'ci-cd-project-pane', class: active_when(active_tab == 'ci_cd_only'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f|
.project-import.row
.col-lg-12
%h4
= _('Run CI/CD pipelines for external repositories')
%p
= _('Connect your external repositories, and CI/CD pipelines will run for new commits. A GitLab project will be created with only CI/CD features enabled.')
.form-group.import-btn-container.prepend-top-20.clearfix
= f.label :visibility_level, class: 'label-light' do
= s_('ImportButtons|Connect repositories from')
.import-buttons
%div
- if git_import_enabled?
%button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } }
= icon('git', text: _('Repo by URL'))
.col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'ci_cd_only') }
%hr
= render "shared/import_form", f: f, ci_cd_only: true
= render 'new_project_fields', f: f, project_name_id: "import-url-name", ci_cd_only: true
- return unless ci_cd_projects_available?
%li{ class: active_when(active_tab == 'ci_cd_only'), role: 'presentation' }
%a{ href: '#ci-cd-project-pane', id: 'ci-cd-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs
= _('CI/CD for external repo')
%span.visible-xs
= _('CI/CD')
---
title: Add CI/CD for external repositories
merge_request: 4642
author:
type: added
......@@ -16,7 +16,7 @@ feature 'New project' do
it 'shows mirror repository checkbox enabled', :js do
visit new_project_path
find('#import-project-tab').click
first('.import_git').click
first('.js-import-git-toggle-button').click
expect(page).to have_unchecked_field('Mirror repository', disabled: false)
end
......@@ -29,10 +29,59 @@ feature 'New project' do
it 'does not show mirror repository option' do
visit new_project_path
first('.import_git').click
first('.js-import-git-toggle-button').click
expect(page).not_to have_content('Mirror repository')
end
end
end
context 'CI/CD for external repositories', :js do
context 'when licensed' do
before do
stub_licensed_features(ci_cd_projects: true)
end
it 'shows CI/CD tab' do
visit new_project_path
expect(page).to have_css('#ci-cd-project-tab')
find('#ci-cd-project-tab').click
expect(page).to have_css('#ci-cd-project-pane')
end
it 'creates CI/CD project from repo URL' do
visit new_project_path
find('#ci-cd-project-tab').click
page.within '#ci-cd-project-pane' do
find('.js-import-git-toggle-button').click
fill_in 'project_import_url', with: 'http://foo.git'
fill_in 'project_path', with: 'ci-cd-project1'
choose 'project_visibility_level_20'
click_button 'Create project'
created_project = Project.last
expect(current_path).to eq(project_path(created_project))
expect(created_project.mirror).to eq(true)
expect(created_project.project_feature).not_to be_issues_enabled
end
end
end
context 'when unlicensed' do
before do
stub_licensed_features(ci_cd_projects: false)
end
it 'does not show CI/CD only tab' do
visit new_project_path
expect(page).not_to have_css('#ci-cd-project-tab')
end
end
end
end
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-02 13:39+0100\n"
"PO-Revision-Date: 2018-03-02 13:39+0100\n"
"POT-Creation-Date: 2018-03-05 14:09-0600\n"
"PO-Revision-Date: 2018-03-05 14:09-0600\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
......@@ -108,6 +108,9 @@ msgstr ""
msgid "A collection of graphs regarding Continuous Integration"
msgstr ""
msgid "A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}."
msgstr ""
msgid "About auto deploy"
msgstr ""
......@@ -219,6 +222,9 @@ msgstr ""
msgid "All changes are committed"
msgstr ""
msgid "All features are enabled for blank projects, from templates, or when importing, but you can disable them afterward in the project settings."
msgstr ""
msgid "Allows you to add and manage Kubernetes clusters."
msgstr ""
......@@ -300,6 +306,9 @@ msgstr ""
msgid "An error occurred. Please try again."
msgstr ""
msgid "Any Label"
msgstr ""
msgid "Appearance"
msgstr ""
......@@ -596,9 +605,15 @@ msgstr ""
msgid "CI / CD"
msgstr ""
msgid "CI/CD"
msgstr ""
msgid "CI/CD configuration"
msgstr ""
msgid "CI/CD for external repo"
msgstr ""
msgid "CICD|Jobs"
msgstr ""
......@@ -1158,6 +1173,12 @@ msgstr ""
msgid "Confidentiality"
msgstr ""
msgid "Connect your external repositories, and CI/CD pipelines will run for new commits. A GitLab project will be created with only CI/CD features enabled."
msgstr ""
msgid "Connecting..."
msgstr ""
msgid "Container Registry"
msgstr ""
......@@ -1672,6 +1693,9 @@ msgstr ""
msgid "ForkedFromProjectPath|Forked from %{project_name} (deleted)"
msgstr ""
msgid "Forking in progress"
msgstr ""
msgid "Format"
msgstr ""
......@@ -1804,6 +1828,9 @@ msgstr ""
msgid "Geo|Shards to synchronize"
msgstr ""
msgid "Git repository URL"
msgstr ""
msgid "Git revision"
msgstr ""
......@@ -1819,6 +1846,9 @@ msgstr ""
msgid "Gitaly Servers"
msgstr ""
msgid "Go back"
msgstr ""
msgid "Go to your fork"
msgstr ""
......@@ -1950,9 +1980,18 @@ msgstr ""
msgid "If you already have files you can push them using the %{link_to_cli} below."
msgstr ""
msgid "If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>."
msgstr ""
msgid "Import in progress"
msgstr ""
msgid "Import repository"
msgstr ""
msgid "ImportButtons|Connect repositories from"
msgstr ""
msgid "Improve Issue boards with GitLab Enterprise Edition."
msgstr ""
......@@ -2060,6 +2099,15 @@ msgstr ""
msgid "LFSStatus|Enabled"
msgstr ""
msgid "Label"
msgstr ""
msgid "LabelSelect|%{firstLabelName} +%{remainingLabelCount} more"
msgstr ""
msgid "LabelSelect|%{labelsString}, and %{remainingLabelCount} more"
msgstr ""
msgid "Labels"
msgstr ""
......@@ -2427,6 +2475,9 @@ msgstr ""
msgid "OfSearchInADropdown|Filter"
msgstr ""
msgid "Once imported, repositories can be mirrored over SSH. Read more %{ssh_link}"
msgstr ""
msgid "Only project members can comment."
msgstr ""
......@@ -2592,6 +2643,12 @@ msgstr ""
msgid "Please solve the reCAPTCHA"
msgstr ""
msgid "Please wait while we connect to your repository. Refresh at will."
msgstr ""
msgid "Please wait while we import the repository for you. Refresh at will."
msgstr ""
msgid "Preferences"
msgstr ""
......@@ -2910,6 +2967,9 @@ msgstr ""
msgid "Repair authentication"
msgstr ""
msgid "Repo by URL"
msgstr ""
msgid "Repository"
msgstr ""
......@@ -2945,6 +3005,9 @@ msgstr ""
msgid "Roadmap"
msgstr ""
msgid "Run CI/CD pipelines for external repositories"
msgstr ""
msgid "SSH Keys"
msgstr ""
......@@ -2969,6 +3032,9 @@ msgstr ""
msgid "Scoped issue boards"
msgstr ""
msgid "Search"
msgstr ""
msgid "Search branches and tags"
msgstr ""
......@@ -3369,9 +3435,15 @@ msgstr ""
msgid "The collection of events added to the data gathered for that stage."
msgstr ""
msgid "The connection will time out after %{timeout}. For repositories that take longer, use a clone/push combination."
msgstr ""
msgid "The fork relationship has been removed."
msgstr ""
msgid "The import will time out after %{timeout}. For repositories that take longer, use a clone/push combination."
msgstr ""
msgid "The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage."
msgstr ""
......@@ -3405,6 +3477,9 @@ msgstr ""
msgid "The repository for this project is empty"
msgstr ""
msgid "The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>."
msgstr ""
msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request."
msgstr ""
......@@ -3682,6 +3757,15 @@ msgstr ""
msgid "Title"
msgstr ""
msgid "To connect an SVN repository, check out %{svn_link}."
msgstr ""
msgid "To import an SVN repository, check out %{svn_link}."
msgstr ""
msgid "To only use CI/CD features for an external repository, choose <strong>CI/CD for external repo</strong>."
msgstr ""
msgid "To view the roadmap, add a planned start or finish date to one of your epics in this group or its subgroups. Only epics in the past 3 months and the next 3 months are shown."
msgstr ""
......@@ -4051,6 +4135,9 @@ msgstr ""
msgid "Your projects"
msgstr ""
msgid "among other things"
msgstr ""
msgid "assign yourself"
msgstr ""
......@@ -4137,6 +4224,9 @@ msgstr[1] ""
msgid "estimateCommand|%{slash_command} will update the estimated time with the latest command."
msgstr ""
msgid "here"
msgstr ""
msgid "is invalid because there is downstream lock"
msgstr ""
......@@ -4339,6 +4429,9 @@ msgstr ""
msgid "spendCommand|%{slash_command} will update the sum of the time spent."
msgstr ""
msgid "this document"
msgstr ""
msgid "to help your contributors communicate effectively!"
msgstr ""
......
......@@ -142,7 +142,7 @@ feature 'New project' do
context 'from git repository url, "Repo by URL"' do
before do
first('.import_git').click
first('.js-import-git-toggle-button').click
end
it 'does not autocomplete sensitive git repo URL' do
......
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