Skip to content
Snippets Groups Projects
Commit 95cd54270043 authored by Steeven Herlant's avatar Steeven Herlant
Browse files

feat: namespace beaver can now be a variable

parent 614e21f6f487
No related branches found
No related tags found
No related merge requests found
Pipeline #68330 failed
...@@ -36,5 +36,9 @@ ...@@ -36,5 +36,9 @@
// Build is in charge of applying commands based on the config data // Build is in charge of applying commands based on the config data
func (r *Runner) Build(tmpDir string) error { func (r *Runner) Build(tmpDir string) error {
variables, err := r.config.prepareVariables(false)
if err != nil {
return fmt.Errorf("cannot prepare variables: %w", err)
}
var outputDir string var outputDir string
if r.config.Output == "" { if r.config.Output == "" {
...@@ -39,5 +43,10 @@ ...@@ -39,5 +43,10 @@
var outputDir string var outputDir string
if r.config.Output == "" { if r.config.Output == "" {
w := bytes.NewBuffer([]byte{})
if err := hydrateString(r.config.Namespace, w, variables); err != nil {
return err
}
r.config.Namespace = w.String()
outputDir = filepath.Join(r.config.RootDir, "build", r.config.Namespace) outputDir = filepath.Join(r.config.RootDir, "build", r.config.Namespace)
} else { } else {
outputDir = r.config.Output outputDir = r.config.Output
...@@ -59,7 +68,7 @@ ...@@ -59,7 +68,7 @@
return fmt.Errorf("cannot clean dir: %s: %w", outputDir, err) return fmt.Errorf("cannot clean dir: %s: %w", outputDir, err)
} }
} }
variables, err := r.config.prepareVariables(true) variables, err = r.config.prepareVariables(true)
if err != nil { if err != nil {
return fmt.Errorf("cannot prepare variables: %w", err) return fmt.Errorf("cannot prepare variables: %w", err)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment