Skip to content

Commit

Permalink
Merge pull request #82 from dream11/development
Browse files Browse the repository at this point in the history
  • Loading branch information
brownhash authored May 9, 2022
2 parents 34e7e17 + 84f3f55 commit 75ad73c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ type application struct {
// App (Application) interface
var App application = application{
Name: "odin",
Version: "1.1.0-alpha",
Version: "1.1.1-alpha",
}
24 changes: 2 additions & 22 deletions internal/command/commands/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (e *Env) Run(args []string) int {
providerAccount := flagSet.String("account", "", "account name to provision the environment in")
filePath := flagSet.String("file", "environment.yaml", "file to read environment config")
id := flagSet.Int("id", 0, "unique id of a changelog of an env")
tail := flagSet.Bool("tail", false, "enable synchronous logging of creation events")

err := flagSet.Parse(args)
if err != nil {
Expand All @@ -54,17 +53,7 @@ func (e *Env) Run(args []string) int {
Account: *providerAccount,
}

if *tail {
envClient.CreateEnvStream(envConfig)
} else {
response, err := envClient.CreateEnv(envConfig)
if err != nil {
e.Logger.Error(err.Error())
return 1
}

e.Logger.Success("Env: " + response.Name + " created!")
}
envClient.CreateEnvStream(envConfig)

return 0
}
Expand Down Expand Up @@ -250,14 +239,7 @@ func (e *Env) Run(args []string) int {
if e.Delete {
emptyParameters := emptyParameters(map[string]string{"--name": *name})
if len(emptyParameters) == 0 {
if *tail {
envClient.DeleteEnvStream(*name)
} else {
e.Logger.Info("Initiating environment deletion: " + *name)
envClient.DeleteEnv(*name)
e.Logger.Success(fmt.Sprintf("Deletion started: %s", *name))
}

envClient.DeleteEnvStream(*name)
return 0
}

Expand Down Expand Up @@ -350,7 +332,6 @@ func (e *Env) Help() string {
"--purpose=reason to create environment",
"--env-type=type of environment",
"--account=account name to provision the environment in (optional)",
"--tail enable synchronous logging of creation events",
})
}

Expand Down Expand Up @@ -381,7 +362,6 @@ func (e *Env) Help() string {
if e.Delete {
return commandHelper("delete", "environment", []string{
"--name=name of environment to delete",
"--tail enable synchronous logging of deletion events",
})
}

Expand Down
19 changes: 3 additions & 16 deletions internal/command/commands/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func (s *Service) Run(args []string) int {
rebuild := flagSet.Bool("rebuild", false, "rebuild executor for creating images or deploying services")
component := flagSet.String("component", "", "name of service component")
platform := flagSet.String("platform", "", "platform to deploy the service in")
tail := flagSet.Bool("tail", false, "enable synchronous logging of creation events")

err := flagSet.Parse(args)
if err != nil {
Expand Down Expand Up @@ -184,13 +183,7 @@ func (s *Service) Run(args []string) int {
emptyParameters := emptyParameters(map[string]string{"--name": *serviceName, "--version": *serviceVersion, "--env": *envName})
if len(emptyParameters) == 0 {
s.Logger.Info("Initiating service deployment: " + *serviceName + "@" + *serviceVersion + " in " + *envName)

if *tail {
serviceClient.DeployServiceStream(*serviceName, *serviceVersion, *envName, *platform, *force, *rebuild)
} else {
serviceClient.DeployService(*serviceName, *serviceVersion, *envName, *platform, *force, *rebuild)
s.Logger.Success(fmt.Sprintf("Deployment of service %s@%s is started on env %s", *serviceName, *serviceVersion, *envName))
}
serviceClient.DeployServiceStream(*serviceName, *serviceVersion, *envName, *platform, *force, *rebuild)

return 0
}
Expand All @@ -203,12 +196,7 @@ func (s *Service) Run(args []string) int {
emptyParameters := emptyParameters(map[string]string{"--name": *serviceName, "--env": *envName})
if len(emptyParameters) == 0 {
s.Logger.Info("Initiating service un-deploy: " + *serviceName + " from environment " + *envName)
if *tail {
serviceClient.UnDeployServiceStream(*serviceName, *envName)
} else {
serviceClient.UndeployService(*serviceName, *envName)
s.Logger.Success("Job Triggered to undeploy your service " + *serviceName + " from the env " + *envName)
}
serviceClient.UnDeployServiceStream(*serviceName, *envName)

return 0
}
Expand Down Expand Up @@ -310,15 +298,14 @@ func (s *Service) Help() string {
"--force=forcefully deploy your service",
"--rebuild=rebuild your executor job again for service deployment",
"--env=name of environment to deploy service in",
"--tail=enable synchronous logging of deploy events",
"--platform= platform to deploy the service in",
})
}

if s.Undeploy {
return commandHelper("deploy", "service", []string{
"--name=name of service to undeploy",
"--env=name of environment to undeploy service in",
"--tail enable synchronous logging of un-deploy events",
})
}

Expand Down

0 comments on commit 75ad73c

Please sign in to comment.