Skip to content

Commit

Permalink
Update runner to run dependencies (#229)
Browse files Browse the repository at this point in the history
* Update runner to run dependencies
* Add CHANGELOG
  • Loading branch information
angrycub authored Mar 31, 2022
1 parent 0a44269 commit 024dbaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BUG FIXES:

* cli: Add missing --name flag for status command [[GH-212](https://github.com/hashicorp/nomad-pack/pull/212)]
* cli: Use Pack metadata `Name` in error context once known [[GH-217](https://github.com/hashicorp/nomad-pack/pull/217)]
* runner: Update runner to properly handle dependencies [[GH-229](https://github.com/hashicorp/nomad-pack/pull/229)]

IMPROVEMENTS:

Expand Down
10 changes: 9 additions & 1 deletion internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (c *RunCommand) run() int {
}

renderedParents := r.ParentRenders()
renderedDeps := r.DependentRenders()

// TODO: Refactor to use PackConfig. Maybe PackConfig should be in a more common
// pkg than cache, or maybe it's ok for runner to depend on the cache.
Expand All @@ -92,7 +93,14 @@ func (c *RunCommand) run() int {
}

// Set the rendered templates on the job deployer.
runDeployer.SetTemplates(renderedParents)
templates := make(map[string]string, r.LenDependentRenders()+r.LenParentRenders())
for dn, ds := range renderedDeps {
templates[dn] = ds
}
for pn, ps := range renderedParents {
templates[pn] = ps
}
runDeployer.SetTemplates(templates)

// Parse the templates. If we have any error, output this and exit.
if validateErrs := runDeployer.ParseTemplates(); validateErrs != nil {
Expand Down

0 comments on commit 024dbaa

Please sign in to comment.