Parcourir la source

调整构建配置相关接口

reghao il y a 2 jours
Parent
commit
77c5e8dc57

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

@@ -2,6 +2,7 @@ package cn.reghao.devops.mgr.ops.aliyun.controller;
 
 import cn.reghao.devops.mgr.ops.aliyun.model.dto.GetSignedUrl;
 import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
+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;
@@ -37,7 +38,7 @@ public class AliyunController {
     @GetMapping("/key")
     public String aliyunKeyPage() {
         Page<AliyunAccount> page = aliyunAccountService.getAliyunAccounts();
-        List<AliyunAccount> list = page.getContent();
+        List<AliyunAccountVO> list = page.map(AliyunAccountVO::new).stream().collect(Collectors.toList());
         return WebResult.success(list);
     }
 

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

@@ -37,8 +37,11 @@ public class AliyunAccount extends BaseEntity {
     /*@Column(nullable = false)
     private String ramUser;*/
     // aliyun oss 使用字段
+    @Deprecated
     private String bucketName;
     // aliyun cdn 使用字段
+    @Deprecated
     private String region;
+    @Deprecated
     private String roleArn;
 }

+ 25 - 0
mgr/src/main/java/cn/reghao/devops/mgr/ops/aliyun/model/vo/AliyunAccountVO.java

@@ -0,0 +1,25 @@
+package cn.reghao.devops.mgr.ops.aliyun.model.vo;
+
+import cn.reghao.devops.mgr.ops.aliyun.model.po.AliyunAccount;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author reghao
+ * @date 2026-03-23 11:09:06
+ */
+@NoArgsConstructor
+@Data
+public class AliyunAccountVO {
+    private String type;
+    private String name;
+    private String endpoint;
+    private String repoAuthName;
+
+    public AliyunAccountVO(AliyunAccount aliyunAccount) {
+        this.type = aliyunAccount.getType();
+        this.name = aliyunAccount.getName();
+        this.endpoint = aliyunAccount.getEndpoint();
+        this.repoAuthName = aliyunAccount.getRepoAuthConfig().getName();
+    }
+}

+ 1 - 2
mgr/src/main/java/cn/reghao/devops/mgr/ops/aliyun/service/AliyunService.java

@@ -80,8 +80,7 @@ public class AliyunService {
     }
 
     public String getSignedUrl(String objectName) {
-        String bucketName = "";
-        String signedUrl = aliyunOss.getSignedUrl(bucketName, objectName);
+        String signedUrl = aliyunOss.getSignedUrl("", objectName);
         if (signedUrl != null) {
             return signedUrl.replace(ossDomain, myDomain);
         }

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

@@ -70,8 +70,8 @@ public class PackerController {
         List<SelectOption> ossList = aliyunAccountRepository.findByType("oss")
                 .stream()
                 .map(aliyunAccount -> {
-                    String name = aliyunAccount.getBucketName();
-                    String value = aliyunAccount.getBucketName();
+                    String name = aliyunAccount.getName();
+                    String value = aliyunAccount.getName();
                     return new SelectOption(name, value);
                 })
                 .collect(Collectors.toList());

+ 1 - 1
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/model/constant/RepoType.java

@@ -7,7 +7,7 @@ package cn.reghao.devops.mgr.ops.build.model.constant;
  * @date 2021-02-05 22:50:41
  */
 public enum RepoType {
-    git, docker;
+    git, docker, aliyun;
 
     public String getName() {
         return this.name();