Determine deployable app version dynamically
The deployer now checks its own version and uses that to set up the app versions via "launcher.version" on the command line. Closes gh-16
This commit is contained in:
@@ -62,6 +62,8 @@ public class DeployerThread extends Thread {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeployerThread.class);
|
||||
|
||||
private static final String DEFAULT_VERSION = "1.2.0.BUILD-SNAPSHOT";
|
||||
|
||||
private Map<String, DeploymentState> deployed = new ConcurrentHashMap<>();
|
||||
|
||||
private String[] args;
|
||||
@@ -169,12 +171,17 @@ public class DeployerThread extends Thread {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getVersion() {
|
||||
Package pkg = DeployerThread.class.getPackage();
|
||||
return (pkg != null ? pkg.getImplementationVersion() : DEFAULT_VERSION);
|
||||
}
|
||||
|
||||
private void launch() {
|
||||
|
||||
final ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
PropertyPlaceholderAutoConfiguration.class, DeployerConfiguration.class)
|
||||
.web(false).properties("spring.config.name=cloud",
|
||||
"banner.location=launcher-banner.txt")
|
||||
"banner.location=launcher-banner.txt", "launcher.version="+getVersion())
|
||||
.run(this.args);
|
||||
|
||||
final AppDeployer deployer = context.getBean(AppDeployer.class);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
dt:
|
||||
pre: maven://org.springframework.cloud.launcher:spring-cloud-launcher-
|
||||
ver: 1.2.0.BUILD-SNAPSHOT
|
||||
ver: ${launcher.version}
|
||||
spring:
|
||||
cloud:
|
||||
launcher:
|
||||
|
||||
Reference in New Issue
Block a user