Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
6970c1f3
Commit
6970c1f3
authored
Nov 02, 2016
by
Kamil Trzcinski
Committed by
Luke "Jared" Bennett
Nov 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to use Dockerfile templates
parent
35142a09
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
93 additions
and
7 deletions
+93
-7
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+5
-0
app/assets/javascripts/blob/blob_ci_yaml.js.es6
app/assets/javascripts/blob/blob_ci_yaml.js.es6
+36
-0
app/assets/javascripts/blob_edit/edit_blob.js
app/assets/javascripts/blob_edit/edit_blob.js
+3
-0
app/assets/stylesheets/pages/editor.scss
app/assets/stylesheets/pages/editor.scss
+4
-2
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+4
-0
app/views/projects/blob/_editor.html.haml
app/views/projects/blob/_editor.html.haml
+2
-0
lib/api/templates.rb
lib/api/templates.rb
+6
-5
lib/gitlab/template/dockerfile_template.rb
lib/gitlab/template/dockerfile_template.rb
+30
-0
vendor/dockerfile/HTTPdDockerfile
vendor/dockerfile/HTTPdDockerfile
+3
-0
No files found.
app/assets/javascripts/api.js
View file @
6970c1f3
...
...
@@ -10,6 +10,7 @@
licensePath
:
"
/api/:version/templates/licenses/:key
"
,
gitignorePath
:
"
/api/:version/templates/gitignores/:key
"
,
gitlabCiYmlPath
:
"
/api/:version/templates/gitlab_ci_ymls/:key
"
,
dockerfilePath
:
"
/api/:version/dockerfiles/:key
"
,
issuableTemplatePath
:
"
/:namespace_path/:project_path/templates/:type/:key
"
,
group
:
function
(
group_id
,
callback
)
{
var
url
=
Api
.
buildUrl
(
Api
.
groupPath
)
...
...
@@ -119,6 +120,10 @@
return
callback
(
file
);
});
},
dockerfileYml
:
function
(
key
,
callback
)
{
var
url
=
Api
.
buildUrl
(
Api
.
dockerfilePath
).
replace
(
'
:key
'
,
key
);
$
.
get
(
url
,
callback
);
},
issueTemplate
:
function
(
namespacePath
,
projectPath
,
key
,
type
,
callback
)
{
var
url
=
Api
.
buildUrl
(
Api
.
issuableTemplatePath
)
.
replace
(
'
:key
'
,
key
)
...
...
app/assets/javascripts/blob/blob_ci_yaml.js.es6
View file @
6970c1f3
...
...
@@ -38,4 +38,40 @@
global.BlobCiYamlSelectors = BlobCiYamlSelectors;
class BlobDockerfileSelector extends gl.TemplateSelector {
requestFile(query) {
return Api.dockerfileYml(query.name, this.requestFileSuccess.bind(this));
}
requestFileSuccess(file) {
return super.requestFileSuccess(file);
}
}
global.BlobDockerfileSelector = BlobDockerfileSelector;
class BlobDockerfileSelectors {
constructor({ editor, $dropdowns } = {}) {
this.editor = editor;
this.$dropdowns = $dropdowns || $('.js-dockerfile-selector');
this.initSelectors();
}
initSelectors() {
const editor = this.editor;
this.$dropdowns.each((i, dropdown) => {
const $dropdown = $(dropdown);
return new BlobDockerfileSelector({
editor,
pattern: /(Dockerfile)/,
data: $dropdown.data('data'),
wrapper: $dropdown.closest('.js-dockerfile-selector-wrap'),
dropdown: $dropdown
});
});
}
}
global.BlobDockerfileSelectors = BlobDockerfileSelectors;
})(window.gl || (window.gl = {}));
app/assets/javascripts/blob_edit/edit_blob.js
View file @
6970c1f3
...
...
@@ -33,6 +33,9 @@
new
gl
.
BlobCiYamlSelectors
({
editor
:
this
.
editor
});
new
gl
.
BlobDockerfileSelectors
({
editor
:
this
.
editor
});
}
EditBlob
.
prototype
.
initModePanesAndLinks
=
function
()
{
...
...
app/assets/stylesheets/pages/editor.scss
View file @
6970c1f3
...
...
@@ -67,7 +67,8 @@
.soft-wrap-toggle
,
.license-selector
,
.gitignore-selector
,
.gitlab-ci-yml-selector
{
.gitlab-ci-yml-selector
,
.dockerfile-selector
{
display
:
inline-block
;
vertical-align
:
top
;
font-family
:
$regular_font
;
...
...
@@ -97,7 +98,8 @@
.gitignore-selector
,
.license-selector
,
.gitlab-ci-yml-selector
{
.gitlab-ci-yml-selector
,
.dockerfile-selector
{
.dropdown
{
line-height
:
21px
;
}
...
...
app/helpers/blob_helper.rb
View file @
6970c1f3
...
...
@@ -191,6 +191,10 @@ module BlobHelper
@gitlab_ci_ymls
||=
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
dropdown_names
end
def
dockerfile_names
@dockerfile_names
||=
Gitlab
::
Template
::
DockerfileTemplate
.
dropdown_names
end
def
blob_editor_paths
{
'relative-url-root'
=>
Rails
.
application
.
config
.
relative_url_root
,
...
...
app/views/projects/blob/_editor.html.haml
View file @
6970c1f3
...
...
@@ -21,6 +21,8 @@
=
dropdown_tag
(
"Choose a .gitignore template"
,
options:
{
toggle_class:
'btn js-gitignore-selector'
,
title:
"Choose a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitignore_names
}
}
)
.gitlab-ci-yml-selector.js-gitlab-ci-yml-selector-wrap.hidden
=
dropdown_tag
(
"Choose a GitLab CI Yaml template"
,
options:
{
toggle_class:
'btn js-gitlab-ci-yml-selector'
,
title:
"Choose a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitlab_ci_ymls
}
}
)
.gitlab-ci-yml-selector.js-dockerfile-selector-wrap.hidden
=
dropdown_tag
(
"Choose a Dockerfile template"
,
options:
{
toggle_class:
'js-dockerfile-selector'
,
title:
"Choose a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
dockerfile_names
}
}
)
=
button_tag
class:
'soft-wrap-toggle btn'
,
type:
'button'
do
%span
.no-wrap
=
custom_icon
(
'icon_no_wrap'
)
...
...
lib/api/templates.rb
View file @
6970c1f3
...
...
@@ -8,7 +8,8 @@ module API
gitlab_ci_ymls:
{
klass:
Gitlab
::
Template
::
GitlabCiYmlTemplate
,
gitlab_version:
8.9
}
},
dockerfiles:
Gitlab
::
Template
::
DockerfileTemplate
}.
freeze
PROJECT_TEMPLATE_REGEX
=
/[\<\{\[]
...
...
lib/gitlab/template/dockerfile_template.rb
0 → 100644
View file @
6970c1f3
module Gitlab
module Template
class DockerfileTemplate < BaseTemplate
def content
explanation = "# This file is a template, and might need editing before it works on your project."
[explanation, super].join("\n")
end
class << self
def extension
'Dockerfile'
end
def categories
{
"General" => ''
}
end
def base_dir
Rails.root.join('vendor/dockerfile')
end
def finder(project = nil)
Gitlab::Template::Finders::GlobalTemplateFinder.new(self.base_dir, self.extension, self.categories)
end
end
end
end
end
vendor/dockerfile/HTTPdDockerfile
0 → 100644
View file @
6970c1f3
FROM httpd:alpine
COPY ./ /usr/local/apache2/htdocs/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment