|
|
@ -21,6 +21,16 @@ public class PublishUtil {
|
|
|
|
ssh.exec(cmd);
|
|
|
|
ssh.exec(cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void bluePrint(String msg) {
|
|
|
|
|
|
|
|
// 设置文本颜色
|
|
|
|
|
|
|
|
System.out.println("\033[34m" + msg + "\033[0m"); // 蓝色
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void redPrint(String msg) {
|
|
|
|
|
|
|
|
// 设置文本颜色
|
|
|
|
|
|
|
|
System.out.println("\033[31m" + msg + "\033[0m"); // 红色文本
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 删除本机所有Docker镜像
|
|
|
|
* 删除本机所有Docker镜像
|
|
|
|
* docker images --format "{{.Repository}}:{{.Tag}}" | xargs -r docker rmi -f
|
|
|
|
* docker images --format "{{.Repository}}:{{.Tag}}" | xargs -r docker rmi -f
|
|
|
@ -103,13 +113,13 @@ public class PublishUtil {
|
|
|
|
int cnt = 0;
|
|
|
|
int cnt = 0;
|
|
|
|
int pos;
|
|
|
|
int pos;
|
|
|
|
for (int i = workingPath.length() - 1; ; i--) {
|
|
|
|
for (int i = workingPath.length() - 1; ; i--) {
|
|
|
|
if (workingPath.charAt(i) == '/') cnt++;
|
|
|
|
if (workingPath.charAt(i) == '\\') cnt++;
|
|
|
|
if (cnt == 2) {
|
|
|
|
if (cnt == 2) {
|
|
|
|
pos = i;
|
|
|
|
pos = i;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String localFile = workingPath.substring(0, pos) + "/static.zip";
|
|
|
|
String localFile = workingPath.substring(0, pos) + "\\static.zip";
|
|
|
|
if (FileUtil.exist(localFile)) {
|
|
|
|
if (FileUtil.exist(localFile)) {
|
|
|
|
FileUtil.del(localFile);
|
|
|
|
FileUtil.del(localFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -210,6 +220,7 @@ public class PublishUtil {
|
|
|
|
* @return 项目名称
|
|
|
|
* @return 项目名称
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static String getPublishProjectName(String pathName) {
|
|
|
|
public static String getPublishProjectName(String pathName) {
|
|
|
|
|
|
|
|
|
|
|
|
//遍历 pathName的每个字符,如果是不是大写字母,就照抄下来,如果是大写字母,就变成小写字母,并且在小写字母前面加上下划线_
|
|
|
|
//遍历 pathName的每个字符,如果是不是大写字母,就照抄下来,如果是大写字母,就变成小写字母,并且在小写字母前面加上下划线_
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
for (int i = 0; i < pathName.length(); i++) {
|
|
|
|
for (int i = 0; i < pathName.length(); i++) {
|
|
|
@ -249,9 +260,9 @@ public class PublishUtil {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static int userSelectProject(List<ProjectBean> listProject) {
|
|
|
|
public static int userSelectProject(List<ProjectBean> listProject) {
|
|
|
|
Scanner scanner = new Scanner(System.in); // 创建Scanner对象来读取控制台输入
|
|
|
|
Scanner scanner = new Scanner(System.in); // 创建Scanner对象来读取控制台输入
|
|
|
|
int choice = -1;
|
|
|
|
int choice;
|
|
|
|
while (true) {
|
|
|
|
while (true) {
|
|
|
|
System.out.println("请选择您本次要发布的项目编号:");
|
|
|
|
redPrint("1、请选择您本次要发布的项目编号:");
|
|
|
|
for (ProjectBean projectBean : listProject) {
|
|
|
|
for (ProjectBean projectBean : listProject) {
|
|
|
|
System.out.print(projectBean.getId() + ":" + projectBean.getDevProjectName() + " ");
|
|
|
|
System.out.print(projectBean.getId() + ":" + projectBean.getDevProjectName() + " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,7 +294,7 @@ public class PublishUtil {
|
|
|
|
//输出choice对应的项目名称
|
|
|
|
//输出choice对应的项目名称
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
Kv kv = Kv.create();
|
|
|
|
while (true) {
|
|
|
|
while (true) {
|
|
|
|
System.out.println("请选择您本次要发布的仓库:");
|
|
|
|
redPrint("2、请选择您本次要发布的仓库:");
|
|
|
|
System.out.println("1:驿来特仓库 2:黄海私人仓库");
|
|
|
|
System.out.println("1:驿来特仓库 2:黄海私人仓库");
|
|
|
|
int choice = scanner.nextInt(); // 读取用户输入的整数
|
|
|
|
int choice = scanner.nextInt(); // 读取用户输入的整数
|
|
|
|
|
|
|
|
|
|
|
@ -352,7 +363,7 @@ public class PublishUtil {
|
|
|
|
Scanner scanner = new Scanner(System.in); // 创建Scanner对象来读取控制台输入
|
|
|
|
Scanner scanner = new Scanner(System.in); // 创建Scanner对象来读取控制台输入
|
|
|
|
//输出choice对应的项目名称
|
|
|
|
//输出choice对应的项目名称
|
|
|
|
while (true) {
|
|
|
|
while (true) {
|
|
|
|
System.out.println("请选择您本次要发布的配置文件:");
|
|
|
|
redPrint("3、请选择您本次要发布的配置文件:");
|
|
|
|
for (int i = 0; i < setConfigFiles.size(); i++) {
|
|
|
|
for (int i = 0; i < setConfigFiles.size(); i++) {
|
|
|
|
System.out.print((i + 1) + ":" + setConfigFiles.get(i) + " ");
|
|
|
|
System.out.print((i + 1) + ":" + setConfigFiles.get(i) + " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|