Skip to content

Commit

Permalink
Restructure manifest and add manifest id
Browse files Browse the repository at this point in the history
  • Loading branch information
rugwirobaker committed Aug 22, 2024
1 parent d3e10ca commit e4d91d4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 60 deletions.
56 changes: 28 additions & 28 deletions internal/command/deploy/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,34 @@ type MachineDeploymentArgs struct {
func argsFromManifest(manifest *DeployManifest, app *fly.AppCompact) MachineDeploymentArgs {
return MachineDeploymentArgs{
AppCompact: app,
DeploymentImage: manifest.DeploymentImage,
Strategy: manifest.Strategy,
EnvFromFlags: manifest.EnvFromFlags,
PrimaryRegionFlag: manifest.PrimaryRegionFlag,
SkipSmokeChecks: manifest.SkipSmokeChecks,
SkipHealthChecks: manifest.SkipHealthChecks,
SkipDNSChecks: manifest.SkipDNSChecks,
SkipReleaseCommand: manifest.SkipReleaseCommand,
MaxUnavailable: manifest.MaxUnavailable,
RestartOnly: manifest.RestartOnly,
WaitTimeout: manifest.WaitTimeout,
StopSignal: manifest.StopSignal,
LeaseTimeout: manifest.LeaseTimeout,
ReleaseCmdTimeout: manifest.ReleaseCmdTimeout,
Guest: manifest.Guest,
IncreasedAvailability: manifest.IncreasedAvailability,
UpdateOnly: manifest.UpdateOnly,
Files: manifest.Files,
ExcludeRegions: manifest.ExcludeRegions,
OnlyRegions: manifest.OnlyRegions,
ExcludeMachines: manifest.ExcludeMachines,
OnlyMachines: manifest.OnlyMachines,
ProcessGroups: manifest.ProcessGroups,
MaxConcurrent: manifest.MaxConcurrent,
VolumeInitialSize: manifest.VolumeInitialSize,
RestartPolicy: manifest.RestartPolicy,
RestartMaxRetries: manifest.RestartMaxRetries,
DeployRetries: manifest.DeployRetries,
DeploymentImage: manifest.Args.DeploymentImage,
Strategy: manifest.Args.Strategy,
EnvFromFlags: manifest.Args.EnvFromFlags,
PrimaryRegionFlag: manifest.Args.PrimaryRegionFlag,
SkipSmokeChecks: manifest.Args.SkipSmokeChecks,
SkipHealthChecks: manifest.Args.SkipHealthChecks,
SkipDNSChecks: manifest.Args.SkipDNSChecks,
SkipReleaseCommand: manifest.Args.SkipReleaseCommand,
MaxUnavailable: manifest.Args.MaxUnavailable,
RestartOnly: manifest.Args.RestartOnly,
WaitTimeout: manifest.Args.WaitTimeout,
StopSignal: manifest.Args.StopSignal,
LeaseTimeout: manifest.Args.LeaseTimeout,
ReleaseCmdTimeout: manifest.Args.ReleaseCmdTimeout,
Guest: manifest.Args.Guest,
IncreasedAvailability: manifest.Args.IncreasedAvailability,
UpdateOnly: manifest.Args.UpdateOnly,
Files: manifest.Args.Files,
ExcludeRegions: manifest.Args.ExcludeRegions,
OnlyRegions: manifest.Args.OnlyRegions,
ExcludeMachines: manifest.Args.ExcludeMachines,
OnlyMachines: manifest.Args.OnlyMachines,
ProcessGroups: manifest.Args.ProcessGroups,
MaxConcurrent: manifest.Args.MaxConcurrent,
VolumeInitialSize: manifest.Args.VolumeInitialSize,
RestartPolicy: manifest.Args.RestartPolicy,
RestartMaxRetries: manifest.Args.RestartMaxRetries,
DeployRetries: manifest.Args.DeployRetries,
}
}

Expand Down
73 changes: 41 additions & 32 deletions internal/command/deploy/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ import (

fly "github.com/superfly/fly-go"
"github.com/superfly/flyctl/internal/appconfig"
"github.com/superfly/flyctl/internal/buildinfo"
"github.com/superfly/flyctl/internal/flyutil"
"github.com/superfly/flyctl/internal/sentry"
"github.com/superfly/flyctl/iostreams"
)

type DeployManifest struct {
AppName string
Config *appconfig.Config `json:"config"`
ID string `json:"id,omitempty"`
FlyVersion string `json:"fly_version,omitempty"`
AppName string `json:"app_name"`
Config *appconfig.Config `json:"config"`
Args *ManifestArgs `json:"args,omitempty"`
}

type ManifestArgs struct {
DeploymentImage string `json:"deployment_image,omitempty"`
Strategy string `json:"strategy,omitempty"`
EnvFromFlags []string `json:"env_from_flags,omitempty"`
Expand Down Expand Up @@ -53,36 +60,38 @@ type DeployManifest struct {

func NewManifest(AppName string, config *appconfig.Config, args MachineDeploymentArgs) *DeployManifest {
return &DeployManifest{
AppName: AppName,
Config: config,
DeploymentImage: args.DeploymentImage,
Strategy: args.Strategy,
EnvFromFlags: args.EnvFromFlags,
PrimaryRegionFlag: args.PrimaryRegionFlag,
SkipSmokeChecks: args.SkipSmokeChecks,
SkipHealthChecks: args.SkipHealthChecks,
SkipDNSChecks: args.SkipDNSChecks,
SkipReleaseCommand: args.SkipReleaseCommand,
MaxUnavailable: args.MaxUnavailable,
RestartOnly: args.RestartOnly,
WaitTimeout: args.WaitTimeout,
StopSignal: args.StopSignal,
LeaseTimeout: args.LeaseTimeout,
ReleaseCmdTimeout: args.ReleaseCmdTimeout,
Guest: args.Guest,
IncreasedAvailability: args.IncreasedAvailability,
UpdateOnly: args.UpdateOnly,
Files: args.Files,
ExcludeRegions: args.ExcludeRegions,
OnlyRegions: args.OnlyRegions,
ExcludeMachines: args.ExcludeMachines,
OnlyMachines: args.OnlyMachines,
ProcessGroups: args.ProcessGroups,
MaxConcurrent: args.MaxConcurrent,
VolumeInitialSize: args.VolumeInitialSize,
RestartPolicy: args.RestartPolicy,
RestartMaxRetries: args.RestartMaxRetries,
DeployRetries: args.DeployRetries,
AppName: AppName,
Config: config,
ID: fmt.Sprintf("manifest_%d", time.Now().UnixNano()),
FlyVersion: buildinfo.Info().Version.String(),
Args: &ManifestArgs{DeploymentImage: args.DeploymentImage,
Strategy: args.Strategy,
EnvFromFlags: args.EnvFromFlags,
PrimaryRegionFlag: args.PrimaryRegionFlag,
SkipSmokeChecks: args.SkipSmokeChecks,
SkipHealthChecks: args.SkipHealthChecks,
SkipDNSChecks: args.SkipDNSChecks,
SkipReleaseCommand: args.SkipReleaseCommand,
MaxUnavailable: args.MaxUnavailable,
RestartOnly: args.RestartOnly,
WaitTimeout: args.WaitTimeout,
StopSignal: args.StopSignal,
LeaseTimeout: args.LeaseTimeout,
ReleaseCmdTimeout: args.ReleaseCmdTimeout,
Guest: args.Guest,
IncreasedAvailability: args.IncreasedAvailability,
UpdateOnly: args.UpdateOnly,
Files: args.Files,
ExcludeRegions: args.ExcludeRegions,
OnlyRegions: args.OnlyRegions,
ExcludeMachines: args.ExcludeMachines,
OnlyMachines: args.OnlyMachines,
ProcessGroups: args.ProcessGroups,
MaxConcurrent: args.MaxConcurrent,
VolumeInitialSize: args.VolumeInitialSize,
RestartPolicy: args.RestartPolicy,
RestartMaxRetries: args.RestartMaxRetries,
DeployRetries: args.DeployRetries},
}
}

Expand Down

0 comments on commit e4d91d4

Please sign in to comment.