-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): adds dump command and allows template command to process m…
…odules
- Loading branch information
Showing
5 changed files
with
111 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package module | ||
|
||
type ModuleCmd struct { | ||
Deploy DeployCmd `cmd:"" help:"Deploys a module (or project) to the configured GitOps repository."` | ||
Template TemplateCmd `cmd:"" help:"Generates a module's (or project's) deployment YAML."` | ||
Deploy DeployCmd `cmd:"" help:"Deploys a project to the configured GitOps repository."` | ||
Dump DumpCmd `cmd:"" help:"Dumps a project's deployment modules."` | ||
Template TemplateCmd `cmd:"" help:"Generates a project's (or module's) deployment YAML."` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package module | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/input-output-hk/catalyst-forge/cli/pkg/run" | ||
"github.com/input-output-hk/catalyst-forge/lib/project/deployment" | ||
) | ||
|
||
type DumpCmd struct { | ||
Project string `arg:"" help:"The path to the project to dump." kong:"arg,predictor=path"` | ||
} | ||
|
||
func (c *DumpCmd) Run(ctx run.RunContext) error { | ||
project, err := ctx.ProjectLoader.Load(c.Project) | ||
if err != nil { | ||
return fmt.Errorf("could not load project: %w", err) | ||
} | ||
|
||
modules := project.Blueprint.Project.Deployment.Modules | ||
if modules == nil { | ||
return fmt.Errorf("no deployment modules found for project") | ||
} | ||
|
||
result, err := deployment.DumpBundle(modules) | ||
if err != nil { | ||
return fmt.Errorf("failed to dump deployment modules: %w", err) | ||
} | ||
|
||
fmt.Print(string(result)) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
main: { | ||
instance: "foundry-api" | ||
name: "app" | ||
namespace: "default" | ||
registry: "332405224602.dkr.ecr.eu-central-1.amazonaws.com/catalyst-deployments" | ||
values: { | ||
service: { | ||
targetPort: 8080 | ||
port: 8080 | ||
} | ||
deployment: { | ||
containers: { | ||
main: { | ||
probes: { | ||
readiness: { | ||
path: "/" | ||
} | ||
liveness: { | ||
path: "/" | ||
} | ||
} | ||
port: 8080 | ||
image: { | ||
tag: "dd724218713a01e0d96d95d60b9dcd044980399b" | ||
name: "ghcr.io/input-output-hk/catalyst-forge/foundry-api" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
version: "0.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters