Skip to content

Commit

Permalink
Merge pull request #61 from srevinsaju/fix/path-module-fix
Browse files Browse the repository at this point in the history
Fix regression on path.module
  • Loading branch information
srevinsaju authored Nov 3, 2023
2 parents c8db34f + a6abb4f commit 572d8f8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Fix `path.module` incorrectly being populated for togomak modules

## [v2.0.0-alpha.9]
- Add support for `modules`
- Add JSON logger
- Add `for_each` to modules
Expand Down
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 572d8f8

Please sign in to comment.