v2 提交新的模型,但是模型不能运行,如果要运行,把ci-process卸载pom
This commit is contained in:
parent
527261b2b4
commit
1f4ea9850c
6
.idea/CopilotChatHistory.xml
generated
6
.idea/CopilotChatHistory.xml
generated
@ -3,6 +3,12 @@
|
||||
<component name="CopilotChatHistory">
|
||||
<option name="conversations">
|
||||
<list>
|
||||
<Conversation>
|
||||
<option name="createTime" value="1742865447371" />
|
||||
<option name="id" value="0195cae039cb7104baf7df0c3a728264" />
|
||||
<option name="title" value="新对话 2025年3月25日 09:17:27" />
|
||||
<option name="updateTime" value="1742865447371" />
|
||||
</Conversation>
|
||||
<Conversation>
|
||||
<option name="createTime" value="1742608842189" />
|
||||
<option name="id" value="0195bb94bdcd743086259021051aff68" />
|
||||
|
32
.idea/compiler.xml
generated
32
.idea/compiler.xml
generated
@ -3,20 +3,15 @@
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
</profile>
|
||||
<profile name="Annotation profile for ops-pro" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="false">
|
||||
<entry name="$PROJECT_DIR$/../repo/org/springframework/boot/spring-boot-configuration-processor/3.3.4/spring-boot-configuration-processor-3.3.4.jar" />
|
||||
<entry name="$PROJECT_DIR$/../repo/org/projectlombok/lombok/1.18.34/lombok-1.18.34.jar" />
|
||||
<entry name="$PROJECT_DIR$/../repo/org/mapstruct/mapstruct-processor/1.6.2/mapstruct-processor-1.6.2.jar" />
|
||||
<entry name="$PROJECT_DIR$/../repo/org/mapstruct/mapstruct/1.6.2/mapstruct-1.6.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-configuration-processor/3.3.4/spring-boot-configuration-processor-3.3.4.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.34/lombok-1.18.34.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/mapstruct/mapstruct-processor/1.6.2/mapstruct-processor-1.6.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/mapstruct/mapstruct/1.6.2/mapstruct-1.6.2.jar" />
|
||||
</processorPath>
|
||||
<module name="ci-scm-repository" />
|
||||
<module name="spring-boot-starter-protection" />
|
||||
@ -24,6 +19,7 @@
|
||||
<module name="spring-boot-starter-monitor" />
|
||||
<module name="module-system-biz" />
|
||||
<module name="ci-quality" />
|
||||
<module name="common-pipeline" />
|
||||
<module name="module-system-api" />
|
||||
<module name="spring-boot-starter-mq" />
|
||||
<module name="spring-boot-starter-mongo" />
|
||||
@ -40,26 +36,36 @@
|
||||
<module name="spring-boot-starter-test" />
|
||||
<module name="spring-boot-starter-websocket" />
|
||||
<module name="system-plugin-example-web" />
|
||||
<module name="ci-worker" />
|
||||
<module name="spring-boot-starter-biz-ip" />
|
||||
<module name="module-infra-biz" />
|
||||
<module name="spring-boot-starter-job" />
|
||||
<module name="ci-project" />
|
||||
<module name="common-api" />
|
||||
<module name="ci-environment" />
|
||||
<module name="spring-boot-starter-web" />
|
||||
<module name="ci-commons" />
|
||||
<module name="spring-boot-starter-excel" />
|
||||
<module name="spring-boot-starter-biz-tenant" />
|
||||
<module name="spring-boot-starter-redis" />
|
||||
<module name="spring-boot-starter-security" />
|
||||
</profile>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="ci-worker" target="1.8" />
|
||||
<module name="pipeline-ci-api" target="17" />
|
||||
<module name="pipeline-ci-common" target="17" />
|
||||
<module name="pipline-ci-common" target="17" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="app-plugins" options="-parameters" />
|
||||
<module name="ci-commons" options="-parameters" />
|
||||
<module name="ci-environment" options="-parameters" />
|
||||
<module name="ci-event" options="-parameters" />
|
||||
<module name="ci-log" options="-parameters" />
|
||||
<module name="ci-market" options="-parameters" />
|
||||
@ -69,6 +75,8 @@
|
||||
<module name="ci-scm-repository" options="-parameters" />
|
||||
<module name="ci-ticket" options="-parameters" />
|
||||
<module name="ci-worker" options="-parameters" />
|
||||
<module name="common-api" options="-parameters" />
|
||||
<module name="common-pipeline" options="-parameters" />
|
||||
<module name="commons" options="-parameters" />
|
||||
<module name="framework" options="-parameters" />
|
||||
<module name="module-infra-api" options="-parameters" />
|
||||
@ -78,7 +86,9 @@
|
||||
<module name="modules" options="-parameters" />
|
||||
<module name="ops-pro" options="-parameters" />
|
||||
<module name="ops-server" options="-parameters" />
|
||||
<module name="pipeline-ci-api" options="-parameters" />
|
||||
<module name="pipeline-ci-process-api" options="-parameters" />
|
||||
<module name="pipline-ci-common" options="-parameters" />
|
||||
<module name="spring-boot-starter-biz-data-permission" options="-parameters" />
|
||||
<module name="spring-boot-starter-biz-ip" options="-parameters" />
|
||||
<module name="spring-boot-starter-biz-tenant" options="-parameters" />
|
||||
|
10
.idea/encodings.xml
generated
10
.idea/encodings.xml
generated
@ -39,14 +39,24 @@
|
||||
<file url="file://$PROJECT_DIR$/framework/spring-boot-starter-websocket/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/framework/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/framework/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/common-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/common-api/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/common-pipeline/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/common-pipeline/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/pipeline-ci-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/pipline-ci-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-commons/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-environment/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-environment/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-event/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-event/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-log/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-log/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-market/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-market/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-process/pipeline-ci-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-process/pipeline-ci-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-process/pipeline-ci-process-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-process/pipeline-ci-process-api/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/modules/ci-process/src/main/java" charset="UTF-8" />
|
||||
|
8
.idea/gradle.xml
generated
8
.idea/gradle.xml
generated
@ -3,6 +3,14 @@
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/modules/ci-commons/pipeline-ci-common" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/pipeline-ci-common" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/modules/pipeline-ci-process/ci-process-api" />
|
||||
<option name="modules">
|
||||
|
10
.idea/jarRepositories.xml
generated
10
.idea/jarRepositories.xml
generated
@ -31,16 +31,16 @@
|
||||
<option name="name" value="aliyun" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="huaweicloud" />
|
||||
<option name="name" value="huawei" />
|
||||
<option name="url" value="https://mirrors.huaweicloud.com/repository/maven/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="aliyunmaven" />
|
||||
<option name="name" value="aliyun" />
|
||||
|
11
.idea/misc.xml
generated
11
.idea/misc.xml
generated
@ -27,6 +27,7 @@
|
||||
<option name="excludeFilter" value="" />
|
||||
</component>
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$/modules/ci-commons/pipeline-ci-common" />
|
||||
<file type="web" url="file://$PROJECT_DIR$/modules/ci-process/ci-process-api" />
|
||||
<file type="web" url="file://$PROJECT_DIR$/modules/ci-process/ci-process-base" />
|
||||
</component>
|
||||
@ -37,8 +38,18 @@
|
||||
<option value="$PROJECT_DIR$/modules/pipeline-ci-process/pipeline-ci-process-api/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-process/pipeline-ci-process-api/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-worker/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/pipline-ci-common/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/pipeline-ci-api/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/common-api/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/common-pipeline/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/pipeline-ci-api/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/modules/ci-commons/pipline-ci-common/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
<component name="SuppressionsComponent">
|
||||
|
31
modules/ci-commons/common-api/pom.xml
Normal file
31
modules/ci-commons/common-api/pom.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cd.casic.ci</groupId>
|
||||
<artifactId>ci-commons</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>cd.casic.ci</groupId>
|
||||
<artifactId>common-api</artifactId>
|
||||
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>common-api</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cd.casic.boot</groupId>
|
||||
<artifactId>commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cd.casic.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.constant;
|
||||
package cd.casic.ci.common.api.constant;
|
||||
|
||||
/**
|
||||
* @Classname BaseConstant
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.constant;
|
||||
package cd.casic.ci.common.api.constant;
|
||||
|
||||
/**
|
||||
* @Classname LeafAllocConstant
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.constant;
|
||||
package cd.casic.ci.common.api.constant;
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.enums;
|
||||
package cd.casic.ci.common.api.enums;
|
||||
|
||||
/**
|
||||
* @Classname StyleEnum
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.enums;
|
||||
package cd.casic.ci.common.api.enums;
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.enums;
|
||||
package cd.casic.ci.common.api.enums;
|
||||
|
||||
/**
|
||||
* @author mianbin
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.functions;
|
||||
package cd.casic.ci.common.api.functions;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.operationid;
|
||||
package cd.casic.ci.common.api.operationid;
|
||||
|
||||
import cd.casic.ci.commons.operationid.entity.LeafAlloc;
|
||||
import cd.casic.framework.mybatis.core.mapper.BaseMapperX;
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.operationid;
|
||||
package cd.casic.ci.common.api.operationid;
|
||||
|
||||
|
||||
import cd.casic.ci.commons.operationid.entity.LeafAlloc;
|
@ -1,6 +1,8 @@
|
||||
package cd.casic.ci.commons.operationid;
|
||||
|
||||
|
||||
import cd.casic.ci.common.api.operationid.LeafAllocMapper;
|
||||
import cd.casic.ci.common.api.operationid.LeafAllocService;
|
||||
import cd.casic.ci.commons.operationid.entity.LeafAlloc;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
@ -1,10 +1,10 @@
|
||||
package cd.casic.ci.commons.operationid;
|
||||
package cd.casic.ci.common.api.operationid;
|
||||
|
||||
|
||||
import cd.casic.ci.commons.constant.LeafAllocConstant;
|
||||
import cd.casic.ci.common.api.constant.LeafAllocConstant;
|
||||
import cd.casic.ci.common.api.operationid.entity.Segment;
|
||||
import cd.casic.ci.common.api.operationid.entity.SegmentBuffer;
|
||||
import cd.casic.ci.commons.operationid.entity.LeafAlloc;
|
||||
import cd.casic.ci.commons.operationid.entity.Segment;
|
||||
import cd.casic.ci.commons.operationid.entity.SegmentBuffer;
|
||||
import cd.casic.framework.commons.exception.ErrorCode;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
import cd.casic.framework.commons.util.generator.IdGenerator;
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.operationid.entity;
|
||||
package cd.casic.ci.common.api.operationid.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cd.casic.ci.commons.operationid.entity;
|
||||
package cd.casic.ci.common.api.operationid.entity;
|
||||
|
||||
import cd.casic.ci.common.api.operationid.entity.Segment;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
@ -1,4 +1,4 @@
|
||||
package cd.casic.ci.commons.operationid.entity;
|
||||
package cd.casic.ci.common.api.operationid.entity;
|
||||
/**
|
||||
* @author mianbin
|
||||
* @Classname Segment
|
@ -0,0 +1 @@
|
||||
spring.application.name=common-api
|
@ -0,0 +1,13 @@
|
||||
package cd.casic.ci.common.api;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class CommonApiApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
33
modules/ci-commons/common-pipeline/.gitignore
vendored
Normal file
33
modules/ci-commons/common-pipeline/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
26
modules/ci-commons/common-pipeline/pom.xml
Normal file
26
modules/ci-commons/common-pipeline/pom.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cd.casic.ci</groupId>
|
||||
<artifactId>ci-commons</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>cd.casic.ci</groupId>
|
||||
<artifactId>common-pipeline</artifactId>
|
||||
<version>${revision}</version>
|
||||
<name>common-pipeline</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cd.casic.boot</groupId>
|
||||
<artifactId>commons</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CommonPipelineApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CommonPipelineApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:CommonPipelineAutoConfiguration
|
||||
* @Date:2025/03/25 17:30
|
||||
* @Filename:CommonPipelineAutoConfiguration
|
||||
* @description:Todo
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE)
|
||||
public class CommonPipelineAutoConfiguration {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void registerSubtypesObjectMapper() {
|
||||
ElementSubTypeRegisterLoader.registerElement(objectMapper);
|
||||
DispatchSubTypeRegisterLoader.registerType();
|
||||
DispatchSubInfoRegisterLoader.registerInfo();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:DispatchSubInfoFetcher
|
||||
* @Date:2025/03/25 17:34
|
||||
* @Filename:DispatchSubInfoFetcher
|
||||
* @description:Todo
|
||||
*/
|
||||
public interface DispatchSubInfoFetcher {
|
||||
|
||||
/**
|
||||
* 返回扩展的子类
|
||||
*/
|
||||
Map<String, Class<? extends DispatchInfo>> jsonSubInfo();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import com.fasterxml.jackson.databind.jsontype.NamedType;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:DispatchSubInfoRegisterLoader
|
||||
* @Date:2025/03/25 17:34
|
||||
* @Filename:DispatchSubInfoRegisterLoader
|
||||
* @description:Todo
|
||||
*/
|
||||
@Slf4j
|
||||
public class DispatchSubInfoRegisterLoader {
|
||||
|
||||
public static void registerInfo() {
|
||||
Class<DispatchSubInfoFetcher> clazz = DispatchSubInfoFetcher.class;
|
||||
ServiceLoader<DispatchSubInfoFetcher> fetcheries = ServiceLoader.load(clazz);
|
||||
|
||||
if (!fetcheries.iterator().hasNext()) {
|
||||
fetcheries = ServiceLoader.load(clazz, ServiceLoader.class.getClassLoader());
|
||||
}
|
||||
SimpleModule infoSubModule = new SimpleModule();
|
||||
for (DispatchSubInfoFetcher fetcher : fetcheries) {
|
||||
log.info("[DISPATCH_FETCHER]| {}", fetcher.getClass());
|
||||
Map<String, Class<? extends DispatchInfo>> jsonSubTypes = fetcher.jsonSubInfo();
|
||||
for (Map.Entry<String, Class<? extends DispatchInfo>> entry : jsonSubTypes.entrySet()) {
|
||||
infoSubModule.registerSubtypes(new NamedType(entry.getValue(), entry.getKey()));
|
||||
log.info("[REGISTER_DISPATCH]|{} for {}", entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
JsonUtil.registerModule(infoSubModule);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:DispatchSubTypeFetcher
|
||||
* @Date:2025/03/25 17:36
|
||||
* @Filename:DispatchSubTypeFetcher
|
||||
* @description:Todo
|
||||
*/
|
||||
public interface DispatchSubTypeFetcher {
|
||||
|
||||
/**
|
||||
* 返回扩展的子类
|
||||
*/
|
||||
Map<String, Class<? extends DispatchType>> jsonSubTypes();
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import com.fasterxml.jackson.databind.jsontype.NamedType;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:DispatchSubTypeRegisterLoader
|
||||
* @Date:2025/03/25 17:37
|
||||
* @Filename:DispatchSubTypeRegisterLoader
|
||||
* @description:Todo
|
||||
*/
|
||||
@Slf4j
|
||||
public class DispatchSubTypeRegisterLoader {
|
||||
|
||||
public static void registerType() {
|
||||
Class<DispatchSubTypeFetcher> clazz = DispatchSubTypeFetcher.class;
|
||||
ServiceLoader<DispatchSubTypeFetcher> fetcheries = ServiceLoader.load(clazz);
|
||||
|
||||
if (!fetcheries.iterator().hasNext()) {
|
||||
fetcheries = ServiceLoader.load(clazz, ServiceLoader.class.getClassLoader());
|
||||
}
|
||||
SimpleModule typeSubModule = new SimpleModule();
|
||||
for (DispatchSubTypeFetcher fetcher : fetcheries) {
|
||||
log.info("[DISPATCH_FETCHER]| {}", fetcher.getClass());
|
||||
Map<String, Class<? extends DispatchType>> jsonSubTypes = fetcher.jsonSubTypes();
|
||||
for (Map.Entry<String, Class<? extends DispatchType>> entry : jsonSubTypes.entrySet()) {
|
||||
typeSubModule.registerSubtypes(new NamedType(entry.getValue(), entry.getKey()));
|
||||
log.info("[REGISTER_DISPATCH]|{} for {}", entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
JsonUtil.registerModule(typeSubModule);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:ElementSubTypeFetcher
|
||||
* @Date:2025/03/25 17:38
|
||||
* @Filename:ElementSubTypeFetcher
|
||||
* @description:Todo
|
||||
*/
|
||||
public interface ElementSubTypeFetcher {
|
||||
|
||||
/**
|
||||
* 返回扩展的子类
|
||||
*/
|
||||
Map<String, Class<? extends Element>> jsonSubTypes();
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.jsontype.NamedType;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:ElementSubTypeRegisterLoader
|
||||
* @Date:2025/03/25 17:38
|
||||
* @Filename:ElementSubTypeRegisterLoader
|
||||
* @description:Todo
|
||||
*/
|
||||
@Slf4j
|
||||
public class ElementSubTypeRegisterLoader {
|
||||
|
||||
public static void registerElementForJsonUtil() {
|
||||
registerElement(null);
|
||||
}
|
||||
|
||||
public static void registerElement(ObjectMapper objectMapper) {
|
||||
Class<ElementSubTypeFetcher> clazz = ElementSubTypeFetcher.class;
|
||||
ServiceLoader<ElementSubTypeFetcher> fetcheries = ServiceLoader.load(clazz);
|
||||
|
||||
if (!fetcheries.iterator().hasNext()) {
|
||||
fetcheries = ServiceLoader.load(clazz, ServiceLoader.class.getClassLoader());
|
||||
}
|
||||
SimpleModule elementSubModule = new SimpleModule();
|
||||
for (ElementSubTypeFetcher fetcher : fetcheries) {
|
||||
log.info("[ELEMENT_FETCHER]| {}", fetcher.getClass());
|
||||
Map<String, Class<? extends Element>> jsonSubTypes = fetcher.jsonSubTypes();
|
||||
for (Map.Entry<String, Class<? extends Element>> entry : jsonSubTypes.entrySet()) {
|
||||
elementSubModule.registerSubtypes(new NamedType(entry.getValue(), entry.getKey()));
|
||||
log.info("[REGISTER_MODEL_ELEMENT]|{} for {}", entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
JsonUtil.registerModule(elementSubModule);
|
||||
if (objectMapper != null) {
|
||||
objectMapper.registerModule(elementSubModule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:EnvReplacementParser
|
||||
* @Date:2025/03/25 17:38
|
||||
* @Filename:EnvReplacementParser
|
||||
* @description:Todo
|
||||
*/
|
||||
public class EnvReplacementParser {
|
||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(EnvReplacementParser.class);
|
||||
private static final Pattern expressionPattern = Pattern.compile("\\$[{]{2}([^$^{}]+)[}]{2}");
|
||||
|
||||
public static String parse(Object value, Map<String, String> contextMap, Boolean onlyExpression,
|
||||
Pair<ExecutionContext, List<NamedValueInfo>> contextPair, Iterable<IFunctionInfo> functions,
|
||||
ExpressionOutput output) {
|
||||
ExprReplacementOptions options = new ExprReplacementOptions(contextMap, contextPair, functions, output);
|
||||
return parse(value, onlyExpression, options);
|
||||
}
|
||||
|
||||
public static String parse(Object value, Map<String, String> contextMap, IPipelineDialect dialect,
|
||||
Pair<ExecutionContext, List<NamedValueInfo>> contextPair, Iterable<IFunctionInfo> functions,
|
||||
ExpressionOutput output) {
|
||||
ExprReplacementOptions options = new ExprReplacementOptions(contextMap, contextPair, functions, output);
|
||||
return parse(value, dialect.supportUseExpression(), options);
|
||||
}
|
||||
|
||||
public static String parse(Object value, Boolean onlyExpression, ExprReplacementOptions options) {
|
||||
if (value == null) return "";
|
||||
if (onlyExpression == null || !onlyExpression) {
|
||||
return JsonUtil.toJson(ObjectReplaceEnvVarUtil.replaceEnvVar(value, options.contextMap), false);
|
||||
} else {
|
||||
return JsonUtil.toJson(ExprReplacementUtil.replaceEnvVar(value, options), false);
|
||||
}
|
||||
}
|
||||
|
||||
public static Pair<ExecutionContext, List<NamedValueInfo>> getCustomExecutionContextByMap(Map<String, String> variables,
|
||||
List<RuntimeNamedValue> extendNamedValueMap) {
|
||||
return ExprReplacementUtil.getCustomExecutionContextByMap(variables, extendNamedValueMap);
|
||||
}
|
||||
|
||||
public static boolean containsExpressions(String value) {
|
||||
if (value == null) return false;
|
||||
return expressionPattern.matcher(value).find();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:ExprReplacementOptions
|
||||
* @Date:2025/03/25 17:39
|
||||
* @Filename:ExprReplacementOptions
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "表达式替换参数")
|
||||
public class ExprReplacementOptions {
|
||||
|
||||
@Schema(title = "环境变量", required = true)
|
||||
private Map<String, String> contextMap;
|
||||
|
||||
@Schema(title = "值是否能不存在", required = true)
|
||||
private boolean contextNotNull;
|
||||
|
||||
@Schema(title = "表达式上下文", required = true)
|
||||
private Pair<ExecutionContext, List<NamedValueInfo>> contextPair;
|
||||
|
||||
private Iterable<IFunctionInfo> functions;
|
||||
|
||||
private ExpressionOutput output;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:IModelTemplate
|
||||
* @Date:2025/03/25 17:39
|
||||
* @Filename:IModelTemplate
|
||||
* @description:Todo
|
||||
*/
|
||||
@Schema(title = "model中报错模板信息的扩展参数")
|
||||
public interface IModelTemplate {
|
||||
|
||||
@Schema(title = "模板", required = true)
|
||||
String getTemplate();
|
||||
|
||||
@Schema(title = "引用", required = true)
|
||||
String getRef();
|
||||
|
||||
@Schema(title = "变量", required = true)
|
||||
Map<String, String> getVariables();
|
||||
|
||||
default boolean fromTemplate() {
|
||||
return getTemplate() != null && !getTemplate().isEmpty();
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:Model
|
||||
* @Date:2025/03/25 17:39
|
||||
* @Filename:Model
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "流水线模型-创建信息")
|
||||
public class Model implements IModelTemplate {
|
||||
@Schema(title = "名称", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(title = "描述", required = false)
|
||||
private String desc;
|
||||
|
||||
@Schema(title = "阶段集合", required = true)
|
||||
private List<Stage> stages;
|
||||
|
||||
@Schema(title = "标签", required = false)
|
||||
@Deprecated("以PipelineGroupService和流水线设置版本中为准")
|
||||
private List<String> labels;
|
||||
|
||||
@Schema(title = "是否从模板中实例化出来的", required = false)
|
||||
private Boolean instanceFromTemplate;
|
||||
|
||||
@Schema(title = "创建人", required = false)
|
||||
private String pipelineCreator;
|
||||
|
||||
@Schema(title = "当前模板对应的被复制的模板或安装的研发商店的模板对应的ID", required = false)
|
||||
private String srcTemplateId;
|
||||
|
||||
@Schema(title = "当前模板的ID", required = false)
|
||||
private String templateId;
|
||||
|
||||
@Schema(title = "提示", required = false)
|
||||
private String tips;
|
||||
|
||||
@Schema(title = "流水线事件回调", required = false)
|
||||
private Map<String, PipelineCallbackEvent> events;
|
||||
|
||||
@Schema(title = "静态流水线组", required = false)
|
||||
private List<String> staticViews;
|
||||
|
||||
@Schema(title = "各项耗时", required = true)
|
||||
private BuildRecordTimeCost timeCost;
|
||||
|
||||
@Schema(title = "模板地址", required = true)
|
||||
private String template;
|
||||
|
||||
@Schema(title = "模板版本", required = true)
|
||||
private String ref;
|
||||
|
||||
@Schema(title = "模板入参", required = true)
|
||||
private Map<String, String> variables;
|
||||
|
||||
@Schema(title = "模板资源", required = true)
|
||||
private Resources resources;
|
||||
|
||||
@Schema(title = "提交时流水线最新版本号", required = false)
|
||||
private int latestVersion;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:ModelUpdate
|
||||
* @Date:2025/03/25 17:40
|
||||
* @Filename:ModelUpdate
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "流水线更新信息")
|
||||
public class ModelUpdate {
|
||||
|
||||
@Schema(title = "项目id", required = true)
|
||||
private String projectId;
|
||||
|
||||
@Schema(title = "流水线id", required = true)
|
||||
private String pipelineId;
|
||||
|
||||
@Schema(title = "名称", required = true)
|
||||
private String name;
|
||||
|
||||
@Schema(title = "更新人", required = true)
|
||||
private String updateUserId;
|
||||
|
||||
@Schema(title = "更新结果信息", required = false)
|
||||
private String updateResultMessage;
|
||||
|
||||
@Schema(title = "更新结果", required = true)
|
||||
private boolean updateResult;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:NameAndValue
|
||||
* @Date:2025/03/25 17:40
|
||||
* @Filename:NameAndValue
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "名称和值")
|
||||
public class NameAndValue {
|
||||
|
||||
@Schema(title = "名称", required = true)
|
||||
private String key;
|
||||
|
||||
@Schema(title = "值", required = false)
|
||||
private String value;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import cd.casic.ci.common.pipeline.pojo.PipelineModelAndSetting;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:PipelineVersionWithModel
|
||||
* @Date:2025/03/25 17:40
|
||||
* @Filename:PipelineVersionWithModel
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "流水线版本与模型")
|
||||
public class PipelineVersionWithModel {
|
||||
|
||||
@Schema(title = "版本号(流水线唯一递增)", required = true)
|
||||
private int version;
|
||||
|
||||
@Schema(title = "版本名称", required = true)
|
||||
private String versionName;
|
||||
|
||||
@Schema(title = "该版本的源版本号", required = true)
|
||||
private Integer baseVersion;
|
||||
|
||||
@Schema(title = "该版本的版本号名", required = true)
|
||||
private String baseVersionName;
|
||||
|
||||
@Schema(title = "流水线模型", required = true)
|
||||
private PipelineModelAndSetting modelAndSetting;
|
||||
|
||||
@Schema(title = "流水线YAML编排(含高亮)", required = false)
|
||||
private PreviewResponse yamlPreview;
|
||||
|
||||
@Schema(title = "是否处在可以调试状态", required = false)
|
||||
private Boolean canDebug;
|
||||
|
||||
@Schema(title = "版本变更说明", required = false)
|
||||
private String description;
|
||||
|
||||
@Schema(title = "是否支持YAML解析", required = true)
|
||||
private boolean yamlSupported;
|
||||
|
||||
@Schema(title = "YAML解析异常信息")
|
||||
private String yamlInvalidMsg;
|
||||
|
||||
@Schema(title = "更新操作人", required = true)
|
||||
private String updater;
|
||||
|
||||
@Schema(title = "版本修改时间", required = true)
|
||||
private Long updateTime;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cd.casic.ci.common.pipeline;
|
||||
|
||||
import cd.casic.ci.common.pipeline.enums.PipelineStorageType;
|
||||
import cd.casic.ci.common.pipeline.pojo.PipelineModelAndSetting;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline
|
||||
* @Project:ops-pro
|
||||
* @name:PipelineVersionWithModelRequest
|
||||
* @Date:2025/03/25 17:41
|
||||
* @Filename:PipelineVersionWithModelRequest
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "流水线版本与模型请求")
|
||||
public class PipelineVersionWithModelRequest {
|
||||
|
||||
@Schema(title = "流水线ID(为空时导入并创建流水线)", required = false)
|
||||
private String pipelineId;
|
||||
|
||||
@Schema(title = "草稿的来源版本(前端保存时传递)", required = true)
|
||||
private int baseVersion;
|
||||
|
||||
@Schema(title = "流水线模型", required = true)
|
||||
private PipelineModelAndSetting modelAndSetting;
|
||||
|
||||
@Schema(title = "流水线YAML编排(不为空时以YAML为准)", required = false)
|
||||
private String yaml;
|
||||
|
||||
@Schema(title = "存储格式", required = false)
|
||||
private PipelineStorageType storageType = PipelineStorageType.MODEL;
|
||||
|
||||
@Schema(title = "版本变更说明", required = false)
|
||||
private String description;
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:AgentReuseMutex
|
||||
* @Date:2025/03/25 16:51
|
||||
* @Filename:AgentReuseMutex
|
||||
* @description: * AgentReuseMutex 构建机复用互斥
|
||||
* * 在同一次构建中总共有五种情况
|
||||
* * 1、单个Agent节点且明确指定了使用某个Agent(AgentId或者AgentName),这种情况在item中可以直接拿到,直接进行项目级的互斥逻辑
|
||||
* * 2、单个Agent节点但使用变量指代Agent
|
||||
* * 2-1、被指代的Agent节点与复用他的Job处在同一Stage下,并行执行,这时被指代的Agent与复用他的Job进行同样的变量替换,
|
||||
* * 并行竞争,没有先后顺序
|
||||
* * 2-2、被指代的Agent节点与复用他的Job处在同一Stage下,串行执行(即流水线的Job依赖),这时被指代的Agent应先于复用他的Job执行,
|
||||
* * 且在Var表中写入可以拿到Agent的只读变量,复用Job读取变量执行
|
||||
* * 3、Agent集群且明确指定了某个集群(集群ID或者名称),在分发到Dispatch前需要进行集群级别的互斥锁逻辑,
|
||||
* * 这样可以保证同样进行互斥逻辑的集群在引擎处进行等待。
|
||||
* * 与单个Agent节点的Job关系相同,并行执行时并行竞争,串行时天然的有先后顺序,读取Var表中节点进行项目级的互斥逻辑
|
||||
* * 4、Agent集群但使用变量指代,与未进行变量指代的逻辑一致,无需特殊声明
|
||||
* * 注:如果是共享集群不受影响,依旧使用执行项目来进行锁定
|
||||
* * @param reUseJobId 如果为空说明当前job为被依赖job
|
||||
* * @param agentOrEnvId agentId/agentName 或者 envId/envName 或者变量,根据 type 区分不同值
|
||||
* * @param type 复用互斥的各种类型
|
||||
* * @param endJob 是否是最后一波的Job
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "构建机复用互斥模型")
|
||||
public class AgentReuseMutex {
|
||||
private String jobId;
|
||||
private String reUseJobId;
|
||||
private String agentOrEnvId;
|
||||
private AgentReuseMutexType type;
|
||||
private Boolean endJob;
|
||||
@Schema(title = "是否排队", required = false)
|
||||
private Boolean queueEnable = true;
|
||||
@Schema(title = "排队等待时间(分钟)0表示不等待直接失败", required = false)
|
||||
private Integer timeout = 900;
|
||||
@Schema(title = "支持变量解析的timeout,变量值非数字则会改取timeout值", required = false)
|
||||
private String timeoutVar;
|
||||
@Schema(title = "排队队列大小", required = false)
|
||||
private Integer queue = 10;
|
||||
@Schema(title = "运行时的agentOrEnvId,如果有值说明已经初始化了", required = false)
|
||||
private String runtimeAgentOrEnvId;
|
||||
@Schema(title = "占用锁定的信息用于日志提示", required = false)
|
||||
private String linkTip;
|
||||
|
||||
public static class Companion {
|
||||
public static final long AGENT_LOCK_TIMEOUT = 60 * 60 * 24 * 7L;
|
||||
public static final String CONTEXT_KEY_SUFFIX = ".container.agent_id";
|
||||
|
||||
public static String genAgentContextKey(String jobId) {
|
||||
return "jobs." + jobId + CONTEXT_KEY_SUFFIX;
|
||||
}
|
||||
|
||||
public static String genAgentReuseMutexLockKey(String projectId, String agentId) {
|
||||
return "lock:agent:reuse:project:" + projectId + ":agent:" + agentId + ":lock";
|
||||
}
|
||||
|
||||
public static String genAgentReuseMutexQueueKey(String projectId, String agentId) {
|
||||
return "lock:agent:reuse:project:" + projectId + ":agent:" + agentId + ":queue";
|
||||
}
|
||||
|
||||
public static String genAgentReuseMutexLinkTipKey(String buildId) {
|
||||
return "agent:reuse:linkTip:" + buildId;
|
||||
}
|
||||
}
|
||||
|
||||
public enum AgentReuseMutexType {
|
||||
AGENT_ID,
|
||||
AGENT_NAME,
|
||||
AGENT_ENV_ID,
|
||||
AGENT_ENV_NAME,
|
||||
AGENT_DEP_VAR;
|
||||
|
||||
public boolean isEnvType() {
|
||||
return this == AGENT_ENV_ID || this == AGENT_ENV_NAME;
|
||||
}
|
||||
|
||||
public boolean isAgentType() {
|
||||
return this == AGENT_ID || this == AGENT_NAME;
|
||||
}
|
||||
|
||||
public boolean needEngineLock() {
|
||||
return isAgentType();
|
||||
}
|
||||
|
||||
public AgentType toAgentType() {
|
||||
switch (this) {
|
||||
case AGENT_ID:
|
||||
case AGENT_ENV_ID:
|
||||
return AgentType.ID;
|
||||
case AGENT_NAME:
|
||||
case AGENT_ENV_NAME:
|
||||
return AgentType.NAME;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:Container
|
||||
* @Date:2025/03/25 16:53
|
||||
* @Filename:Container
|
||||
* @description:Todo
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Schema(title = "流水线模型-多态基类")
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type")
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = TriggerContainer.class, name = TriggerContainer.classType),
|
||||
@JsonSubTypes.Type(value = NormalContainer.class, name = NormalContainer.classType),
|
||||
@JsonSubTypes.Type(value = VMBuildContainer.class, name = VMBuildContainer.classType)
|
||||
})
|
||||
public interface Container extends IModelTemplate {
|
||||
String getId();
|
||||
void setId(String id);
|
||||
String getName();
|
||||
void setName(String name);
|
||||
List<Element> getElements();
|
||||
void setElements(List<Element> elements);
|
||||
String getStatus();
|
||||
void setStatus(String status);
|
||||
Long getStartEpoch();
|
||||
void setStartEpoch(Long startEpoch);
|
||||
Long getSystemElapsed();
|
||||
void setSystemElapsed(Long systemElapsed);
|
||||
Long getElementElapsed();
|
||||
void setElementElapsed(Long elementElapsed);
|
||||
Boolean getCanRetry();
|
||||
void setCanRetry(Boolean canRetry);
|
||||
String getContainerId();
|
||||
void setContainerId(String containerId);
|
||||
String getContainerHashId();
|
||||
void setContainerHashId(String containerHashId);
|
||||
String getStartVMStatus();
|
||||
void setStartVMStatus(String startVMStatus);
|
||||
Integer getExecuteCount();
|
||||
void setExecuteCount(Integer executeCount);
|
||||
String getJobId();
|
||||
void setJobId(String jobId);
|
||||
Boolean getContainPostTaskFlag();
|
||||
void setContainPostTaskFlag(Boolean containPostTaskFlag);
|
||||
Boolean getMatrixGroupFlag();
|
||||
void setMatrixGroupFlag(Boolean matrixGroupFlag);
|
||||
BuildRecordTimeCost getTimeCost();
|
||||
void setTimeCost(BuildRecordTimeCost timeCost);
|
||||
Integer getStartVMTaskSeq();
|
||||
void setStartVMTaskSeq(Integer startVMTaskSeq);
|
||||
|
||||
void resetBuildOption(int executeCount);
|
||||
void transformCompatibility();
|
||||
Map<String, Object> genTaskParams();
|
||||
String getClassType();
|
||||
Container getContainerById(String vmSeqId);
|
||||
void retryFreshMatrixOption();
|
||||
List<Container> fetchGroupContainers();
|
||||
Map<String, String> fetchMatrixContext();
|
||||
Boolean containerEnabled();
|
||||
void setContainerEnable(Boolean enable);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:MutexGroup
|
||||
* @Date:2025/03/25 16:54
|
||||
* @Filename:MutexGroup
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "互斥组模型")
|
||||
public class MutexGroup {
|
||||
@Schema(title = "是否启用", required = false)
|
||||
private Boolean enable;
|
||||
@Schema(title = "互斥组名称", required = false)
|
||||
private String mutexGroupName;
|
||||
@Schema(title = "是否排队", required = false)
|
||||
private Boolean queueEnable;
|
||||
@Schema(title = "排队等待时间(分钟)0表示不等待直接失败", required = false)
|
||||
private Integer timeout;
|
||||
@Schema(title = "支持变量解析的timeout,变量值非数字则会改取timeout值", required = false)
|
||||
private String timeoutVar;
|
||||
@Schema(title = "排队队列大小", required = false)
|
||||
private Integer queue;
|
||||
@Schema(title = "运行时实际互斥锁名称(有值则已初始化)", required = false)
|
||||
private String runtimeMutexGroup;
|
||||
@Schema(title = "占用锁定的信息用于日志提示", required = false)
|
||||
private String linkTip;
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:NormalContainer
|
||||
* @Date:2025/03/25 16:54
|
||||
* @Filename:NormalContainer
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "流水线模型-普通任务容器")
|
||||
public class NormalContainer implements Container {
|
||||
public static final String classType = "normal";
|
||||
|
||||
@Schema(title = "构建容器序号id", required = false, readOnly = true)
|
||||
private String id;
|
||||
@Schema(title = "容器名称", required = true)
|
||||
private String name;
|
||||
@Schema(title = "任务集合", required = true)
|
||||
private List<Element> elements;
|
||||
@Schema(title = "容器状态", required = false, readOnly = true)
|
||||
private String status;
|
||||
@Schema(title = "系统运行时间", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long startEpoch;
|
||||
@Schema(title = "系统耗时(开机时间)", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long systemElapsed;
|
||||
@Schema(title = "插件执行耗时", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long elementElapsed;
|
||||
@Schema(title = "允许可跳过", required = false)
|
||||
@Deprecated
|
||||
private Boolean enableSkip;
|
||||
@Schema(title = "触发条件", required = false)
|
||||
@Deprecated
|
||||
private List<NameAndValue> conditions;
|
||||
@Schema(title = "是否可重试-仅限于构建详情展示重试,目前未作为编排的选项,暂设置为null不存储", required = false, readOnly = true)
|
||||
private Boolean canRetry;
|
||||
@Schema(title = "构建容器顺序ID(同id值)", required = false, readOnly = true)
|
||||
private String containerId;
|
||||
@Schema(title = "容器唯一ID", required = false, readOnly = true)
|
||||
private String containerHashId;
|
||||
@Schema(title = "无构建环境-等待运行环境启动的排队最长时间(分钟)", required = false)
|
||||
@Deprecated
|
||||
private Integer maxQueueMinutes = 60;
|
||||
@Schema(title = "无构建环境-运行最长时间(分钟)", required = false)
|
||||
@Deprecated
|
||||
private Integer maxRunningMinutes = 1440;
|
||||
@Schema(title = "流程控制选项", required = true)
|
||||
private JobControlOption jobControlOption;
|
||||
@Schema(title = "互斥组", required = false)
|
||||
private MutexGroup mutexGroup;
|
||||
@Schema(title = "构建环境启动状态", required = false, readOnly = true)
|
||||
private String startVMStatus;
|
||||
@Schema(title = "容器运行次数", required = false, readOnly = true)
|
||||
private Integer executeCount;
|
||||
@Schema(title = "用户自定义ID", required = false, hidden = false)
|
||||
private String jobId;
|
||||
@Schema(title = "是否包含post任务标识", required = false, readOnly = true)
|
||||
private Boolean containPostTaskFlag;
|
||||
@Schema(title = "是否为构建矩阵", required = false, readOnly = true)
|
||||
private Boolean matrixGroupFlag;
|
||||
@Schema(title = "各项耗时", required = true)
|
||||
private BuildRecordTimeCost timeCost;
|
||||
@Schema(title = "开机任务序号", required = false, readOnly = true)
|
||||
private Integer startVMTaskSeq;
|
||||
@Schema(title = "构建矩阵配置项", required = false)
|
||||
private MatrixControlOption matrixControlOption;
|
||||
@Schema(title = "所在构建矩阵组的containerHashId(分裂后的子容器特有字段)", required = false)
|
||||
private String matrixGroupId;
|
||||
@Schema(title = "当前矩阵子容器的上下文组合(分裂后的子容器特有字段)", required = false)
|
||||
private Map<String, String> matrixContext;
|
||||
@Schema(title = "分裂后的容器集合(分裂后的父容器特有字段)", required = false)
|
||||
private List<NormalContainer> groupContainers;
|
||||
|
||||
@Override
|
||||
public String getClassType() {
|
||||
return classType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getContainerById(String vmSeqId) {
|
||||
if (id.equals(vmSeqId) || containerId.equals(vmSeqId)) return this;
|
||||
if (groupContainers != null) {
|
||||
for (Container container : groupContainers) {
|
||||
if (container.getId().equals(vmSeqId) || container.getContainerId().equals(vmSeqId)) return container;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFreshMatrixOption() {
|
||||
groupContainers = new ArrayList<>();
|
||||
if (matrixControlOption != null) {
|
||||
matrixControlOption.setFinishCount(null);
|
||||
matrixControlOption.setTotalCount(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Container> fetchGroupContainers() {
|
||||
return groupContainers != null ? new ArrayList<>(groupContainers) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> fetchMatrixContext() {
|
||||
return matrixContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean containerEnabled() {
|
||||
return jobControlOption != null ? jobControlOption.getEnable() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerEnable(Boolean enable) {
|
||||
jobControlOption = jobControlOption != null ? jobControlOption.copy(enable) : new JobControlOption(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformCompatibility() {
|
||||
if (jobControlOption != null && jobControlOption.getTimeoutVar() == null || jobControlOption.getTimeoutVar().isBlank()) {
|
||||
jobControlOption.setTimeoutVar(String.valueOf(jobControlOption.getTimeout()));
|
||||
}
|
||||
if (mutexGroup != null && (mutexGroup.getTimeoutVar() == null || mutexGroup.getTimeoutVar().isBlank())) {
|
||||
mutexGroup.setTimeoutVar(String.valueOf(mutexGroup.getTimeout()));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import cd.casic.ci.common.pipeline.pojo.StagePauseCheck;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:Stage
|
||||
* @Date:2025/03/25 16:55
|
||||
* @Filename:Stage
|
||||
* @description:Todo
|
||||
*/
|
||||
public class Stage {
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "流水线模型-阶段")
|
||||
public class Stage implements IModelTemplate {
|
||||
@Schema(title = "容器集合", required = true)
|
||||
private List<Container> containers;
|
||||
@Schema(title = "阶段ID (系统标识,用户不可编辑)", required = false)
|
||||
private String id;
|
||||
@Schema(title = "阶段名称", required = true)
|
||||
private String name;
|
||||
@Schema(title = "阶段ID (用户可编辑)", required = false)
|
||||
private String stageIdForUser;
|
||||
@Schema(title = "阶段标签", required = false, readOnly = true)
|
||||
private List<String> tag;
|
||||
@Schema(title = "阶段状态", required = false, readOnly = true)
|
||||
private String status;
|
||||
@Schema(title = "阶段启动时间", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long startEpoch;
|
||||
@Schema(title = "容器运行时间", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long elapsed;
|
||||
@Schema(title = "用户自定义环境变量", required = false)
|
||||
private Map<String, String> customBuildEnv;
|
||||
@Schema(title = "是否启用容器失败快速终止阶段", required = false)
|
||||
private Boolean fastKill;
|
||||
@Schema(title = "标识是否为FinallyStage,每个Model只能包含一个FinallyStage,并且处于最后位置", required = false)
|
||||
private Boolean finally;
|
||||
@Schema(title = "当前Stage是否能重试", required = false)
|
||||
private Boolean canRetry;
|
||||
@Schema(title = "流程控制选项", required = true)
|
||||
private StageControlOption stageControlOption;
|
||||
@Schema(title = "stage准入配置", required = false)
|
||||
private StagePauseCheck checkIn;
|
||||
@Schema(title = "stage准出配置", required = false)
|
||||
private StagePauseCheck checkOut;
|
||||
@Schema(title = "步骤运行次数", required = false, readOnly = true)
|
||||
private Integer executeCount;
|
||||
@Schema(title = "各项耗时", required = true)
|
||||
private BuildRecordTimeCost timeCost;
|
||||
|
||||
public void resetBuildOption(Boolean init) {
|
||||
if (init != null && init) {
|
||||
status = null;
|
||||
startEpoch = null;
|
||||
elapsed = null;
|
||||
}
|
||||
if (checkIn != null) {
|
||||
checkIn.fixReviewGroups(init != null && init);
|
||||
}
|
||||
if (checkOut != null) {
|
||||
checkOut.fixReviewGroups(init != null && init);
|
||||
}
|
||||
if (stageControlOption != null && stageControlOption.getManualTrigger() && checkIn == null) {
|
||||
checkIn = StagePauseCheck.convertControlOption(stageControlOption);
|
||||
}
|
||||
if (finally !=null && finally){
|
||||
canRetry = false;
|
||||
}
|
||||
}
|
||||
|
||||
public Container getContainer(String vmSeqId) {
|
||||
if (containers != null) {
|
||||
for (Container container : containers) {
|
||||
Container foundContainer = container.getContainerById(vmSeqId);
|
||||
if (foundContainer != null) {
|
||||
return foundContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void transformCompatibility() {
|
||||
if (containers != null) {
|
||||
for (Container container : containers) {
|
||||
container.transformCompatibility();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean stageEnabled() {
|
||||
return stageControlOption != null ? stageControlOption.getEnable() : true;
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import cd.casic.ci.common.pipeline.pojo.BuildFormProperty;
|
||||
import cd.casic.ci.common.pipeline.pojo.BuildNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:TriggerContainer
|
||||
* @Date:2025/03/25 16:56
|
||||
* @Filename:TriggerContainer
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "流水线模型-构建触发容器")
|
||||
public class TriggerContainer implements Container {
|
||||
public static final String classType = "trigger";
|
||||
|
||||
@Schema(title = "构建容器序号id", required = false, readOnly = true)
|
||||
private String id;
|
||||
@Schema(title = "容器名称", required = true)
|
||||
private String name;
|
||||
@Schema(title = "任务集合", required = true)
|
||||
private List<Element> elements;
|
||||
@Schema(title = "状态", required = true, readOnly = true)
|
||||
private String status;
|
||||
@Schema(title = "系统运行时间", required = false)
|
||||
@Deprecated
|
||||
private Long startEpoch;
|
||||
@Schema(title = "系统耗时(开机时间)", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long systemElapsed;
|
||||
@Schema(title = "插件执行耗时", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long elementElapsed;
|
||||
@Schema(title = "参数化构建", required = false)
|
||||
private List<BuildFormProperty> params;
|
||||
@Schema(title = "模板参数构建", required = false)
|
||||
private List<BuildFormProperty> templateParams;
|
||||
@Schema(title = "构建版本号", required = false)
|
||||
private BuildNo buildNo;
|
||||
@Schema(title = "是否可重试-仅限于构建详情展示重试,目前未作为编排的选项,暂设置为null不存储", required = false, readOnly = true)
|
||||
private Boolean canRetry;
|
||||
@Schema(title = "构建容器顺序ID(同id值)", required = false, readOnly = true)
|
||||
private String containerId;
|
||||
@Schema(title = "容器唯一ID", required = false, readOnly = true)
|
||||
private String containerHashId;
|
||||
@Schema(title = "构建环境启动状态", required = false, readOnly = true)
|
||||
private String startVMStatus;
|
||||
@Schema(title = "容器运行次数", required = false, readOnly = true)
|
||||
private Integer executeCount;
|
||||
@Schema(title = "用户自定义ID", required = false, hidden = false)
|
||||
private String jobId;
|
||||
@Schema(title = "是否包含post任务标识", required = false, readOnly = true)
|
||||
private Boolean containPostTaskFlag;
|
||||
@Schema(title = "是否为构建矩阵", required = false, readOnly = true)
|
||||
private Boolean matrixGroupFlag;
|
||||
@Schema(title = "各项耗时", required = true)
|
||||
private BuildRecordTimeCost timeCost;
|
||||
@Schema(title = "开机任务序号", required = false, readOnly = true)
|
||||
private Integer startVMTaskSeq;
|
||||
|
||||
@Override
|
||||
public String getClassType() {
|
||||
return classType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getContainerById(String vmSeqId) {
|
||||
return id.equals(vmSeqId) ? this : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFreshMatrixOption() {
|
||||
// No operation needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Container> fetchGroupContainers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> fetchMatrixContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean containerEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerEnable(Boolean enable) {
|
||||
// No operation needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformCompatibility() {
|
||||
// No compatibility transformation needed
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package cd.casic.ci.common.pipeline.container;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.container
|
||||
* @Project:ops-pro
|
||||
* @name:VMBuildContainer
|
||||
* @Date:2025/03/25 16:56
|
||||
* @Filename:VMBuildContainer
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Schema(title = "流水线模型-虚拟机构建容器")
|
||||
public class VMBuildContainer implements Container {
|
||||
public static final String classType = "vmBuild";
|
||||
|
||||
@Schema(title = "构建容器序号id", required = false, readOnly = true)
|
||||
private String id;
|
||||
@Schema(title = "容器名称", required = true)
|
||||
private String name = "构建环境";
|
||||
@Schema(title = "任务集合", required = true)
|
||||
private List<Element> elements;
|
||||
@Schema(title = "容器状态", required = false, readOnly = true)
|
||||
private String status;
|
||||
@Schema(title = "系统运行时间", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long startEpoch;
|
||||
@Schema(title = "系统耗时(开机时间)", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long systemElapsed;
|
||||
@Schema(title = "插件执行耗时", required = false, readOnly = true)
|
||||
@Deprecated
|
||||
private Long elementElapsed;
|
||||
@Schema(title = "VM基础操作系统", required = true)
|
||||
private VMBaseOS baseOS;
|
||||
@Schema(title = "预指定VM名称列表", required = true)
|
||||
private Set<String> vmNames;
|
||||
@Schema(title = "排队最长时间(分钟)", required = true)
|
||||
@Deprecated
|
||||
private Integer maxQueueMinutes = 60;
|
||||
@Schema(title = "运行最长时间(分钟)", required = true)
|
||||
@Deprecated
|
||||
private Integer maxRunningMinutes = 480;
|
||||
@Schema(title = "构建机环境变量(容器启动时写入环境)", required = false)
|
||||
private Map<String, String> buildEnv;
|
||||
@Schema(title = "用户自定义环境变量(Agent启动时写入环境)", required = false)
|
||||
@Deprecated
|
||||
private Map<String, String> customBuildEnv;
|
||||
@Schema(title = "用户自定义环境变量(Agent启动时写入环境)", required = false)
|
||||
private List<NameAndValue> customEnv;
|
||||
@Schema(title = "第三方构建Hash ID", required = false)
|
||||
private String thirdPartyAgentId;
|
||||
@Schema(title = "第三方构建环境ID", required = false)
|
||||
private String thirdPartyAgentEnvId;
|
||||
@Schema(title = "第三方构建环境工作空间", required = false)
|
||||
private String thirdPartyWorkspace;
|
||||
@Schema(title = "Docker构建机", required = false)
|
||||
private String dockerBuildVersion;
|
||||
@Schema(title = "TStack Hash Id", required = false)
|
||||
@Deprecated
|
||||
private String tstackAgentId;
|
||||
@Schema(title = "新的选择构建机环境", required = false)
|
||||
private DispatchType dispatchType;
|
||||
@Schema(title = "是否显示构建资源信息", required = false)
|
||||
private Boolean showBuildResource;
|
||||
@Schema(title = "是否访问外网", required = false, readOnly = true)
|
||||
private Boolean enableExternal;
|
||||
@Schema(title = "构建容器顺序ID(同id值)", required = false, readOnly = true)
|
||||
private String containerId;
|
||||
@Schema(title = "容器唯一ID", required = false, readOnly = true)
|
||||
private String containerHashId;
|
||||
@Schema(title = "流程控制选项", required = true)
|
||||
private JobControlOption jobControlOption;
|
||||
@Schema(title = "互斥组", required = false)
|
||||
private MutexGroup mutexGroup;
|
||||
@Schema(title = "构建环境启动状态", required = false, readOnly = true)
|
||||
private String startVMStatus;
|
||||
@Schema(title = "容器运行次数", required = false, readOnly = true)
|
||||
private Integer executeCount;
|
||||
@Schema(title = "用户自定义ID", required = false, hidden = false)
|
||||
private String jobId;
|
||||
@Schema(title = "是否包含post任务标识", required = false, readOnly = true)
|
||||
private Boolean containPostTaskFlag;
|
||||
@Schema(title = "是否为构建矩阵", required = false, readOnly = true)
|
||||
private Boolean matrixGroupFlag;
|
||||
@Schema(title = "各项耗时", required = true)
|
||||
private BuildRecordTimeCost timeCost;
|
||||
@Schema(title = "开机任务序号", required = false, readOnly = true)
|
||||
private Integer startVMTaskSeq;
|
||||
@Schema(title = "构建矩阵配置项", required = false)
|
||||
private MatrixControlOption matrixControlOption;
|
||||
@Schema(title = "所在构建矩阵组的containerHashId(分裂后的子容器特有字段)", required = false)
|
||||
private String matrixGroupId;
|
||||
@Schema(title = "当前矩阵子容器的上下文组合(分裂后的子容器特有字段)", required = false)
|
||||
private Map<String, String> matrixContext;
|
||||
@Schema(title = "分裂后的容器集合(分裂后的父容器特有字段)", required = false)
|
||||
private List<VMBuildContainer> groupContainers;
|
||||
@Schema(title = "nfs挂载开关", required = false, readOnly = true)
|
||||
private Boolean nfsSwitch;
|
||||
|
||||
public Boolean getNfsSwitch() {
|
||||
return nfsSwitch != null ? nfsSwitch : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassType() {
|
||||
return classType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getContainerById(String vmSeqId) {
|
||||
if (id.equals(vmSeqId) || containerId.equals(vmSeqId)) return this;
|
||||
if (groupContainers != null) {
|
||||
for (Container container : groupContainers) {
|
||||
if (container.getId().equals(vmSeqId) || container.getContainerId().equals(vmSeqId)) return container;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFreshMatrixOption() {
|
||||
groupContainers = new ArrayList<>();
|
||||
if (matrixControlOption != null) {
|
||||
matrixControlOption.setFinishCount(null);
|
||||
matrixControlOption.setTotalCount(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Container> fetchGroupContainers() {
|
||||
return groupContainers != null ? new ArrayList<>(groupContainers) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> fetchMatrixContext() {
|
||||
return matrixContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean containerEnabled() {
|
||||
return jobControlOption != null ? jobControlOption.getEnable() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerEnable(Boolean enable) {
|
||||
jobControlOption = jobControlOption != null ? jobControlOption.copy(enable) : new JobControlOption(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformCompatibility() {
|
||||
if (jobControlOption != null && jobControlOption.getTimeoutVar() == null || jobControlOption.getTimeoutVar().isBlank()) {
|
||||
jobControlOption.setTimeoutVar(String.valueOf(jobControlOption.getTimeout()));
|
||||
}
|
||||
if (mutexGroup != null && (mutexGroup.getTimeoutVar() == null || mutexGroup.getTimeoutVar().isBlank())) {
|
||||
mutexGroup.setTimeoutVar(String.valueOf(mutexGroup.getTimeout()));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BranchVersionAction
|
||||
* @Date:2025/03/25 17:25
|
||||
* @Filename:BranchVersionAction
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BranchVersionAction {
|
||||
ACTIVE("活跃分支(可以被代码推送直接更新)"),
|
||||
INACTIVE("不活跃分支(已被发布或已被删除)"),
|
||||
CONFLICT("有冲突分支(落后于主干无法直接合入)");
|
||||
|
||||
private final String statusName;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildFormPropertyType
|
||||
* @Date:2025/03/25 17:01
|
||||
* @Filename:BuildFormPropertyType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BuildFormPropertyType {
|
||||
STRING("string"),
|
||||
TEXTAREA("textarea"),
|
||||
ENUM("enum"),
|
||||
DATE("date"),
|
||||
LONG("long"),
|
||||
BOOLEAN("boolean"),
|
||||
SVN_TAG("svn_tag"),
|
||||
GIT_REF("git_ref"),
|
||||
REPO_REF("repo_ref"),
|
||||
MULTIPLE("multiple"),
|
||||
CODE_LIB("code_lib"),
|
||||
CONTAINER_TYPE("container_type"),
|
||||
ARTIFACTORY("artifactory"),
|
||||
SUB_PIPELINE("sub_pipeline"),
|
||||
CUSTOM_FILE("custom_file"),
|
||||
PASSWORD("password"),
|
||||
TEMPORARY("do not storage in database");
|
||||
|
||||
private final String value;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildPropertyType
|
||||
* @Date:2025/03/25 17:01
|
||||
* @Filename:BuildPropertyType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BuildPropertyType {
|
||||
BUILD;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildRecordTimeStamp
|
||||
* @Date:2025/03/25 17:02
|
||||
* @Filename:BuildRecordTimeStamp
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BuildRecordTimeStamp {
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
|
||||
public long between() {
|
||||
return (endTime != null ? endTime : startTime != null ? startTime : 0) - (startTime != null ? startTime : 0);
|
||||
}
|
||||
|
||||
public void insert2TimeLine(List<BuildRecordTimeLine.Moment> timeline) {
|
||||
if (startTime != null && endTime != null) {
|
||||
timeline.add(new BuildRecordTimeLine.Moment(startTime, endTime));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildScriptType
|
||||
* @Date:2025/03/25 17:02
|
||||
* @Filename:BuildScriptType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BuildScriptType {
|
||||
PYTHON2,
|
||||
PYTHON3,
|
||||
SHELL,
|
||||
BAT,
|
||||
POWER_SHELL;
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildStatus
|
||||
* @Date:2025/03/25 17:02
|
||||
* @Filename:BuildStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BuildStatus {
|
||||
SUCCEED("succeed", true),
|
||||
FAILED("failed", true),
|
||||
CANCELED("canceled", true),
|
||||
RUNNING("running", true),
|
||||
TERMINATE("terminate", true),
|
||||
REVIEWING("reviewing", true),
|
||||
REVIEW_ABORT("reviewAbort", true),
|
||||
REVIEW_PROCESSED("reviewProcessed", true),
|
||||
HEARTBEAT_TIMEOUT("heartbeatTimeout", true),
|
||||
PREPARE_ENV("prepareEnv", true),
|
||||
UNEXEC("unexec", false),
|
||||
SKIP("skip", true),
|
||||
QUALITY_CHECK_FAIL("qualityCheckFail", true),
|
||||
QUEUE("queue", true),
|
||||
LOOP_WAITING("loopWaiting", true),
|
||||
CALL_WAITING("callWaiting", true),
|
||||
TRY_FINALLY("tryFinally", false),
|
||||
QUEUE_TIMEOUT("queueTimeout", true),
|
||||
EXEC_TIMEOUT("execTimeout", true),
|
||||
QUEUE_CACHE("queueCache", true),
|
||||
RETRY("retry", true),
|
||||
PAUSE("pause", true),
|
||||
STAGE_SUCCESS("stageSuccess", true),
|
||||
QUOTA_FAILED("quotaFailed", true),
|
||||
DEPENDENT_WAITING("dependentWaiting", true),
|
||||
QUALITY_CHECK_PASS("qualityCheckPass", true),
|
||||
QUALITY_CHECK_WAIT("qualityCheckWait", true),
|
||||
TRIGGER_REVIEWING("triggerReviewing", true),
|
||||
UNKNOWN("unknown", false);
|
||||
|
||||
private final String statusName;
|
||||
private final boolean visible;
|
||||
|
||||
public boolean isNeverRun() {
|
||||
return this == UNEXEC || this == TRIGGER_REVIEWING;
|
||||
}
|
||||
|
||||
public boolean isFinish() {
|
||||
return isFailure() || isSuccess() || isCancel();
|
||||
}
|
||||
|
||||
public boolean isFailure() {
|
||||
return this == FAILED || isPassiveStop() || isTimeout();
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return this == SUCCEED || this == SKIP || this == REVIEW_PROCESSED || this == QUALITY_CHECK_PASS;
|
||||
}
|
||||
|
||||
public boolean isCancel() {
|
||||
return this == CANCELED;
|
||||
}
|
||||
|
||||
public boolean isSkip() {
|
||||
return this == SKIP;
|
||||
}
|
||||
|
||||
public boolean isTerminate() {
|
||||
return this == TERMINATE;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return this == RUNNING || this == LOOP_WAITING || this == REVIEWING || this == PREPARE_ENV || this == CALL_WAITING || this == PAUSE;
|
||||
}
|
||||
|
||||
public boolean isReview() {
|
||||
return this == REVIEW_ABORT || this == REVIEW_PROCESSED;
|
||||
}
|
||||
|
||||
public boolean isReadyToRun() {
|
||||
return this == QUEUE || this == QUEUE_CACHE || this == RETRY || this == DEPENDENT_WAITING;
|
||||
}
|
||||
|
||||
public boolean isPassiveStop() {
|
||||
return this == TERMINATE || this == REVIEW_ABORT || this == QUALITY_CHECK_FAIL;
|
||||
}
|
||||
|
||||
public boolean isPause() {
|
||||
return this == PAUSE;
|
||||
}
|
||||
|
||||
public boolean isTimeout() {
|
||||
return this == QUEUE_TIMEOUT || this == EXEC_TIMEOUT || this == HEARTBEAT_TIMEOUT;
|
||||
}
|
||||
|
||||
public String getI18n(String language) {
|
||||
// Assuming MessageUtil is available in Java
|
||||
return MessageUtil.getMessageByLocale("buildStatus." + statusName, language);
|
||||
}
|
||||
|
||||
public static BuildStatus parse(String statusName) {
|
||||
try {
|
||||
return statusName == null ? UNKNOWN : BuildStatus.valueOf(statusName);
|
||||
} catch (Exception ignored) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:BuildTaskStatus
|
||||
* @Date:2025/03/25 17:03
|
||||
* @Filename:BuildTaskStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BuildTaskStatus {
|
||||
WAIT,
|
||||
END,
|
||||
DO;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:CertType
|
||||
* @Date:2025/03/25 17:03
|
||||
* @Filename:CertType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CertType {
|
||||
PERSONAL("PERSONAL"),
|
||||
ENTERPRISE("ENTERPRISE");
|
||||
|
||||
private final String value;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:ChannelCode
|
||||
* @Date:2025/03/25 17:03
|
||||
* @Filename:ChannelCode
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ChannelCode {
|
||||
BS,
|
||||
AM,
|
||||
CODECC,
|
||||
GCLOUD,
|
||||
GIT,
|
||||
GONGFENGSCAN,
|
||||
CODECC_EE;
|
||||
|
||||
public static boolean isNeedAuth(ChannelCode channelCode) {
|
||||
return channelCode == BS;
|
||||
}
|
||||
|
||||
public static boolean webChannel(ChannelCode channelCode) {
|
||||
return channelCode == BS || channelCode == GIT;
|
||||
}
|
||||
|
||||
public static ChannelCode getChannel(String channel) {
|
||||
for (ChannelCode code : values()) {
|
||||
if (code.name().equals(channel)) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:CharsetType
|
||||
* @Date:2025/03/25 17:03
|
||||
* @Filename:CharsetType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CharsetType {
|
||||
DEFAULT,
|
||||
UTF_8,
|
||||
GBK;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:CodePullStrategy
|
||||
* @Date:2025/03/25 17:03
|
||||
* @Filename:CodePullStrategy
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CodePullStrategy {
|
||||
FRESH_CHECKOUT("fresh_checkout"),
|
||||
INCREMENT_UPDATE("increment_update"),
|
||||
REVERT_UPDATE("revert_update");
|
||||
|
||||
private final String value;
|
||||
|
||||
public static CodePullStrategy fromValue(String value) {
|
||||
for (CodePullStrategy strategy : values()) {
|
||||
if (strategy.value.equals(value)) {
|
||||
return strategy;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("The strategy(" + value + ") is not exist");
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:CodeTargetAction
|
||||
* @Date:2025/03/25 17:04
|
||||
* @Filename:CodeTargetAction
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CodeTargetAction {
|
||||
COMMIT_TO_MASTER("提交到主干"),
|
||||
CHECKOUT_BRANCH_AND_REQUEST_MERGE("新建分支创建MR"),
|
||||
COMMIT_TO_SOURCE_BRANCH("提交到原始版本分支"),
|
||||
COMMIT_TO_SOURCE_BRANCH_AND_REQUEST_MERGE("提交到原始版本分支创建MR"),
|
||||
COMMIT_TO_BRANCH("提交到指定分支");
|
||||
|
||||
private final String desc;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:ContainerMutexStatus
|
||||
* @Date:2025/03/25 17:04
|
||||
* @Filename:ContainerMutexStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ContainerMutexStatus {
|
||||
READY,
|
||||
WAITING,
|
||||
CANCELED,
|
||||
FIRST_LOG;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:DependOnType
|
||||
* @Date:2025/03/25 17:04
|
||||
* @Filename:DependOnType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DependOnType {
|
||||
ID,
|
||||
NAME;
|
||||
|
||||
public static DependOnType parse(String type) {
|
||||
if (type == null) return ID;
|
||||
for (DependOnType t : values()) {
|
||||
if (t.name().equals(type)) return t;
|
||||
}
|
||||
return ID;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:DeployStatus
|
||||
* @Date:2025/03/25 17:12
|
||||
* @Filename:DeployStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeployStatus {
|
||||
SUCCEED,
|
||||
FAILED,
|
||||
RUNNING,
|
||||
TIMEOUT;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:DockerVersion
|
||||
* @Date:2025/03/25 17:12
|
||||
* @Filename:DockerVersion
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DockerVersion {
|
||||
TLINUX1_2("tlinux1.2"),
|
||||
TLINUX2_2("tlinux2.2"),
|
||||
CUSTOMIZE("customize");
|
||||
|
||||
private final String value;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:EnvControlTaskType
|
||||
* @Date:2025/03/25 17:12
|
||||
* @Filename:EnvControlTaskType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EnvControlTaskType {
|
||||
VM,
|
||||
NORMAL;
|
||||
|
||||
public static EnvControlTaskType parse(String type) {
|
||||
try {
|
||||
return EnvControlTaskType.valueOf(type);
|
||||
} catch (Exception ignore) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:GitPullModeType
|
||||
* @Date:2025/03/25 17:13
|
||||
* @Filename:GitPullModeType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum GitPullModeType {
|
||||
BRANCH,
|
||||
TAG,
|
||||
COMMIT_ID;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:JobRunCondition
|
||||
* @Date:2025/03/25 17:13
|
||||
* @Filename:JobRunCondition
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum JobRunCondition {
|
||||
STAGE_RUNNING,
|
||||
CUSTOM_VARIABLE_MATCH,
|
||||
CUSTOM_VARIABLE_MATCH_NOT_RUN,
|
||||
CUSTOM_CONDITION_MATCH,
|
||||
PREVIOUS_STAGE_SUCCESS,
|
||||
PREVIOUS_STAGE_FAILED,
|
||||
PREVIOUS_STAGE_CANCEL;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:ManualReviewAction
|
||||
* @Date:2025/03/25 17:13
|
||||
* @Filename:ManualReviewAction
|
||||
* @description:Todo
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ManualReviewAction {
|
||||
PROCESS,
|
||||
ABORT;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:PipelineInstanceTypeEnum
|
||||
* @Date:2025/03/25 17:13
|
||||
* @Filename:PipelineInstanceTypeEnum
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PipelineInstanceTypeEnum {
|
||||
FREEDOM("FREEDOM"),
|
||||
CONSTRAINT("CONSTRAINT");
|
||||
|
||||
private final String type;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public static String getTemplateType(String type) {
|
||||
return switch (type) {
|
||||
case "FREEDOM" -> PipelineInstanceTypeEnum.FREEDOM.name();
|
||||
case "CONSTRAINT" -> PipelineInstanceTypeEnum.CONSTRAINT.name();
|
||||
default -> PipelineInstanceTypeEnum.FREEDOM.name();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:PipelineStorageType
|
||||
* @Date:2025/03/25 17:13
|
||||
* @Filename:PipelineStorageType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PipelineStorageType {
|
||||
YAML("YAML编排", ".yaml"),
|
||||
MODEL("JSON编排", ".json");
|
||||
|
||||
private final String desc;
|
||||
private final String fileSuffix;
|
||||
|
||||
public static PipelineStorageType getActionType(String type) {
|
||||
return "YAML".equals(type) ? YAML : MODEL;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:Platform
|
||||
* @Date:2025/03/25 17:16
|
||||
* @Filename:Platform
|
||||
* @description:Todo
|
||||
*/
|
||||
public enum Platform {
|
||||
ANDROID,
|
||||
IPHONE;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:ProjectPipelineCallbackStatus
|
||||
* @Date:2025/03/25 17:17
|
||||
* @Filename:ProjectPipelineCallbackStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
public enum ProjectPipelineCallbackStatus {
|
||||
SUCCESS,
|
||||
FAILED
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:SVNVersion
|
||||
* @Date:2025/03/25 17:24
|
||||
* @Filename:SVNVersion
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SVNVersion {
|
||||
V_1_6(10),
|
||||
V_1_7(29),
|
||||
V_1_8(31);
|
||||
|
||||
private final int version;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:SourceType
|
||||
* @Date:2025/03/25 17:26
|
||||
* @Filename:SourceType
|
||||
* @description:Todo
|
||||
*/
|
||||
public enum SourceType {
|
||||
PIPELINE,
|
||||
CUSTOMIZE
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:StageRunCondition
|
||||
* @Date:2025/03/25 17:17
|
||||
* @Filename:StageRunCondition
|
||||
* @description:运行选项
|
||||
*/
|
||||
public enum StageRunCondition {
|
||||
AFTER_LAST_FINISHED, // 上个阶段执行结束
|
||||
CUSTOM_VARIABLE_MATCH, // 自定义变量全部满足时运行
|
||||
CUSTOM_VARIABLE_MATCH_NOT_RUN, // 自定义变量全部满足时不运行
|
||||
CUSTOM_CONDITION_MATCH // 满足以下自定义条件时运行
|
||||
;
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:StartType
|
||||
* @Date:2025/03/25 17:23
|
||||
* @Filename:StartType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StartType {
|
||||
MANUAL,
|
||||
TIME_TRIGGER,
|
||||
WEB_HOOK,
|
||||
SERVICE,
|
||||
PIPELINE,
|
||||
REMOTE;
|
||||
|
||||
public static String toReadableString(String type, ChannelCode channelCode, String language) {
|
||||
String[] params = null;
|
||||
String name = switch (type) {
|
||||
case "MANUAL" -> MANUAL.name();
|
||||
case "TIME_TRIGGER" -> TIME_TRIGGER.name();
|
||||
case "WEB_HOOK" -> WEB_HOOK.name();
|
||||
case "REMOTE" -> REMOTE.name();
|
||||
case "SERVICE" -> {
|
||||
if (channelCode != null) {
|
||||
if (channelCode == ChannelCode.BS) {
|
||||
yield SERVICE.name() + "_BS";
|
||||
} else {
|
||||
params = new String[]{channelCode.name()};
|
||||
yield SERVICE.name() + "_CHANNEL";
|
||||
}
|
||||
} else {
|
||||
yield SERVICE.name() + "_NOT_CHANNEL";
|
||||
}
|
||||
}
|
||||
case "PIPELINE" -> PIPELINE.name();
|
||||
default -> "";
|
||||
};
|
||||
return name.isBlank() ? name : MessageUtil.getMessageByLocale("START_TYPE_" + name, language, params);
|
||||
}
|
||||
|
||||
public static StartType toStartType(String type) {
|
||||
for (StartType startType : values()) {
|
||||
if (type.equalsIgnoreCase(startType.name())) {
|
||||
return startType;
|
||||
}
|
||||
}
|
||||
LoggerFactory.getLogger(StartType.class).warn("Unknown start type(" + type + ")");
|
||||
return MANUAL;
|
||||
}
|
||||
|
||||
public static List<IdValue> getStartTypeMap(String language) {
|
||||
List<IdValue> result = new ArrayList<>();
|
||||
for (StartType startType : values()) {
|
||||
result.add(new IdValue(startType.name(), toReadableString(startType.name(), null, language)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String transform(String startType, String webhookType) {
|
||||
return switch (startType) {
|
||||
case "MANUAL" -> ManualTriggerElement.classType;
|
||||
case "TIME_TRIGGER" -> TimerTriggerElement.classType;
|
||||
case "WEB_HOOK" -> {
|
||||
yield switch (webhookType) {
|
||||
case "SVN" -> CodeSVNWebHookTriggerElement.classType;
|
||||
case "GIT" -> CodeGitWebHookTriggerElement.classType;
|
||||
case "GITLAB" -> CodeGitlabWebHookTriggerElement.classType;
|
||||
case "GITHUB" -> CodeGithubWebHookTriggerElement.classType;
|
||||
case "TGIT" -> CodeTGitWebHookTriggerElement.classType;
|
||||
default -> RemoteTriggerElement.classType;
|
||||
};
|
||||
}
|
||||
default -> RemoteTriggerElement.classType;
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:SvnDepth
|
||||
* @Date:2025/03/25 17:24
|
||||
* @Filename:SvnDepth
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SvnDepth {
|
||||
empty,
|
||||
files,
|
||||
immediates,
|
||||
infinity;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:TclsType
|
||||
* @Date:2025/03/25 17:24
|
||||
* @Filename:TclsType
|
||||
* @description:Todo
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TclsType {
|
||||
TCLS,
|
||||
MTCLS,
|
||||
MTCLS2;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:VMBaseOS
|
||||
* @Date:2025/03/25 17:25
|
||||
* @Filename:VMBaseOS
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VMBaseOS {
|
||||
MACOS,
|
||||
LINUX,
|
||||
WINDOWS,
|
||||
ALL;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:VMBuildResult
|
||||
* @Date:2025/03/25 17:25
|
||||
* @Filename:VMBuildResult
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VMBuildResult {
|
||||
SUCCEED,
|
||||
FAILED,
|
||||
TIMEOUT,
|
||||
CANCELED;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cd.casic.ci.common.pipeline.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.enums
|
||||
* @Project:ops-pro
|
||||
* @name:VersionStatus
|
||||
* @Date:2025/03/25 17:24
|
||||
* @Filename:VersionStatus
|
||||
* @description:Todo
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VersionStatus {
|
||||
RELEASED("已发布版本"),
|
||||
COMMITTING("草稿版本"),
|
||||
BRANCH("分支版本"),
|
||||
BRANCH_RELEASE("通过分支版本发布(中间态)"),
|
||||
DRAFT_RELEASE("通过草稿版本发布(中间态)"),
|
||||
DELETE("被删除(无法查询)");
|
||||
|
||||
private final String statusName;
|
||||
|
||||
public VersionStatus fix() {
|
||||
return this == BRANCH_RELEASE ? BRANCH : this == DRAFT_RELEASE ? RELEASED : this;
|
||||
}
|
||||
|
||||
public boolean isReleasing() {
|
||||
return this == RELEASED || this == BRANCH_RELEASE || this == DRAFT_RELEASE;
|
||||
}
|
||||
|
||||
public boolean isNotReleased() {
|
||||
return this == COMMITTING || this == BRANCH;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cd.casic.ci.common.pipeline.option;
|
||||
|
||||
import cd.casic.ci.common.pipeline.NameAndValue;
|
||||
import cd.casic.ci.common.pipeline.enums.DependOnType;
|
||||
import cd.casic.ci.common.pipeline.enums.JobRunCondition;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.option
|
||||
* @Project:ops-pro
|
||||
* @name:JobControlOption
|
||||
* @Date:2025/03/25 17:59
|
||||
* @Filename:JobControlOption
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "job流程控制模型")
|
||||
public class JobControlOption {
|
||||
@Schema(title = "是否启用Job", required = false)
|
||||
private Boolean enable = true; // 是否启用Job
|
||||
|
||||
@Schema(title = "Job准备环境的超时时间 分钟Minutes", required = false)
|
||||
private Integer prepareTimeout; // Job准备环境的超时时间 分钟Minutes
|
||||
|
||||
@Schema(title = "Job执行的超时时间 分钟Minutes", required = false)
|
||||
private Integer timeout = 900; // Job执行的超时时间 分钟Minutes
|
||||
|
||||
@Schema(title = "新的Job执行的超时时间,支持变量 分钟Minutes,出错则取timeout的值", required = false)
|
||||
private String timeoutVar; // Job执行的超时时间 分钟Minutes
|
||||
|
||||
@Schema(title = "运行条件", required = false)
|
||||
private JobRunCondition runCondition = JobRunCondition.STAGE_RUNNING; // 运行条件
|
||||
|
||||
@Schema(title = "自定义变量", required = false)
|
||||
private List<NameAndValue> customVariables = List.of(); // 自定义变量
|
||||
|
||||
@Schema(title = "自定义条件", required = false)
|
||||
private String customCondition; // 自定义条件
|
||||
|
||||
@Schema(title = "job依赖", required = false)
|
||||
private DependOnType dependOnType; // job依赖
|
||||
|
||||
@Schema(title = "需要过滤不存在的job,定义为var类型", required = false)
|
||||
private List<String> dependOnId; // 需要过滤不存在的job,定义为var类型
|
||||
|
||||
@Schema(title = "job依赖名称", required = false)
|
||||
private String dependOnName;
|
||||
|
||||
@Schema(title = "containerId与jobId映射,depend on运行时使用的是containerId", required = false)
|
||||
private Map<String, String> dependOnContainerId2JobIds; // containerId与jobId映射,depend on运行时使用的是containerId
|
||||
|
||||
@Schema(title = "是否失败继续", required = false)
|
||||
private Boolean continueWhenFailed = false; // 失败继续
|
||||
|
||||
@Schema(title = "第三方构建机集群-单节点并发限制")
|
||||
private Integer singleNodeConcurrency;
|
||||
|
||||
@Schema(title = "第三方构建机集群-所有节点并发限制")
|
||||
private Integer allNodeConcurrency;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cd.casic.ci.common.pipeline.option;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.option
|
||||
* @Project:ops-pro
|
||||
* @name:MatrixControlOption
|
||||
* @Date:2025/03/25 17:59
|
||||
* @Filename:MatrixControlOption
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "构建矩阵配置项模型")
|
||||
public class MatrixControlOption {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Pattern MATRIX_JSON_KEY_PATTERN = Pattern.compile("^(fromJSON\\()([^(^)]+)[\\)]\$");
|
||||
private static final Logger logger = LoggerFactory.getLogger(MatrixControlOption.class);
|
||||
private static final int MATRIX_CASE_MAX_COUNT = 256;
|
||||
|
||||
@Schema(title = "分裂策略(支持变量、Json、参数映射表)", required = true)
|
||||
private String strategyStr; // Map<String, List<String>>
|
||||
|
||||
@Schema(title = "额外的参数组合(变量名到特殊值映射的数组)", required = false)
|
||||
private String includeCaseStr; // List<Map<String, String>>
|
||||
|
||||
@Schema(title = "排除的参数组合(变量名到特殊值映射的数组)", required = false)
|
||||
private String excludeCaseStr; // List<Map<String, String>>
|
||||
|
||||
@Schema(title = "是否启用容器失败快速终止整个矩阵", required = false)
|
||||
private Boolean fastKill = false;
|
||||
|
||||
@Schema(title = "Job运行的最大并发量", required = false)
|
||||
private Integer maxConcurrency = 5;
|
||||
|
||||
@Schema(title = "自定义调度类型(用于生成DispatchType的任意对象)", required = false)
|
||||
private DispatchInfo customDispatchInfo; // DispatchTypeParser的传入和解析保持一致即可
|
||||
|
||||
@Schema(title = "矩阵组的总数量", required = false)
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(title = "完成执行的数量", required = false)
|
||||
private Integer finishCount;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cd.casic.ci.common.pipeline.option;
|
||||
|
||||
import cd.casic.ci.common.pipeline.NameAndValue;
|
||||
import cd.casic.ci.common.pipeline.enums.StageRunCondition;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.option
|
||||
* @Project:ops-pro
|
||||
* @name:StageControlOption
|
||||
* @Date:2025/03/25 18:06
|
||||
* @Filename:StageControlOption
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "阶段流程控制模型")
|
||||
public class StageControlOption {
|
||||
@Schema(title = "是否启用该阶段", required = false)
|
||||
private Boolean enable = true; // 是否启用该阶段
|
||||
|
||||
@Schema(title = "运行条件", required = false)
|
||||
private StageRunCondition runCondition = StageRunCondition.AFTER_LAST_FINISHED; // 运行条件
|
||||
|
||||
@Schema(title = "自定义变量", required = false)
|
||||
private List<NameAndValue> customVariables = List.of(); // 自定义变量
|
||||
|
||||
@Schema(title = "自定义条件", required = false)
|
||||
private String customCondition; // 自定义条件
|
||||
|
||||
@Schema(title = "是否人工触发", required = false)
|
||||
@Deprecated("被StagePauseCheck.manualTrigger代替")
|
||||
private Boolean manualTrigger = false;
|
||||
|
||||
@Schema(title = "可触发用户,支持引用变量", required = false)
|
||||
@Deprecated("被StagePauseCheck.reviewGroups代替")
|
||||
private List<String> triggerUsers; // 可触发用户,支持引用变量
|
||||
|
||||
@Schema(title = "已通过审核", required = false)
|
||||
@Deprecated("被StagePauseCheck.status代替")
|
||||
private Boolean triggered; // 已通过审核
|
||||
|
||||
@Schema(title = "等待审核的超时时间", required = false)
|
||||
@Deprecated("被StagePauseCheck.timeout代替")
|
||||
private Integer timeout; // 等待审核的超时时间
|
||||
|
||||
@Schema(title = "审核变量", required = false)
|
||||
@Deprecated("被StagePauseCheck.reviewParams代替")
|
||||
private List<ManualReviewParam> reviewParams; // 审核变量
|
||||
|
||||
@Schema(title = "审核说明", required = false)
|
||||
@Deprecated("被StagePauseCheck.reviewDesc代替")
|
||||
private String reviewDesc; // 审核说明
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:AtomBaseInfo
|
||||
* @Date:2025/03/25 15:38
|
||||
* @Filename:AtomBaseInfo
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "插件基本信息")
|
||||
public class AtomBaseInfo {
|
||||
@Schema(title = "插件Id", required = true)
|
||||
private String atomId;
|
||||
@Schema(title = "插件代码", required = true)
|
||||
private String atomCode;
|
||||
@Schema(title = "插件版本号", required = true)
|
||||
private String version;
|
||||
@Schema(title = "插件状态", required = true)
|
||||
private String atomStatus;
|
||||
@Schema(title = "插件开发语言", required = false)
|
||||
private String language;
|
||||
@Schema(title = "分支", required = false)
|
||||
private String branch;
|
||||
@Schema(title = "代码提交ID", required = false)
|
||||
private String commitId;
|
||||
@Schema(title = "支持的操作系统名称", required = false)
|
||||
private String osName;
|
||||
@Schema(title = "支持的操作系统架构", required = false)
|
||||
private String osArch;
|
||||
@Schema(title = "不支持的操作系统组合信息", required = false)
|
||||
private String invalidOsInfo;
|
||||
@Schema(title = "运行时版本", required = false)
|
||||
private String runtimeVersion;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import cn.hutool.http.useragent.OS;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildContainerType
|
||||
* @Date:2025/03/25 15:38
|
||||
* @Filename:BuildContainerType
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
public class BuildContainerType {
|
||||
private BuildType buildType;
|
||||
private OS os;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildEnvParameters
|
||||
* @Date:2025/03/25 15:39
|
||||
* @Filename:BuildEnvParameters
|
||||
* @description:Todo
|
||||
*/
|
||||
@Schema(title = "构建-变量描述")
|
||||
public class BuildEnvParameters {
|
||||
@Schema(title = "名称")
|
||||
private String name;
|
||||
@Schema(title = "描述")
|
||||
private String desc;
|
||||
@Schema(title = "路径")
|
||||
private String path;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildFormProperty
|
||||
* @Date:2025/03/25 15:42
|
||||
* @Filename:BuildFormProperty
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "构建模型-表单元素属性")
|
||||
public class BuildFormProperty {
|
||||
@Schema(title = "元素ID-标识符", required = true)
|
||||
private String id;
|
||||
@Schema(title = "元素名称", required = true)
|
||||
private String name;
|
||||
@Schema(title = "是否必须(新前端的入参标识)", required = true)
|
||||
private boolean required;
|
||||
@Schema(title = "是否为常量", required = true)
|
||||
private boolean constant;
|
||||
@Schema(title = "元素类型", required = true)
|
||||
private BuildFormPropertyType type;
|
||||
@Schema(title = "默认值", required = true)
|
||||
private Object defaultValue;
|
||||
@Schema(title = "上次构建的取值", required = true)
|
||||
private Object value;
|
||||
@Schema(title = "下拉框列表", required = false)
|
||||
private List<BuildFormValue> options;
|
||||
@Schema(title = "描述", required = false)
|
||||
private String desc;
|
||||
@Schema(title = "repoHashId", required = false)
|
||||
private String repoHashId;
|
||||
@Schema(title = "relativePath", required = false)
|
||||
private String relativePath;
|
||||
@Schema(title = "代码库类型下拉", required = false)
|
||||
private ScmType scmType;
|
||||
@Schema(title = "构建机类型下拉", required = false)
|
||||
private BuildContainerType containerType;
|
||||
@Schema(title = "自定义仓库通配符", required = false)
|
||||
private String glob;
|
||||
@Schema(title = "文件元数据", required = false)
|
||||
private Map<String, String> properties;
|
||||
@Schema(title = "元素标签", required = false)
|
||||
private String label;
|
||||
@Schema(title = "元素placeholder", required = false)
|
||||
private String placeholder;
|
||||
@Schema(title = "元素模块", required = false)
|
||||
private String propertyType;
|
||||
@Schema(title = "搜索url, 当是下拉框选项时,列表值从url获取不再从option获取", required = false)
|
||||
private String searchUrl;
|
||||
@Schema(title = "替换搜索url中的搜素关键字", required = false)
|
||||
private String replaceKey;
|
||||
@Schema(title = "是否只读", required = false)
|
||||
private boolean readOnly;
|
||||
@Schema(title = "参数值是否必填", required = false)
|
||||
private boolean valueNotEmpty;
|
||||
@Schema(title = "页面所需内容,后台仅保存,不做处理", required = false)
|
||||
private Object payload;
|
||||
@Schema(title = "级联选择器属性", required = false)
|
||||
private BuildCascadeProps cascadeProps;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildFormValue
|
||||
* @Date:2025/03/25 15:44
|
||||
* @Filename:BuildFormValue
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "构建模型-下拉框表单元素值")
|
||||
public class BuildFormValue {
|
||||
@Schema(title = "元素值ID-标识符", required = true)
|
||||
private String key;
|
||||
@Schema(title = "元素值名称-显示用", required = true)
|
||||
private String value;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildNo
|
||||
* @Date:2025/03/25 15:44
|
||||
* @Filename:BuildNo
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
public class BuildNo {
|
||||
private int buildNo;
|
||||
private BuildNoType buildNoType;
|
||||
private boolean required;
|
||||
private Integer currentBuildNo;
|
||||
|
||||
public enum BuildNoType {
|
||||
CONSISTENT,
|
||||
SUCCESS_BUILD_INCREMENT,
|
||||
EVERY_BUILD_INCREMENT
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildNoUpdateReq
|
||||
* @Date:2025/03/25 15:45
|
||||
* @Filename:BuildNoUpdateReq
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "流水线构建推荐版本号更新")
|
||||
public class BuildNoUpdateReq {
|
||||
@Schema(title = "推荐版本号buildNo当前值", required = true)
|
||||
private int currentBuildNo;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildParameterGroup
|
||||
* @Date:2025/03/25 15:45
|
||||
* @Filename:BuildParameterGroup
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "构建-变量描述")
|
||||
public class BuildParameterGroup {
|
||||
@Schema(title = "名称(国际化)")
|
||||
private String name;
|
||||
@Schema(title = "描述")
|
||||
private List<BuildEnvParameters> params;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:BuildParameters
|
||||
* @Date:2025/03/25 16:05
|
||||
* @Filename:BuildParameters
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "构建模型-构建参数")
|
||||
public class BuildParameters {
|
||||
@Schema(title = "元素值ID-标识符", required = true)
|
||||
private String key;
|
||||
@Schema(title = "元素值名称-显示用", required = true)
|
||||
private Object value;
|
||||
@Schema(title = "元素值类型", required = false)
|
||||
private BuildFormPropertyType valueType;
|
||||
@Schema(title = "是否只读", required = false)
|
||||
private boolean readOnly;
|
||||
@Schema(title = "描述", required = false)
|
||||
private String desc;
|
||||
@Schema(title = "默认值", required = false)
|
||||
private Object defaultValue;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:DependOnConfig
|
||||
* @Date:2025/03/25 16:06
|
||||
* @Filename:DependOnConfig
|
||||
* @description:Todo
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DependOnConfig {
|
||||
private DependOnType dependOnType;
|
||||
private List<String> dependOnId;
|
||||
private String dependOnName;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:JobHeartbeatRequest
|
||||
* @Date:2025/03/25 16:06
|
||||
* @Filename:JobHeartbeatRequest
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "心跳请求报文体")
|
||||
public class JobHeartbeatRequest {
|
||||
@Schema(title = "task执行速率", required = false)
|
||||
private Map<String, Double> task2ProgressRate;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cd.casic.ci.common.pipeline.pojo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Author:mianbin
|
||||
* @Package:cd.casic.ci.common.pipeline.pojo
|
||||
* @Project:ops-pro
|
||||
* @name:MatrixPipelineInfo
|
||||
* @Date:2025/03/25 16:06
|
||||
* @Filename:MatrixPipelineInfo
|
||||
* @description:Todo
|
||||
*/
|
||||
@Data
|
||||
public class MatrixPipelineInfo {
|
||||
@Schema(title = "作为输入值时:额外的参数组合(String)/作为输出值时:校验结果", required = false)
|
||||
private String include;
|
||||
@Schema(title = "作为输入值时:排除的参数组合(String)/作为输出值时:校验结果", required = false)
|
||||
private String exclude;
|
||||
@Schema(title = "作为输入值时:分裂策略(String)/作为输出值时:校验结果", required = false)
|
||||
private String strategy;
|
||||
|
||||
public Map<String, Object> toMatrixConvert() {
|
||||
return Map.of(
|
||||
"include", !this.include.isNullOrBlank() ? parseYaml(this.include) : null,
|
||||
"exclude", !this.exclude.isNullOrBlank() ? parseYaml(this.exclude) : null,
|
||||
"strategy", !this.strategy.isNullOrBlank() ? parseYaml(this.strategy) : null
|
||||
);
|
||||
}
|
||||
|
||||
private Object parseYaml(String input) {
|
||||
Pattern pattern = Pattern.compile("^(\\\$\\{\\{[ ]*fromJSON\\()([^(^)]+)(\\)[ ]*\\}\\})$");
|
||||
if (pattern.matcher(input).find()) {
|
||||
return null;
|
||||
}
|
||||
return YamlUtil.to(input);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user