浏览代码

更新 devops-deployer 传入的参数

reghao 2 年之前
父节点
当前提交
3d725c5973
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      deployer/src/main/java/cn/reghao/devops/deployer/DeployApp.java

+ 7 - 6
deployer/src/main/java/cn/reghao/devops/deployer/DeployApp.java

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