Skip to content

Commit

Permalink
Remove unused extra docker-compose files (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm authored May 15, 2024
1 parent 1706f39 commit cf8e1c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
39 changes: 13 additions & 26 deletions internal/agentdeployer/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ var staticSource = resource.NewSourceFS(static)
// CustomAgentDeployer knows how to deploy a custom elastic-agent defined via
// a Docker Compose file.
type DockerComposeAgentDeployer struct {
profile *profile.Profile
dockerComposeFile string
stackVersion string
profile *profile.Profile
stackVersion string

policyName string

Expand All @@ -59,10 +58,9 @@ type DockerComposeAgentDeployer struct {
}

type DockerComposeAgentDeployerOptions struct {
Profile *profile.Profile
DockerComposeFile string
StackVersion string
PolicyName string
Profile *profile.Profile
StackVersion string
PolicyName string

PackageName string
DataStream string
Expand All @@ -86,14 +84,13 @@ var _ DeployedAgent = new(dockerComposeDeployedAgent)
// NewCustomAgentDeployer returns a new instance of a deployedCustomAgent.
func NewCustomAgentDeployer(options DockerComposeAgentDeployerOptions) (*DockerComposeAgentDeployer, error) {
return &DockerComposeAgentDeployer{
profile: options.Profile,
dockerComposeFile: options.DockerComposeFile,
stackVersion: options.StackVersion,
packageName: options.PackageName,
dataStream: options.DataStream,
policyName: options.PolicyName,
runTearDown: options.RunTearDown,
runTestsOnly: options.RunTestsOnly,
profile: options.Profile,
stackVersion: options.StackVersion,
packageName: options.PackageName,
dataStream: options.DataStream,
policyName: options.PolicyName,
runTearDown: options.RunTearDown,
runTestsOnly: options.RunTestsOnly,
}, nil
}

Expand Down Expand Up @@ -125,20 +122,10 @@ func (d *DockerComposeAgentDeployer) SetUp(ctx context.Context, agentInfo AgentI
return nil, fmt.Errorf("could not create resources for custom agent: %w", err)
}

ymlPaths := []string{
filepath.Join(configDir, dockerTestAgentDockerCompose),
}
if d.dockerComposeFile != "" {
ymlPaths = []string{
d.dockerComposeFile,
filepath.Join(configDir, dockerTestAgentDockerCompose),
}
}

composeProjectName := fmt.Sprintf("elastic-package-agent-%s", d.agentName())

agent := dockerComposeDeployedAgent{
ymlPaths: ymlPaths,
ymlPaths: []string{filepath.Join(configDir, dockerTestAgentDockerCompose)},
project: composeProjectName,
env: env,
}
Expand Down
15 changes: 7 additions & 8 deletions internal/agentdeployer/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ func Factory(options FactoryOptions) (AgentDeployer, error) {
return nil, fmt.Errorf("agent deployer is not supported for type %s", options.Type)
}
opts := DockerComposeAgentDeployerOptions{
Profile: options.Profile,
DockerComposeFile: "", // TODO: Allow other docker-compose files to apply overrides
StackVersion: options.StackVersion,
PackageName: options.PackageName,
PolicyName: options.PolicyName,
DataStream: options.DataStream,
RunTearDown: options.RunTearDown,
RunTestsOnly: options.RunTestsOnly,
Profile: options.Profile,
StackVersion: options.StackVersion,
PackageName: options.PackageName,
PolicyName: options.PolicyName,
DataStream: options.DataStream,
RunTearDown: options.RunTearDown,
RunTestsOnly: options.RunTestsOnly,
}
return NewCustomAgentDeployer(opts)
case "agent":
Expand Down

0 comments on commit cf8e1c9

Please sign in to comment.