Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
1105 Внедрение механизмов обеспечения безопасности цепочки поставки программных проектов
Legacy
scanned-projects
helm
Commits
1cf197d6
Commit
1cf197d6
authored
8 years ago
by
Anubhav Mishra
Committed by
GitHub
8 years ago
Browse files
Options
Download
Patches
Plain Diff
fix(helm): fix comments and removed unwanted split
parent
837da936
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/releaseutil/manifest.go
+5
-5
pkg/releaseutil/manifest.go
with
5 additions
and
5 deletions
+5
-5
pkg/releaseutil/manifest.go
+
5
−
5
View file @
1cf197d6
...
@@ -32,19 +32,19 @@ type SimpleHead struct {
...
@@ -32,19 +32,19 @@ type SimpleHead struct {
}
`json:"metadata,omitempty"`
}
`json:"metadata,omitempty"`
}
}
var
sep
=
regexp
.
MustCompile
(
"(?:^|
\\
s*
\n
)---
\\
s*"
)
// SplitManifests takes a string of manifest and returns a map contains individual manifests
// SplitManifests takes a string of manifest and returns a map contains individual manifests
func
SplitManifests
(
bigfile
string
)
map
[
string
]
string
{
func
SplitManifests
(
bigfile
string
)
map
[
string
]
string
{
// This is not the best way of doing things, but it's how k8s itself does it.
// This is not the best way of doing things, but it's how k8s itself does it.
// Basically, we're quickly splitting a stream of YAML documents into an
// Basically, we're quickly splitting a stream of YAML documents into an
// array of YAML docs. In the current implementation, the file name is just
// array of YAML docs. In the current implementation, the file name is just
// a place holder, and doesn't have any further meaning.
// a place holder, and doesn't have any further meaning.
sep
:=
regexp
.
MustCompile
(
"(?:^|
\\
s*
\n
)---
\\
s*"
)
tpl
:=
"manifest-%d"
tpl
:=
"manifest-%d"
res
:=
map
[
string
]
string
{}
res
:=
map
[
string
]
string
{}
// Making sure YAML formatting doesn't matter when generating manifest from string.
// Making sure that any extra whitespace in YAML stream doesn't interfere in splitting documents correctly.
bigFileTmp
:=
strings
.
TrimSpace
(
bigfile
)
docs
:=
sep
.
Split
(
bigfile
,
-
1
)
tmp
:=
sep
.
Split
(
bigFileTmp
,
-
1
)
for
i
,
d
:=
range
docs
{
for
i
,
d
:=
range
tmp
{
res
[
fmt
.
Sprintf
(
tpl
,
i
)]
=
d
res
[
fmt
.
Sprintf
(
tpl
,
i
)]
=
d
}
}
return
res
return
res
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets