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
47583b2d
Commit
47583b2d
authored
2 years ago
by
Florent Aide
Browse files
Options
Downloads
Patches
Plain Diff
runner: continue cmds args creation
parent
cef0d887
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runner/config.go
+4
-3
4 additions, 3 deletions
runner/config.go
runner/main.go
+13
-8
13 additions, 8 deletions
runner/main.go
with
17 additions
and
11 deletions
runner/config.go
+
4
−
3
View file @
47583b2d
...
...
@@ -131,6 +131,6 @@
var
args
[]
string
switch
c
.
Type
{
case
HelmType
:
// helm template
-f base.yaml
-f base.values.yaml -f ns.yaml -f ns.values.yaml
// helm template
name vendor/helm/mychart/ --namespace ns1
-f base.values.yaml -f ns.yaml -f ns.values.yaml
args
=
append
(
args
,
"template"
,
name
,
c
.
Path
,
"--namespace"
,
namespace
)
case
YttType
:
...
...
@@ -135,7 +135,5 @@
args
=
append
(
args
,
"template"
,
name
,
c
.
Path
,
"--namespace"
,
namespace
)
case
YttType
:
// ytt -f $chartsTmpFile --file-mark "$(basename $chartsTmpFile):type=yaml-plain"\
// -f base/ytt/ -f base/ytt.yml -f ns1/ytt/ -f ns1/ytt.yml
args
=
append
(
args
,
"-f"
,
c
.
Path
)
default
:
return
nil
,
fmt
.
Errorf
(
"unsupported chart %s type: %q"
,
c
.
Path
,
c
.
Type
)
...
...
@@ -146,6 +144,9 @@
return
args
,
nil
}
// ytt -f $chartsTmpFile --file-mark "$(basename $chartsTmpFile):type=yaml-plain"\
// -f base/ytt/ -f base/ytt.yml -f ns1/ytt/ -f ns1/ytt.yml
func
cmdChartFromChart
(
c
Chart
)
CmdChart
{
return
CmdChart
{
Type
:
c
.
Type
,
...
...
This diff is collapsed.
Click to expand it.
runner/main.go
+
13
−
8
View file @
47583b2d
...
...
@@ -21,10 +21,10 @@
// Build is in charge of applying commands based on the config data
func
(
r
*
Runner
)
Build
()
error
{
// create helm commands
var
helmCmds
[]
*
cmd
.
Cmd
for
_
,
chart
:=
range
r
.
config
.
Spec
.
Charts
{
name
:=
"FIND_WERE_THE_NAME_COMES_FROM"
// create ytt chart commands
var
cmds
[]
*
cmd
.
Cmd
for
name
,
chart
:=
range
r
.
config
.
Spec
.
Charts
{
args
,
err
:=
chart
.
BuildArgs
(
name
,
r
.
config
.
Namespace
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"build: failed to build args %w"
,
err
)
}
...
...
@@ -27,7 +27,14 @@
args
,
err
:=
chart
.
BuildArgs
(
name
,
r
.
config
.
Namespace
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"build: failed to build args %w"
,
err
)
}
helmCmds
=
append
(
helmCmds
,
cmd
.
NewCmd
(
"helm"
,
args
...
))
switch
chart
.
Type
{
case
HelmType
:
cmds
=
append
(
cmds
,
cmd
.
NewCmd
(
"/path/to/helm"
,
args
...
))
case
YttType
:
cmds
=
append
(
cmds
,
cmd
.
NewCmd
(
"/path/to/ytt"
,
args
...
))
default
:
return
fmt
.
Errorf
(
"unsupported chart %s type: %q"
,
chart
.
Path
,
chart
.
Type
)
}
}
...
...
@@ -32,8 +39,6 @@
}
// create ytt chart commands
// create ytt additional command
// run commands or print them
if
r
.
config
.
DryRun
{
...
...
@@ -36,11 +41,11 @@
// create ytt additional command
// run commands or print them
if
r
.
config
.
DryRun
{
for
_
,
helmCmd
:=
range
helmC
mds
{
for
_
,
helmCmd
:=
range
c
mds
{
r
.
config
.
Logger
.
Info
()
.
Str
(
"command"
,
helmCmd
.
Name
)
.
Str
(
"args"
,
strings
.
Join
(
helmCmd
.
Args
,
" "
))
.
Msg
(
"would run command"
)
}
}
else
{
...
...
@@ -41,10 +46,10 @@
r
.
config
.
Logger
.
Info
()
.
Str
(
"command"
,
helmCmd
.
Name
)
.
Str
(
"args"
,
strings
.
Join
(
helmCmd
.
Args
,
" "
))
.
Msg
(
"would run command"
)
}
}
else
{
for
_
,
helmCmd
:=
range
helmC
mds
{
for
_
,
helmCmd
:=
range
c
mds
{
err
,
sdtOut
,
stdErr
:=
RunCMD
(
helmCmd
)
if
err
!=
nil
{
r
.
config
.
Logger
.
Err
(
err
)
.
...
...
This diff is collapsed.
Click to expand it.
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