Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
beaver
Commits
e6d2d49e5342
Commit
e6d2d49e5342
authored
1 year ago
by
Steeven Herlant
Browse files
Options
Downloads
Patches
Plain Diff
feat: disabled keyword in charts can now be a variable
parent
2512605560fe
No related branches found
Branches containing commit
Tags
3.2.2
Tags containing commit
No related merge requests found
Pipeline
#68336
failed
1 year ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
runner/cmd_config.go
+6
-5
6 additions, 5 deletions
runner/cmd_config.go
runner/config.go
+2
-1
2 additions, 1 deletion
runner/config.go
runner/main.go
+27
-1
27 additions, 1 deletion
runner/main.go
with
35 additions
and
7 deletions
runner/cmd_config.go
+
6
−
5
View file @
e6d2d49e
...
...
@@ -267,11 +267,12 @@
type
CmdCharts
map
[
string
]
CmdChart
type
CmdChart
struct
{
Type
string
Path
string
Name
string
Namespace
string
Disabled
bool
Type
string
Path
string
Name
string
Namespace
string
// Must be castable into bool (0,1,true,false)
Disabled
string
ValuesFileNames
[]
string
}
...
...
This diff is collapsed.
Click to expand it.
runner/config.go
+
2
−
1
View file @
e6d2d49e
...
...
@@ -31,7 +31,8 @@
Namespace
string
// Disabled: disable this chart
// This can be useful when inheriting the chart
Disabled
bool
// must be castable to bool (0,1,true,false)
Disabled
string
}
// Arg define command line arguments
...
...
This diff is collapsed.
Click to expand it.
runner/main.go
+
27
−
1
View file @
e6d2d49e
...
...
@@ -52,6 +52,15 @@
outputDir
=
r
.
config
.
Output
}
for
name
:=
range
r
.
config
.
Spec
.
Charts
{
w
:=
bytes
.
NewBuffer
([]
byte
{})
if
err
:=
hydrateString
(
r
.
config
.
Spec
.
Charts
[
name
]
.
Disabled
,
w
,
variables
);
err
!=
nil
{
return
err
}
chart
:=
r
.
config
.
Spec
.
Charts
[
name
]
chart
.
Disabled
=
w
.
String
()
r
.
config
.
Spec
.
Charts
[
name
]
=
chart
}
preBuildDir
:=
filepath
.
Join
(
tmpDir
,
"pre-build"
)
if
err
:=
r
.
DoBuild
(
tmpDir
,
preBuildDir
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to do pre-build: %w"
,
err
)
...
...
@@ -216,8 +225,21 @@
return
input
,
nil
}
func
toBool
(
s
string
)
(
bool
,
error
)
{
sLower
:=
strings
.
ToLower
(
s
)
finalString
:=
strings
.
TrimSuffix
(
sLower
,
"
\n
"
)
switch
finalString
{
case
"0"
,
"false"
,
""
:
return
false
,
nil
case
"1"
,
"true"
:
return
true
,
nil
default
:
return
false
,
errors
.
New
(
"cannot parse "
+
s
+
" as bool"
)
}
}
func
(
r
*
Runner
)
prepareCmds
()
(
map
[
string
]
*
cmd
.
Cmd
,
error
)
{
// create helm commands
// create ytt chart commands
cmds
:=
make
(
map
[
string
]
*
cmd
.
Cmd
)
for
name
,
chart
:=
range
r
.
config
.
Spec
.
Charts
{
...
...
@@ -219,9 +241,13 @@
func
(
r
*
Runner
)
prepareCmds
()
(
map
[
string
]
*
cmd
.
Cmd
,
error
)
{
// create helm commands
// create ytt chart commands
cmds
:=
make
(
map
[
string
]
*
cmd
.
Cmd
)
for
name
,
chart
:=
range
r
.
config
.
Spec
.
Charts
{
if
chart
.
Disabled
{
disabled
,
err
:=
toBool
(
chart
.
Disabled
)
if
err
!=
nil
{
return
nil
,
err
}
if
disabled
{
continue
}
args
,
err
:=
chart
.
BuildArgs
(
name
,
r
.
config
.
Namespace
)
...
...
This diff is collapsed.
Click to expand it.
Steeven Herlant
@steeven.herlant
mentioned in commit
9687349fe283
·
1 year ago
mentioned in commit
9687349fe283
mentioned in commit 9687349fe2833d927a1d2bcb0928026a4ddd7e24
Toggle commit list
Preview
0%
Loading
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