Skip to content

Commit

Permalink
fix: path.module incorrectly populated for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Nov 3, 2023
1 parent c8db34f commit 65c01c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions examples/module-local/calculator/togomak.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ stage "add" {
if = var.operation == "add"
script = "echo ${var.a} + ${var.b} is ${var.a + var.b}"
}

stage "paths" {
script = <<-EOT
echo path.module: ${path.module}
echo path.cwd: ${path.cwd}
echo path.root: ${path.root}
EOT
}
8 changes: 8 additions & 0 deletions examples/module-local/togomak.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ locals {
b = 1
}

stage "paths" {
script = <<-EOT
echo path.module: ${path.module}
echo path.cwd: ${path.cwd}
echo path.root: ${path.root}
EOT
}

module "add" {
source = "./calculator"
a = local.a
Expand Down
8 changes: 4 additions & 4 deletions internal/ci/conductor.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,6 @@ func NewConductor(cfg ConductorConfig, opts ...ConductorOption) *Conductor {
Process: process,
RootLogger: logger,
Config: cfg,
eval: &Eval{
context: CreateEvalContext(cfg, process),
mu: &sync.RWMutex{},
},
}
for _, v := range cfg.Variables {
c.variables = append(c.variables, v)
Expand All @@ -293,6 +289,10 @@ func NewConductor(cfg ConductorConfig, opts ...ConductorOption) *Conductor {
for _, opt := range opts {
opt(c)
}
c.eval = &Eval{
context: CreateEvalContext(c.Config, process),
mu: &sync.RWMutex{},
}

if !c.Config.Behavior.Child.Enabled {
logger.Infof("%s (version=%s)", meta.AppName, meta.AppVersion)
Expand Down

0 comments on commit 65c01c6

Please sign in to comment.