Browse Source

更新构建配置相关接口

reghao 2 tháng trước cách đây
mục cha
commit
515290e3cd

+ 3 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/aliyun/controller/AliyunController.java

@@ -7,6 +7,7 @@ import cn.reghao.devops.mgr.ops.aliyun.model.vo.AliyunAccountVO;
 import cn.reghao.devops.mgr.ops.aliyun.model.vo.StsToken;
 import cn.reghao.devops.mgr.ops.aliyun.service.AliyunAccountService;
 import cn.reghao.devops.mgr.ops.aliyun.service.AliyunService;
+import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.web.WebResult;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
@@ -37,7 +38,8 @@ public class AliyunController {
     @Operation(summary = "添加阿里云帐号", description = "N")
     @PostMapping(value = "/key", produces = MediaType.APPLICATION_JSON_VALUE)
     public String addAliyunAccount(@RequestBody @Validated AliyunAccountDto aliyunAccountDto) {
-        return WebResult.success();
+        Result result = aliyunAccountService.addAliyunAccount(aliyunAccountDto);
+        return WebResult.result(result);
     }
 
     @Operation(summary = "阿里云 key 页面", description = "N")

+ 8 - 0
mgr/src/main/java/cn/reghao/devops/mgr/ops/aliyun/model/po/AliyunAccount.java

@@ -1,5 +1,6 @@
 package cn.reghao.devops.mgr.ops.aliyun.model.po;
 
+import cn.reghao.devops.mgr.ops.aliyun.model.dto.AliyunAccountDto;
 import cn.reghao.devops.mgr.ops.build.model.po.RepoAuthConfig;
 import cn.reghao.devops.mgr.util.BaseEntity;
 import jakarta.persistence.*;
@@ -44,4 +45,11 @@ public class AliyunAccount extends BaseEntity {
     private String region;
     @Deprecated
     private String roleArn;
+
+    public AliyunAccount(AliyunAccountDto aliyunAccountDto, RepoAuthConfig repoAuthConfig) {
+        this.type = "oss";
+        this.name = aliyunAccountDto.getName();
+        this.endpoint = aliyunAccountDto.getEndpoint();
+        this.repoAuthConfig = repoAuthConfig;
+    }
 }

+ 21 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/aliyun/service/AliyunAccountService.java

@@ -1,7 +1,12 @@
 package cn.reghao.devops.mgr.ops.aliyun.service;
 
 import cn.reghao.devops.mgr.ops.aliyun.db.repository.AliyunAccountRepository;
+import cn.reghao.devops.mgr.ops.aliyun.model.dto.AliyunAccountDto;
 import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
+import cn.reghao.devops.mgr.ops.build.db.repository.RepoAuthConfigRepository;
+import cn.reghao.devops.mgr.ops.build.model.po.RepoAuthConfig;
+import cn.reghao.jutil.jdk.web.result.Result;
+import cn.reghao.jutil.jdk.web.result.ResultStatus;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.stereotype.Service;
@@ -13,9 +18,24 @@ import org.springframework.stereotype.Service;
 @Service
 public class AliyunAccountService {
     private final AliyunAccountRepository aliyunAccountRepository;
+    private final RepoAuthConfigRepository repoAuthConfigRepository;
 
-    public AliyunAccountService(AliyunAccountRepository aliyunAccountRepository) {
+    public AliyunAccountService(AliyunAccountRepository aliyunAccountRepository,
+                                RepoAuthConfigRepository repoAuthConfigRepository) {
         this.aliyunAccountRepository = aliyunAccountRepository;
+        this.repoAuthConfigRepository = repoAuthConfigRepository;
+    }
+
+    public Result addAliyunAccount(AliyunAccountDto aliyunAccountDto) {
+        String repoAuthName = aliyunAccountDto.getRepoAuthName();
+        RepoAuthConfig repoAuthConfig = repoAuthConfigRepository.findByName(repoAuthName);
+        if (repoAuthConfig == null) {
+            return Result.result(ResultStatus.FAIL, String.format("认证 %s 不存在", repoAuthName));
+        }
+
+        AliyunAccount aliyunAccount = new AliyunAccount(aliyunAccountDto, repoAuthConfig);
+        aliyunAccountRepository.save(aliyunAccount);
+        return Result.success();
     }
 
     public Page<AliyunAccount> getAliyunAccounts() {

+ 8 - 7
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/controller/PackerController.java

@@ -2,6 +2,7 @@ package cn.reghao.devops.mgr.ops.build.controller;
 
 import cn.reghao.devops.common.msg.constant.PackType;
 import cn.reghao.devops.mgr.ops.aliyun.db.repository.AliyunAccountRepository;
+import cn.reghao.devops.mgr.ops.build.model.dto.PackerConfigDto;
 import cn.reghao.devops.mgr.ops.build.model.vo.PackerConfigVO;
 import cn.reghao.devops.mgr.util.SelectOption;
 import cn.reghao.devops.mgr.ops.docker.db.repository.DockerRegistryRepository;
@@ -53,7 +54,7 @@ public class PackerController {
 
     @Operation(summary = "打包类型列表", description = "N")
     @GetMapping("/pack_types")
-    public String addPackerPage() {
+    public String getPackerTypes() {
         List<SelectOption> packTypes = Arrays.stream(PackType.values())
                 .map(packType -> new SelectOption(packType.name(), packType.name()))
                 .collect(Collectors.toList());
@@ -61,9 +62,9 @@ public class PackerController {
         List<SelectOption> registryList = dockerRegistryRepository.findAll()
                 .stream()
                 .map(dockerRegistry -> {
+                    String registry = dockerRegistry.toString();
                     Integer id = dockerRegistry.getId();
-                    String registryUrl = dockerRegistry.getRegistryUrl();
-                    return new SelectOption(registryUrl, String.valueOf(id));
+                    return new SelectOption(registry, String.valueOf(id));
                 })
                 .collect(Collectors.toList());
 
@@ -71,8 +72,8 @@ public class PackerController {
                 .stream()
                 .map(aliyunAccount -> {
                     String name = aliyunAccount.getName();
-                    String value = aliyunAccount.getName();
-                    return new SelectOption(name, value);
+                    Integer id = aliyunAccount.getId();
+                    return new SelectOption(name, String.valueOf(id));
                 })
                 .collect(Collectors.toList());
 
@@ -102,8 +103,8 @@ public class PackerController {
 
     @Operation(summary = "添加应用打包配置", description = "N")
     @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addPackConfig(@RequestBody @Validated PackerConfig packerConfig) {
-        Result result = packerConfigService.addOrUpdate(packerConfig);
+    public String addPackConfig(@RequestBody @Validated PackerConfigDto packerConfigDto) {
+        Result result = packerConfigService.addOrUpdate(packerConfigDto);
         return WebResult.result(result);
     }
 

+ 48 - 0
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/dto/PackerConfigDto.java

@@ -0,0 +1,48 @@
+package cn.reghao.devops.mgr.ops.build.model.dto;
+
+import cn.reghao.devops.common.msg.constant.PackType;
+import cn.reghao.devops.mgr.ops.build.model.provider.PackerConfigDtoGroupSequenceProvider;
+import cn.reghao.jutil.jdk.web.validator.ValidEnum;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.group.GroupSequenceProvider;
+
+/**
+ * @author reghao
+ * @date 2026-03-26 09:33:10
+ */
+@GroupSequenceProvider(PackerConfigDtoGroupSequenceProvider.class)
+@NoArgsConstructor
+@Data
+public class PackerConfigDto {
+    @ValidEnum(value = PackType.class, message = "请选择正确的打包类型")
+    private String type;
+    @NotBlank(message = "打包名字不能包含空白符")
+    @Length(max = 255, message = "打包名字的最大长度不能超过 255 个字符")
+    private String name;
+    // 构建生成的可执行文件及配置文件, 脚本文件等所在的目录路径(相对于源码根目录)
+    @NotBlank(groups = { ZipPacker.class, OssStaticPacker.class }, message = "构建产物路径不能为空")
+    private String artifactPath;
+
+    @NotNull(groups = { DockerPacker.class }, message = "dockerRegistry 不能为 null")
+    private Integer dockerRegistryId;
+
+    @NotNull(groups = { OssStaticPacker.class }, message = "ossEndpoint 不能为 null")
+    private Integer ossEndpointId;
+    // 打包后的应用存放的位置,可以是一个本地目录,也可以是一个网络位置
+    // 根据打包类型来确定
+    //@NotBlank(groups = { ZipPacker.class }, message = "可执行包的存放位置不能为空白字符串")
+    private String targetPath;
+
+    public interface DockerPacker {
+    }
+
+    public interface OssStaticPacker {
+    }
+
+    public interface ZipPacker {
+    }
+}

+ 23 - 39
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/po/PackerConfig.java

@@ -1,24 +1,13 @@
 package cn.reghao.devops.mgr.ops.build.model.po;
 
 import cn.reghao.devops.common.docker.model.DockerAuth;
-import cn.reghao.devops.common.msg.constant.PackType;
 import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
-import cn.reghao.devops.mgr.ops.build.model.provider.PackerConfigGroupSequenceProvider;
+import cn.reghao.devops.mgr.ops.build.model.dto.PackerConfigDto;
 import cn.reghao.devops.mgr.ops.builder.model.dto.PackerDto;
 import cn.reghao.devops.mgr.util.BaseEntity;
-import cn.reghao.jutil.jdk.web.validator.ValidEnum;
-import lombok.Getter;
+import jakarta.persistence.*;
+import lombok.Data;
 import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.group.GroupSequenceProvider;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.OneToOne;
-import jakarta.persistence.Table;
-import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotNull;
 
 /**
  * 打包方式配置
@@ -26,48 +15,43 @@ import jakarta.validation.constraints.NotNull;
  * @author reghao
  * @date 2020-05-13 16:40:22
  */
-@GroupSequenceProvider(PackerConfigGroupSequenceProvider.class)
 @NoArgsConstructor
-@Getter
-@Setter
+@Data
 @Entity
 @Table(name = "devops_packer_config")
 public class PackerConfig extends BaseEntity {
-    @ValidEnum(value = PackType.class, message = "请选择正确的打包类型")
     private String type;
-    @NotBlank(message = "打包名字不能包含空白符")
-    @Length(max = 255, message = "打包名字的最大长度不能超过 255 个字符")
     @Column(nullable = false, unique = true)
     private String name;
     // 构建生成的可执行文件及配置文件, 脚本文件等所在的目录路径(相对于源码根目录)
-    @NotBlank(groups = { ZipPacker.class }, message = "构建产物路径不能为空")
     private String artifactPath;
-    @NotNull(groups = { DockerPacker.class }, message = "dockerRegistry 不能为 null")
-    @OneToOne
-    private DockerRegistry dockerRegistry;
-    @NotNull(groups = { OssStaticPacker.class }, message = "ossEndpoint 不能为 null")
-    @OneToOne
-    private AliyunAccount ossEndpoint;
-    // 打包后的应用存放的位置,可以是一个本地目录,也可以是一个网络位置
-    // 根据打包类型来确定
-    @NotBlank(groups = { ZipPacker.class }, message = "可执行包的存放位置不能为空白字符串")
-    private String targetPath;
-
-    public interface DockerPacker {
-    }
 
-    public interface OssStaticPacker {
-    }
+    @ManyToOne(cascade = CascadeType.REFRESH)
+    @JoinColumn(name = "docker_registry_id")
+    private DockerRegistry targetPathDocker;
 
-    public interface ZipPacker {
+    @ManyToOne(cascade = CascadeType.REFRESH)
+    @JoinColumn(name = "aliyun_account_id")
+    private AliyunAccount targetPathOss;
+    // 打包后的应用存放的位置,可以是一个本地目录,也可以是一个网络位置
+    // 根据打包类型来确定
+    private String targetPathLocal;
+
+    public PackerConfig(PackerConfigDto packerConfigDto, DockerRegistry dockerRegistry, AliyunAccount ossEndpoint) {
+        this.type = packerConfigDto.getType();
+        this.name = packerConfigDto.getName();
+        this.artifactPath = packerConfigDto.getArtifactPath();
+        this.targetPathDocker = dockerRegistry;
+        this.targetPathOss = ossEndpoint;
+        this.targetPathLocal = packerConfigDto.getTargetPath();
     }
 
     public PackerDto getPackerDto() {
-        return new PackerDto(this.type, this.name, this.targetPath, this.artifactPath);
+        return new PackerDto(this.type, this.name, this.targetPathLocal, this.artifactPath);
     }
 
     public DockerAuth getDockerAuth() {
-        DockerRegistry registry = this.dockerRegistry;
+        DockerRegistry registry = this.targetPathDocker;
         if (registry != null) {
             String username = registry.getRepoAuthConfig().getUsername();
             String password = registry.getRepoAuthConfig().getPassword();

+ 9 - 9
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/provider/PackerConfigGroupSequenceProvider.java → mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/provider/PackerConfigDtoGroupSequenceProvider.java

@@ -1,7 +1,7 @@
 package cn.reghao.devops.mgr.ops.build.model.provider;
 
 import cn.reghao.devops.common.msg.constant.PackType;
-import cn.reghao.devops.mgr.ops.build.model.po.PackerConfig;
+import cn.reghao.devops.mgr.ops.build.model.dto.PackerConfigDto;
 import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;
 
 import java.util.ArrayList;
@@ -11,20 +11,20 @@ import java.util.List;
  * @author reghao
  * @date 2023-03-13 17:49:57
  */
-public class PackerConfigGroupSequenceProvider implements DefaultGroupSequenceProvider<PackerConfig> {
+public class PackerConfigDtoGroupSequenceProvider implements DefaultGroupSequenceProvider<PackerConfigDto> {
     @Override
-    public List<Class<?>> getValidationGroups(PackerConfig packerConfig) {
+    public List<Class<?>> getValidationGroups(PackerConfigDto packerConfigDto) {
         List<Class<?>> defaultGroupSequence = new ArrayList<>();
-        defaultGroupSequence.add(PackerConfig.class);
+        defaultGroupSequence.add(PackerConfigDto.class);
 
-        if (packerConfig != null) {
-            String packType = packerConfig.getType();
+        if (packerConfigDto != null) {
+            String packType = packerConfigDto.getType();
             if (packType.equals(PackType.docker.getName())) {
-                defaultGroupSequence.add(PackerConfig.DockerPacker.class);
+                defaultGroupSequence.add(PackerConfigDto.DockerPacker.class);
             } else if (packType.equals(PackType.ossStatic.getName())) {
-                defaultGroupSequence.add(PackerConfig.OssStaticPacker.class);
+                defaultGroupSequence.add(PackerConfigDto.OssStaticPacker.class);
             } else if (packType.equals(PackType.zip.getName())) {
-                defaultGroupSequence.add(PackerConfig.ZipPacker.class);
+                defaultGroupSequence.add(PackerConfigDto.ZipPacker.class);
             }
         }
 

+ 1 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/vo/PackerConfigVO.java

@@ -24,7 +24,7 @@ public class PackerConfigVO {
         this.type = packerConfig.getType();
         this.name = packerConfig.getName();
         this.artifactPath = packerConfig.getArtifactPath() == null ? NotAvailable.na.getDesc() : packerConfig.getArtifactPath();
-        this.dockerRegistry = packerConfig.getDockerRegistry() != null ? packerConfig.getDockerRegistry().toString() : NotAvailable.na.getDesc();
+        this.dockerRegistry = packerConfig.getTargetPathDocker() != null ? packerConfig.getTargetPathDocker().toString() : NotAvailable.na.getDesc();
         this.useCount = 0;
     }
 }

+ 2 - 2
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/service/PackerConfigService.java

@@ -1,6 +1,6 @@
 package cn.reghao.devops.mgr.ops.build.service;
 
-import cn.reghao.devops.mgr.ops.build.model.po.PackerConfig;
+import cn.reghao.devops.mgr.ops.build.model.dto.PackerConfigDto;
 import cn.reghao.jutil.jdk.web.result.Result;
 
 /**
@@ -8,6 +8,6 @@ import cn.reghao.jutil.jdk.web.result.Result;
  * @date 2021-09-17 15:54:16
  */
 public interface PackerConfigService {
-    Result addOrUpdate(PackerConfig packerConfig);
+    Result addOrUpdate(PackerConfigDto packerConfigDto);
     Result delete(int id);
 }

+ 34 - 13
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/service/impl/PackerConfigServiceImpl.java

@@ -1,11 +1,15 @@
 package cn.reghao.devops.mgr.ops.build.service.impl;
 
 import cn.reghao.devops.common.msg.constant.PackType;
+import cn.reghao.devops.mgr.ops.aliyun.db.repository.AliyunAccountRepository;
+import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
 import cn.reghao.devops.mgr.ops.app.db.query.AppBuildQuery;
 import cn.reghao.devops.mgr.ops.build.db.repository.PackerConfigRepository;
+import cn.reghao.devops.mgr.ops.build.model.dto.PackerConfigDto;
 import cn.reghao.devops.mgr.ops.build.model.po.DockerRegistry;
 import cn.reghao.devops.mgr.ops.build.model.po.PackerConfig;
 import cn.reghao.devops.mgr.ops.build.service.PackerConfigService;
+import cn.reghao.devops.mgr.ops.docker.db.repository.DockerRegistryRepository;
 import cn.reghao.jutil.jdk.web.result.Result;
 import cn.reghao.jutil.jdk.web.result.ResultStatus;
 import org.springframework.stereotype.Service;
@@ -18,32 +22,49 @@ import org.springframework.stereotype.Service;
 public class PackerConfigServiceImpl implements PackerConfigService {
     private final PackerConfigRepository packerConfigRepository;
     private final AppBuildQuery appBuildQuery;
+    private final DockerRegistryRepository dockerRegistryRepository;
+    private final AliyunAccountRepository aliyunAccountRepository;
 
-    public PackerConfigServiceImpl(PackerConfigRepository packerConfigRepository, AppBuildQuery appBuildQuery) {
+    public PackerConfigServiceImpl(PackerConfigRepository packerConfigRepository, AppBuildQuery appBuildQuery,
+                                   DockerRegistryRepository dockerRegistryRepository,
+                                   AliyunAccountRepository aliyunAccountRepository) {
         this.packerConfigRepository = packerConfigRepository;
         this.appBuildQuery = appBuildQuery;
+        this.dockerRegistryRepository = dockerRegistryRepository;
+        this.aliyunAccountRepository = aliyunAccountRepository;
     }
 
     @Override
-    public Result addOrUpdate(PackerConfig packerConfig) {
-        String type = packerConfig.getType();
-        if (type.equals(PackType.zip.getName())) {
-            packerConfig.setTargetPath("/");
+    public Result addOrUpdate(PackerConfigDto packerConfigDto) {
+        String type = packerConfigDto.getType();
+        DockerRegistry dockerRegistry = null;
+        Integer dockerRegistryId = packerConfigDto.getDockerRegistryId();
+        if (dockerRegistryId != null) {
+            dockerRegistry = dockerRegistryRepository.findById(dockerRegistryId).orElse(null);
+            if (type.equals(PackType.docker.getName()) && dockerRegistry == null) {
+                return Result.result(ResultStatus.FAIL, "DockerRegistry 不存在");
+            }
         }
 
-        DockerRegistry dockerRegistry = packerConfig.getDockerRegistry();
-        if (type.equals(PackType.docker.getName()) && dockerRegistry == null) {
-            return Result.result(ResultStatus.FAIL, "DockerRegistry 不存在");
+        AliyunAccount ossEndpoint = null;
+        Integer ossEndpointId = packerConfigDto.getOssEndpointId();
+        if (ossEndpointId != null) {
+            ossEndpoint = aliyunAccountRepository.findById(ossEndpointId).orElse(null);
+            if (type.equals(PackType.ossStatic.getName()) && ossEndpoint == null) {
+                return Result.result(ResultStatus.FAIL, "OssEndpoint 不存在");
+            }
         }
 
-        String name = packerConfig.getName();
+        String name = packerConfigDto.getName();
         PackerConfig entity = packerConfigRepository.findByName(name);
-        if (entity == null) {
-            packerConfigRepository.save(packerConfig);
-            return Result.result(ResultStatus.SUCCESS);
+        if (entity != null) {
+            return Result.result(ResultStatus.FAIL, String.format("打包配置 %s 已存在", name));
         }
 
-        packerConfig.setEntity(entity);
+        PackerConfig packerConfig = new PackerConfig(packerConfigDto, dockerRegistry, ossEndpoint);
+        if (type.equals(PackType.zip.getName())) {
+            packerConfig.setTargetPathLocal("/");
+        }
         packerConfigRepository.save(packerConfig);
         return Result.result(ResultStatus.SUCCESS);
     }

+ 1 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/builder/model/vo/BuildConfigSnapshot.java

@@ -53,7 +53,7 @@ public class BuildConfigSnapshot {
         this.packType = appConfig.getPackerConfig().getType();
         this.packName = appConfig.getPackerConfig().getName();
         this.artifactPath = appConfig.getPackerConfig().getArtifactPath();
-        this.targetPath = appConfig.getPackerConfig().getTargetPath();
+        this.targetPath = appConfig.getPackerConfig().getTargetPathLocal();
         this.dockerfile = appConfig.getDockerfile();
     }
 }

+ 1 - 3
mgr/src/main/java/cn/reghao/devops/mgr/ops/builder/service/PipelineContextFactory.java

@@ -26,9 +26,7 @@ public class PipelineContextFactory {
         PackerConfig packerConfig = appConfig.getPackerConfig();
         String packType = packerConfig.getType();
         if (packType.equals(PackType.docker.getName())) {
-            String registry = packerConfig.getDockerRegistry().getRegistryUrl();
-            String namespace = packerConfig.getDockerRegistry().getRegistryNamespace();
-            String dockerRegistry = String.format("%s/%s", registry, namespace);
+            String dockerRegistry = packerConfig.getTargetPathDocker().toString();
             ctx.setDockerRegistry(dockerRegistry);
         }
 

+ 1 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/builder/service/impl/DeployAppImpl.java

@@ -103,7 +103,7 @@ public class DeployAppImpl implements DeployApp {
         deployParam.setStartScript(startScript);
         deployParam.setStartHome(startHome);
         if (packType.equals(PackType.docker.getName())) {
-            DockerRegistry registry = appDeployConfig.getAppConfig().getPackerConfig().getDockerRegistry();
+            DockerRegistry registry = appDeployConfig.getAppConfig().getPackerConfig().getTargetPathDocker();
             if (registry != null) {
                 String username = registry.getRepoAuthConfig().getUsername();
                 String password = registry.getRepoAuthConfig().getPassword();

+ 5 - 3
mgr/src/main/java/cn/reghao/devops/mgr/ops/builder/service/task/OssDeployTask.java

@@ -1,6 +1,7 @@
 package cn.reghao.devops.mgr.ops.builder.service.task;
 
 import cn.reghao.devops.common.msg.event.EvtAppStatResult;
+import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
 import cn.reghao.devops.mgr.ops.aliyun.service.AliyunOss;
 import cn.reghao.devops.mgr.ops.build.model.po.PackerConfig;
 import cn.reghao.devops.mgr.ops.builder.model.po.AppBuilding;
@@ -43,9 +44,10 @@ public class OssDeployTask implements Runnable {
         String destDirPath = LocalBuildDir.packDir + File.separator + appId + File.separator + dirname;
         File destDir = new File(destDirPath);
         if (destDir.exists()) {
-            String endpoint = packerConfig.getOssEndpoint().getEndpoint();
-            String accessKeyId = packerConfig.getOssEndpoint().getRepoAuthConfig().getUsername();
-            String accessKeySecret = packerConfig.getOssEndpoint().getRepoAuthConfig().getPassword();
+            AliyunAccount aliyunAccount = packerConfig.getTargetPathOss();
+            String endpoint = aliyunAccount.getEndpoint();
+            String accessKeyId = aliyunAccount.getRepoAuthConfig().getUsername();
+            String accessKeySecret = aliyunAccount.getRepoAuthConfig().getPassword();
             OSS ossClient = aliyunOss.getOssClient(endpoint, accessKeyId, accessKeySecret);
 
             // oss 机器 ID 格式: oss.bucketName