BigW Consortium Gitlab

Commit 2e87923d by Robert Speicher

Merge branch 'ce-3839-ci-cd-only-projects-fe' into 'master'

Create CI/CD-only projects by URL -- CE backport See merge request gitlab-org/gitlab-ce!17342
parents 4ac0a4bf 32d12134
...@@ -12,7 +12,7 @@ $(() => { ...@@ -12,7 +12,7 @@ $(() => {
const $container = $(container); const $container = $(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-up', toggleState)
.toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined); .toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined);
...@@ -22,7 +22,7 @@ $(() => { ...@@ -22,7 +22,7 @@ $(() => {
} }
$('body').on('click', '.js-toggle-button', function toggleButton(e) { $('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')); toggleContainer($(this).closest('.js-toggle-container'));
const targetTag = e.currentTarget.tagName.toLowerCase(); const targetTag = e.currentTarget.tagName.toLowerCase();
......
...@@ -41,11 +41,11 @@ class ProjectsController < Projects::ApplicationController ...@@ -41,11 +41,11 @@ class ProjectsController < Projects::ApplicationController
cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) } cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) }
redirect_to( redirect_to(
project_path(@project), project_path(@project, custom_import_params),
notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name } notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name }
) )
else else
render 'new', locals: { active_tab: ('import' if project_params[:import_url].present?) } render 'new', locals: { active_tab: active_new_project_tab }
end end
end end
...@@ -103,7 +103,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -103,7 +103,7 @@ class ProjectsController < Projects::ApplicationController
def show def show
if @project.import_in_progress? if @project.import_in_progress?
redirect_to project_import_path(@project) redirect_to project_import_path(@project, custom_import_params)
return return
end end
...@@ -359,6 +359,14 @@ class ProjectsController < Projects::ApplicationController ...@@ -359,6 +359,14 @@ class ProjectsController < Projects::ApplicationController
] ]
end end
def custom_import_params
{}
end
def active_new_project_tab
project_params[:import_url].present? ? 'import' : 'blank'
end
def repo_exists? def repo_exists?
project.repository_exists? && !project.empty_repo? project.repository_exists? && !project.empty_repo?
......
module ImportHelper module ImportHelper
def has_ci_cd_only_params?
false
end
def import_project_target(owner, name) def import_project_target(owner, name)
namespace = current_user.can_create_group? ? owner : current_user.namespace_path namespace = current_user.can_create_group? ? owner : current_user.namespace_path
"#{namespace}/#{name}" "#{namespace}/#{name}"
...@@ -10,6 +14,28 @@ module ImportHelper ...@@ -10,6 +14,28 @@ module ImportHelper
link_to full_path, url, target: '_blank', rel: 'noopener noreferrer' link_to full_path, url, target: '_blank', rel: 'noopener noreferrer'
end 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 private
def github_project_url(full_path) def github_project_url(full_path)
......
- visibility_level = params.dig(:project, :visibility_level) || default_project_visibility - 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 } .row{ id: project_name_id }
= f.hidden_field :ci_cd_only, value: ci_cd_only
.form-group.project-path.col-sm-6 .form-group.project-path.col-sm-6
= f.label :namespace_id, class: 'label-light' do = f.label :namespace_id, class: 'label-light' do
%span %span
......
- page_title @project.forked? ? "Forking in progress" : "Import in progress" - page_title import_in_progress_title
.save-project-loader .save-project-loader
.center .center
%h2 %h2
%i.fa.fa-spinner.fa-spin %i.fa.fa-spinner.fa-spin
- if @project.forked? = import_in_progress_title
Forking in progress. - if !has_ci_cd_only_params? && @project.external_import?
- else
Import in progress.
- if @project.external_import?
%p.monospace git clone --bare #{@project.safe_import_url} %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,14 @@ ...@@ -12,11 +12,14 @@
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
%h4.prepend-top-0 %h4.prepend-top-0
New project = _('New project')
%p %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 %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
-# EE-specific end
.md .md
= brand_new_project_guidelines = brand_new_project_guidelines
%p %p
...@@ -28,36 +31,38 @@ ...@@ -28,36 +31,38 @@
.col-lg-9.js-toggle-container .col-lg-9.js-toggle-container
%ul.nav-links.gitlab-tabs{ role: 'tablist' } %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' } %a{ href: '#blank-project-pane', id: 'blank-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Blank project %span.hidden-xs Blank project
%span.visible-xs Blank %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' } %a{ href: '#create-from-template-pane', id: 'create-from-template-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Create from template %span.hidden-xs Create from template
%span.visible-xs 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' } %a{ href: '#import-project-pane', id: 'import-project-tab', data: { toggle: 'tab' }, role: 'tab' }
%span.hidden-xs Import project %span.hidden-xs Import project
%span.visible-xs Import %span.visible-xs Import
-# EE-specific start
-# EE-specific end
.tab-content.gitlab-tab-content .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| = form_for @project, html: { class: 'new_project' } do |f|
= render 'new_project_fields', f: f, project_name_id: "blank-project-name" = 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| = form_for @project, html: { class: 'new_project' } do |f|
.project-template .project-template
.form-group .form-group
%div %div
= render 'project_templates', f: f = 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| = form_for @project, html: { class: 'new_project' } do |f|
- if import_sources_enabled? - if import_sources_enabled?
.project-import.row .project-import.row
.col-sm-12 .col-lg-12
.form-group.import-btn-container.clearfix .form-group.import-btn-container.clearfix
= f.label :visibility_level, class: 'label-light' do #the label here seems wrong = f.label :visibility_level, class: 'label-light' do #the label here seems wrong
Import project from Import project from
...@@ -97,7 +102,7 @@ ...@@ -97,7 +102,7 @@
Gitea Gitea
%div %div
- if git_import_enabled? - 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') = icon('git', text: 'Repo by URL')
.col-lg-12 .col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') } .js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
...@@ -105,6 +110,10 @@ ...@@ -105,6 +110,10 @@
= render "shared/import_form", f: f = render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name" = render 'new_project_fields', f: f, project_name_id: "import-url-name"
-# EE-specific start
-# EE-specific end
.save-project-loader.hide .save-project-loader.hide
.center .center
%h2 %h2
......
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
.form-group.import-url-data .form-group.import-url-data
= f.label :import_url, class: 'label-light' do = 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 .well.prepend-top-20
%ul %ul
%li %li
The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>. = _('The repository must be accessible over <code>http://</code>, <code>https://</code> or <code>git://</code>.').html_safe
%li %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>. = _('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 %li
The import will time out after #{time_interval_in_words(Gitlab.config.gitlab_shell.git_timeout)}. = import_will_timeout_message(ci_cd_only)
For repositories that take longer, use a clone/push combination.
%li %li
To migrate an SVN repository, check out #{link_to "this document", help_page_path('user/project/import/svn')}. = import_svn_message(ci_cd_only)
-# EE-specific start
-# EE-specific end
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
1. [From Perforce](perforce.md) 1. [From Perforce](perforce.md)
1. [From SVN](svn.md) 1. [From SVN](svn.md)
1. [From TFS](tfs.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 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 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)
...@@ -8,8 +8,8 @@ msgid "" ...@@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-01 18:03+0100\n" "POT-Creation-Date: 2018-03-05 13:02-0600\n"
"PO-Revision-Date: 2018-03-01 18:03+0100\n" "PO-Revision-Date: 2018-03-05 13:02-0600\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -102,6 +102,9 @@ msgstr "" ...@@ -102,6 +102,9 @@ msgstr ""
msgid "A collection of graphs regarding Continuous Integration" msgid "A collection of graphs regarding Continuous Integration"
msgstr "" 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" msgid "About auto deploy"
msgstr "" msgstr ""
...@@ -201,6 +204,9 @@ msgstr "" ...@@ -201,6 +204,9 @@ msgstr ""
msgid "All" msgid "All"
msgstr "" 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." msgid "Allows you to add and manage Kubernetes clusters."
msgstr "" msgstr ""
...@@ -698,6 +704,9 @@ msgstr "" ...@@ -698,6 +704,9 @@ msgstr ""
msgid "ClusterIntegration|Copy CA Certificate" msgid "ClusterIntegration|Copy CA Certificate"
msgstr "" msgstr ""
msgid "ClusterIntegration|Copy Ingress IP Address to clipboard"
msgstr ""
msgid "ClusterIntegration|Copy Kubernetes cluster name" msgid "ClusterIntegration|Copy Kubernetes cluster name"
msgstr "" msgstr ""
...@@ -746,6 +755,9 @@ msgstr "" ...@@ -746,6 +755,9 @@ msgstr ""
msgid "ClusterIntegration|Ingress" msgid "ClusterIntegration|Ingress"
msgstr "" msgstr ""
msgid "ClusterIntegration|Ingress IP Address"
msgstr ""
msgid "ClusterIntegration|Install" msgid "ClusterIntegration|Install"
msgstr "" msgstr ""
...@@ -1444,6 +1456,9 @@ msgstr "" ...@@ -1444,6 +1456,9 @@ msgstr ""
msgid "ForkedFromProjectPath|Forked from %{project_name} (deleted)" msgid "ForkedFromProjectPath|Forked from %{project_name} (deleted)"
msgstr "" msgstr ""
msgid "Forking in progress"
msgstr ""
msgid "Format" msgid "Format"
msgstr "" msgstr ""
...@@ -1462,6 +1477,9 @@ msgstr "" ...@@ -1462,6 +1477,9 @@ msgstr ""
msgid "Generate a default set of labels" msgid "Generate a default set of labels"
msgstr "" msgstr ""
msgid "Git repository URL"
msgstr ""
msgid "Git revision" msgid "Git revision"
msgstr "" msgstr ""
...@@ -1587,6 +1605,12 @@ msgstr "" ...@@ -1587,6 +1605,12 @@ msgstr ""
msgid "If you already have files you can push them using the %{link_to_cli} below." msgid "If you already have files you can push them using the %{link_to_cli} below."
msgstr "" 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" msgid "Import repository"
msgstr "" msgstr ""
...@@ -1823,6 +1847,9 @@ msgstr "" ...@@ -1823,6 +1847,9 @@ msgstr ""
msgid "Monitoring" msgid "Monitoring"
msgstr "" msgstr ""
msgid "More information"
msgstr ""
msgid "More information is available|here" msgid "More information is available|here"
msgstr "" msgstr ""
...@@ -2164,6 +2191,9 @@ msgstr "" ...@@ -2164,6 +2191,9 @@ msgstr ""
msgid "Please solve the reCAPTCHA" msgid "Please solve the reCAPTCHA"
msgstr "" msgstr ""
msgid "Please wait while we import the repository for you. Refresh at will."
msgstr ""
msgid "Preferences" msgid "Preferences"
msgstr "" msgstr ""
...@@ -2520,6 +2550,9 @@ msgstr "" ...@@ -2520,6 +2550,9 @@ msgstr ""
msgid "Select target branch" msgid "Select target branch"
msgstr "" msgstr ""
msgid "Send email"
msgstr ""
msgid "Sep" msgid "Sep"
msgstr "" msgstr ""
...@@ -2833,6 +2866,9 @@ msgstr "" ...@@ -2833,6 +2866,9 @@ msgstr ""
msgid "The fork relationship has been removed." msgid "The fork relationship has been removed."
msgstr "" 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." 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 "" msgstr ""
...@@ -2866,6 +2902,9 @@ msgstr "" ...@@ -2866,6 +2902,9 @@ msgstr ""
msgid "The repository for this project is empty" msgid "The repository for this project is empty"
msgstr "" 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." 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 "" msgstr ""
...@@ -3131,6 +3170,9 @@ msgstr "" ...@@ -3131,6 +3170,9 @@ msgstr ""
msgid "Tip:" msgid "Tip:"
msgstr "" msgstr ""
msgid "To import an SVN repository, check out %{svn_link}."
msgstr ""
msgid "Todo" msgid "Todo"
msgstr "" msgstr ""
...@@ -3437,6 +3479,9 @@ msgstr "" ...@@ -3437,6 +3479,9 @@ msgstr ""
msgid "Your projects" msgid "Your projects"
msgstr "" msgstr ""
msgid "among other things"
msgstr ""
msgid "assign yourself" msgid "assign yourself"
msgstr "" msgstr ""
...@@ -3632,6 +3677,9 @@ msgstr "" ...@@ -3632,6 +3677,9 @@ msgstr ""
msgid "spendCommand|%{slash_command} will update the sum of the time spent." msgid "spendCommand|%{slash_command} will update the sum of the time spent."
msgstr "" msgstr ""
msgid "this document"
msgstr ""
msgid "username" msgid "username"
msgstr "" msgstr ""
......
...@@ -142,7 +142,7 @@ feature 'New project' do ...@@ -142,7 +142,7 @@ feature 'New project' do
context 'from git repository url, "Repo by URL"' do context 'from git repository url, "Repo by URL"' do
before do before do
first('.import_git').click first('.js-import-git-toggle-button').click
end end
it 'does not autocomplete sensitive git repo URL' do 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