|
@@ -14,20 +14,21 @@ import java.util.List;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class DeployApp {
|
|
public class DeployApp {
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
- if (args.length != 3) {
|
|
|
|
|
- log.error("usage: java -jar devops-deployer ${local_dir} ${remote_dir} ${sever_file}");
|
|
|
|
|
|
|
+ if (args.length != 4) {
|
|
|
|
|
+ log.error("usage: java -jar devops-deployer ${app_name} ${local_dir} ${remote_dir} ${sever_file}");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String localDir = args[0];
|
|
|
|
|
|
|
+ String appName = args[0];
|
|
|
|
|
+ String localDir = args[1];
|
|
|
File file1 = new File(localDir);
|
|
File file1 = new File(localDir);
|
|
|
if (!file1.exists() || file1.isFile()) {
|
|
if (!file1.exists() || file1.isFile()) {
|
|
|
log.error("local_dir {} is not exist or is a file", localDir);
|
|
log.error("local_dir {} is not exist or is a file", localDir);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String remoteDir = args[1];
|
|
|
|
|
- String serverFile = args[2];
|
|
|
|
|
|
|
+ String remoteDir = args[2];
|
|
|
|
|
+ String serverFile = args[3];
|
|
|
File file2 = new File(serverFile);
|
|
File file2 = new File(serverFile);
|
|
|
if (!file2.exists() || file2.isDirectory()) {
|
|
if (!file2.exists() || file2.isDirectory()) {
|
|
|
log.error("server_file {} is not exist or is a directory", serverFile);
|
|
log.error("server_file {} is not exist or is a directory", serverFile);
|
|
@@ -41,7 +42,7 @@ public class DeployApp {
|
|
|
try {
|
|
try {
|
|
|
String host = remoteHost.getHost();
|
|
String host = remoteHost.getHost();
|
|
|
sftp.deploy(localDir, remoteDir, remoteHost);
|
|
sftp.deploy(localDir, remoteDir, remoteHost);
|
|
|
- log.info("deploy devops on {} done", host);
|
|
|
|
|
|
|
+ log.info("deploy {} on {} done", appName, host);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|