[ Cmii ] [ Octopus ] - reformat agent-go - 3

This commit is contained in:
zeaslity
2024-03-29 17:46:17 +08:00
parent cf30d8852b
commit 8e1304aac0
3 changed files with 62 additions and 12 deletions

View File

@@ -28,10 +28,6 @@ func TestGetAllContainer(t *testing.T) {
} }
} }
func TestListService(t *testing.T) {
ListService()
}
func TestImageGetAll(t *testing.T) { func TestImageGetAll(t *testing.T) {
imageGetAll := GetAll() imageGetAll := GetAll()

View File

@@ -16,7 +16,6 @@ import java.util.ArrayDeque;
import java.util.HashMap; import java.util.HashMap;
import static io.wdd.common.config.OctopusObjectMapperConfig.OctopusObjectMapper; import static io.wdd.common.config.OctopusObjectMapperConfig.OctopusObjectMapper;
import static io.wdd.common.config.OctopusObjectMapperConfig.WriteToString;
@Configuration @Configuration
@Slf4j(topic = "Octopus Message Listener") @Slf4j(topic = "Octopus Message Listener")
@@ -67,10 +66,10 @@ public class OMessageToServerListener {
} }
// Octopus Message Handler // Octopus Message Handler
log.info( // log.info(
"received from agent : {} ", // "received from agent : {} ",
WriteToString(octopusMessage) // WriteToString(octopusMessage)
); // );
// 获取Agent的版本信息 // 获取Agent的版本信息

View File

@@ -42,15 +42,70 @@ public class TestImageSyncScheduler {
)); ));
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of( ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
"harbor.cdcyy.com.cn/cmii/cmii-uav-industrial-portfolio:5.4.0-cqly-032901" "harbor.cdcyy.com.cn/cmii/cmii-uav-industrial-portfolio:5.4.0-cqly-032802"
)); ));
Boolean downloadAndCompressOnly = true; Boolean downloadAndCompressOnly = true;
String projectNamespace = "wdd"; String projectNamespace = "wdd";
String innerWorkerAgentName = "Chengdu-amd64-65-lapwdd"; //wdd // String innerWorkerAgentName = "Chengdu-amd64-65-lapwdd"; //wdd
// String innerWorkerAgentName = "Chengdu-amd64-71-3571gd"; //prod String innerWorkerAgentName = "Chengdu-amd64-71-3571gd"; //prod
// 之下不要修改 除非你知道自己在干什么!
// start
ImageSyncContext imageSyncContext = new ImageSyncContext();
imageSyncContext.setDownloadAndCompressOnly(downloadAndCompressOnly);
// inner
imageSyncContext.setInnerWorkerAgentName(innerWorkerAgentName); // dev
ProjectQueryEntity projectQueryEntity = ProjectQueryEntity.builder().projectNamespace(projectNamespace).build();
Page<ProjectInfoPO> page = coreProjectService.projectQueryByEntity(projectQueryEntity);
if (page.getSize() < 1) {
log.error(" project name space error !");
return;
}
ProjectInfoPO projectInfoPO = page.getRecords().get(0);
imageSyncContext.setProjectInfoPO(projectInfoPO);
log.info("project name => {} namespace => {}", projectInfoPO.getProjectName(), projectInfoPO.getProjectNamespace());
// master
ProjectServerVO projectServerVO = coreProjectServerService.projectServerOne(projectInfoPO.getProjectId());
Optional<ServerInfoPO> master = projectServerVO.getBindingServerList().stream().filter(server -> StringUtils.startsWith(server.getRole(), "master")).findFirst();
if (master.isEmpty()) {
log.error("project master node not set ");
return;
}
imageSyncContext.setProjectMasterNode(master.get());
log.info("project master node inner ipv4 is => {}", master.get().getServerIpInV4());
imageSyncContext.setImageFullNameList(ImageFullNameList);
imageSyncContext.setCmiiAppNameTagList(CmiiAppNameList);
imageFuncScheduler.runProcedure(imageSyncContext);
}
@Test
public void downloadAndCompressOnly() {
ArrayList<String> CmiiAppNameList = new ArrayList<>(List.of(
// "harbor.cdcyy.com.cn/cmii/cmii-uav-mission:5.3.0-cqly-032802"
));
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
"harbor.cdcyy.com.cn/cmii/cmii-uav-industrial-portfolio:5.4.0-cqly-032802"
));
Boolean downloadAndCompressOnly = true;
String projectNamespace = "wdd";
// String innerWorkerAgentName = "Chengdu-amd64-65-lapwdd"; //wdd
String innerWorkerAgentName = "Chengdu-amd64-71-3571gd"; //prod
// 之下不要修改 除非你知道自己在干什么! // 之下不要修改 除非你知道自己在干什么!