Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1f4be584
Unverified
Commit
1f4be584
authored
Apr 25, 2019
by
Darren Shepherd
Committed by
GitHub
Apr 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #368 from galal-hussein/skip_hidden_files
Skip any file with no yaml yml or json suffix
parents
4af06882
c42ea5ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
controller.go
pkg/deploy/controller.go
+18
-2
No files found.
pkg/deploy/controller.go
View file @
1f4be584
...
@@ -109,12 +109,11 @@ func (w *watcher) listFilesIn(base string, force bool) error {
...
@@ -109,12 +109,11 @@ func (w *watcher) listFilesIn(base string, force bool) error {
if
strings
.
HasSuffix
(
file
.
Name
(),
".skip"
)
{
if
strings
.
HasSuffix
(
file
.
Name
(),
".skip"
)
{
skips
[
strings
.
TrimSuffix
(
file
.
Name
(),
".skip"
)]
=
true
skips
[
strings
.
TrimSuffix
(
file
.
Name
(),
".skip"
)]
=
true
}
}
}
}
var
errs
[]
error
var
errs
[]
error
for
_
,
file
:=
range
files
{
for
_
,
file
:=
range
files
{
if
s
trings
.
HasSuffix
(
file
.
Name
(),
".skip"
)
||
skips
[
file
.
Name
()]
{
if
s
kipFile
(
file
.
Name
(),
skips
)
{
continue
continue
}
}
p
:=
filepath
.
Join
(
base
,
file
.
Name
())
p
:=
filepath
.
Join
(
base
,
file
.
Name
())
...
@@ -305,3 +304,20 @@ func toObjects(bytes []byte) ([]runtime.Object, error) {
...
@@ -305,3 +304,20 @@ func toObjects(bytes []byte) ([]runtime.Object, error) {
return
[]
runtime
.
Object
{
obj
},
nil
return
[]
runtime
.
Object
{
obj
},
nil
}
}
func
skipFile
(
fileName
string
,
skips
map
[
string
]
bool
)
bool
{
switch
{
case
strings
.
HasPrefix
(
fileName
,
"."
)
:
return
true
case
skips
[
fileName
]
:
return
true
case
strings
.
HasSuffix
(
fileName
,
".json"
)
:
return
false
case
strings
.
HasSuffix
(
fileName
,
".yml"
)
:
return
false
case
strings
.
HasSuffix
(
fileName
,
".yaml"
)
:
return
false
default
:
return
true
}
}
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