Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero committed Mar 1, 2024
1 parent d84574f commit 4ab7d40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
15 changes: 7 additions & 8 deletions cmd/terraformadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/runatlantis/atlantis/server/config/valid"
"github.com/runatlantis/atlantis/server/legacy"
"github.com/runatlantis/atlantis/server/logging"
"github.com/runatlantis/atlantis/server/neptune/temporalworker"
neptune "github.com/runatlantis/atlantis/server/neptune/temporalworker/config"
"github.com/runatlantis/atlantis/server/neptune/terraformadmin"
)

type TerraformAdmin struct{}
Expand All @@ -21,12 +21,15 @@ func (t *TerraformAdmin) NewServer(userConfig legacy.UserConfig, config legacy.C

globalCfg := valid.NewGlobalCfg(userConfig.DataDir)
validator := &cfgParser.ParserValidator{}

// TODO: should terraformadminmode pass in this stuff?
if userConfig.RepoConfig != "" {
globalCfg, err = validator.ParseGlobalCfg(userConfig.RepoConfig, globalCfg)
if err != nil {
return nil, errors.Wrapf(err, "parsing %s file", userConfig.RepoConfig)
}
}

parsedURL, err := legacy.ParseAtlantisURL(userConfig.AtlantisURL)
if err != nil {
return nil, errors.Wrapf(err,
Expand All @@ -40,6 +43,8 @@ func (t *TerraformAdmin) NewServer(userConfig legacy.UserConfig, config legacy.C
return nil, err
}

// we don't need the feature config

cfg := &neptune.Config{
AuthCfg: neptune.AuthConfig{
SslCertFile: userConfig.SSLCertFile,
Expand All @@ -50,12 +55,6 @@ func (t *TerraformAdmin) NewServer(userConfig legacy.UserConfig, config legacy.C
Version: config.AtlantisVersion,
Port: userConfig.Port,
},
FeatureConfig: neptune.FeatureConfig{
FFOwner: userConfig.FFOwner,
FFRepo: userConfig.FFRepo,
FFPath: userConfig.FFPath,
FFBranch: userConfig.FFBranch,
},
TerraformCfg: neptune.TerraformConfig{
DefaultVersion: userConfig.DefaultTFVersion,
DownloadURL: userConfig.TFDownloadURL,
Expand All @@ -77,5 +76,5 @@ func (t *TerraformAdmin) NewServer(userConfig legacy.UserConfig, config legacy.C
LyftAuditJobsSnsTopicArn: userConfig.LyftAuditJobsSnsTopicArn,
RevisionSetter: globalCfg.RevisionSetter,
}
return temporalworker.NewServer(cfg)
return terraformadmin.NewServer(cfg)
}
14 changes: 7 additions & 7 deletions server/neptune/terraformadmin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ type Server struct {
GithubActivities *activities.Github
RevisionSetterActivities *lyftActivities.RevisionSetter
// Temporary until we move this into our private code
AuditActivity *lyftActivities.Audit
PRRevisionGithubActivities *lyftActivities.Github
TerraformTaskQueue string
RevisionSetterConfig valid.RevisionSetter
Expand Down Expand Up @@ -141,10 +140,8 @@ func NewServer(config *config.Config) (*Server, error) {
Logger: config.CtxLogger,
}

auditActivity, err := lyftActivities.NewAuditActivity(config.LyftAuditJobsSnsTopicArn)
if err != nil {
return nil, errors.Wrap(err, "initializing lyft activities")
}
// we don't need audit activities

deployActivities, err := activities.NewDeploy(config.DeploymentConfig)
if err != nil {
return nil, errors.Wrap(err, "initializing deploy activities")
Expand Down Expand Up @@ -227,12 +224,16 @@ func NewServer(config *config.Config) (*Server, error) {
RevisionSetterActivities: revisionSetterActivities,
TerraformTaskQueue: config.TemporalCfg.TerraformTaskQueue,
RevisionSetterConfig: config.RevisionSetter,
AuditActivity: auditActivity,
PRRevisionGithubActivities: prRevisionGithubActivities,
}
return &server, nil
}

/*
* BIG TODO FOR ATLANTIS DEPRECATION:
* Figure out what workers / activities / stuff and things we don't need and remove them
*/

func (s Server) Start() error {
defer s.shutdown()

Expand Down Expand Up @@ -384,7 +385,6 @@ func (s Server) buildDeployWorker() worker.Worker {
})
deployWorker.RegisterActivity(s.DeployActivities)
deployWorker.RegisterActivity(s.GithubActivities)
deployWorker.RegisterActivity(s.AuditActivity)
deployWorker.RegisterActivity(s.TerraformActivities)
deployWorker.RegisterWorkflowWithOptions(workflows.GetDeployWithPlugins(
func(ctx workflow.Context, dr workflows.DeployRequest) (plugins.Deploy, error) {
Expand Down

0 comments on commit 4ab7d40

Please sign in to comment.