在我的..gitlab ci.yml中,我有以下工作:
init_db:
stage: build
script:
- cd database-migration
- "mvn clean install exec:java"执行数据库迁移。其代码如下所示:
public static void main( String[] args ) {
doSomeMigration();
System.out.println("Migration done!");
System.exit(0);
}在GitLab的日志中,我得到了以下结果:
Migration done!
ERROR: Job failed: execution took longer than 1h0m0s seconds因此,在我看来,脚本运行正常,但在那之后,工作并没有结束。你能看出我做错了什么吗?
编辑
用于数据库迁移的pom.xml如下所示:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.domain</groupId>
<artifactId>database-migration</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<executable>java</executable>
<mainClass>com.domain.DatabaseMigrationApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>
<dependencies>
<dependency>
... database dependency...
</dependency>
</dependencies>
</project>发布于 2018-02-21 19:21:04
尝试将--batch-mode添加到mvn选项中。
发布于 2018-03-22 10:23:43
即使您的任务成功,它也已超时,因此您必须增加超时限制。
请参阅以下现有的堆栈溢出问题GitLab CI流水线级超时
发布于 2020-07-01 02:35:34
如果您使用服务docker:dind,那么让我们试试docker:19.03.5-dind。请查找详细信息这里。
https://stackoverflow.com/questions/48912693
复制相似问题