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
c42ea5ec
Commit
c42ea5ec
authored
Apr 18, 2019
by
galal-hussein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip any file with no yaml yml or json suffix
parent
334efc74
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 @
c42ea5ec
...
...
@@ -109,12 +109,11 @@ func (w *watcher) listFilesIn(base string, force bool) error {
if
strings
.
HasSuffix
(
file
.
Name
(),
".skip"
)
{
skips
[
strings
.
TrimSuffix
(
file
.
Name
(),
".skip"
)]
=
true
}
}
var
errs
[]
error
for
_
,
file
:=
range
files
{
if
s
trings
.
HasSuffix
(
file
.
Name
(),
".skip"
)
||
skips
[
file
.
Name
()]
{
if
s
kipFile
(
file
.
Name
(),
skips
)
{
continue
}
p
:=
filepath
.
Join
(
base
,
file
.
Name
())
...
...
@@ -305,3 +304,20 @@ func toObjects(bytes []byte) ([]runtime.Object, error) {
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