Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(localgit): write config to ~/.spinnaker where possible #770

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
profiles = profiles.stream().filter(p -> !p.getName().equals("clouddriver.yml")).collect(Collectors.toList());

String filename = "clouddriver-bootstrap.yml";
String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = clouddriverBootstrapProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "clouddriver.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = clouddriverProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "echo.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = echoProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "fiat.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = fiatProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "front50.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = front50ProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "gate.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
GateProfileFactory gateProfileFactory = getGateProfileFactory(deploymentConfiguration.getName());
Profile profile = gateProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "igor.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = igorProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);

String filename = "orca-bootstrap.yml";
String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = orcaBootstrapProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "orca.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = orcaProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.springframework.stereotype.Component;
import retrofit.http.GET;

import javax.swing.text.html.Option;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -81,7 +80,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "rosco.yml";

String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = roscoProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);

profiles.add(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@

@Component
abstract public class SpringService<T> extends SpinnakerService<T> {
protected final String OUTPUT_PATH = "/opt/spinnaker/config/";
protected String getConfigOutputPath() {
return "/opt/spinnaker/config/";
}

@Autowired
SpinnakerProfileFactory spinnakerProfileFactory;

@Override
public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
String filename = "spinnaker.yml";
String path = Paths.get(OUTPUT_PATH, filename).toString();
String path = Paths.get(getConfigOutputPath(), filename).toString();
List<Profile> result = new ArrayList<>();
result.add(spinnakerProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints));
return result;
Expand All @@ -48,7 +50,7 @@ public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration
@Override
protected Optional<String> customProfileOutputPath(String profileName) {
if (profileName.equals(getCanonicalName() + ".yml") || profileName.startsWith(getCanonicalName() + "-") || profileName.startsWith("spinnaker")) {
return Optional.of(OUTPUT_PATH + profileName);
return Optional.of(getConfigOutputPath() + profileName);
} else {
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class LocalGitClouddriverService extends ClouddriverService implements Lo
@Autowired
ArtifactService artifactService;

@Override
protected String getConfigOutputPath() {
return "~/.spinnaker";
}

@Autowired
String gitRoot;

Expand Down