Skip to content

Commit

Permalink
Auto-install project/stack dependencies before running stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Bondar committed Oct 20, 2024
1 parent 9e53794 commit 8cce2d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ func (c *CLI) processStacks(args []string) error {
}

pulumiArgs := getArgs(args)
workspaceInstalledDeps := []string{}
for _, stack := range c.stacks {
fmt.Fprintf(os.Stderr, "Running: pulumi %s for stack %s ...\n", strings.Join(args, " "), stack.Id)
// Install dependencies for each workspace if not installed already
if !slices.Contains(workspaceInstalledDeps, stack.Workspace) {
if err := c.pulumiCli.Run(stack.Workspace, []string{"install", "--use-language-version-tools"}); err != nil {
return err
}
workspaceInstalledDeps = append(workspaceInstalledDeps, stack.Workspace)
}

if err := c.pulumiCli.Run(stack.Workspace, append(pulumiArgs, "--stack", stack.Name)); err != nil {
return err
}
Expand Down

0 comments on commit 8cce2d8

Please sign in to comment.