同事们,早上好。我正在尝试在我的项目中实现gitlab-ci。我已经创建了所有阶段,除了部署之外,它们都起作用。 作为教学材料和示例,我使用了以下文章:https://jfrog.com/blog/gitlab-and-artifactory-on-your-mark-get-set-build/
我在gitlab-ci文件中有一个阶段:
deploy-artifactory-snapshot:
image: maven:3.5.0-jdk-8
stage: deploy-artifactory
tags:
- release
before_script:
# Install JFrog CLI
- curl -fL https://getcli.jfrog.io | sh
# Configure Artifactory instance with JFrog CLI
- ./jfrog rt config --url=${ARTIFACTORY_URL} --user=${ARTIFACTORY_USER} --password=${ARTIFACTORY_PASSWORD}
- ./jfrog rt c show
# Set the M2_HOME environment variable
- export M2_HOME=/usr/share/maven
# Replace the repository name in the configuration.yml to the correct one.
- sed -i 's,MAVEN_REPO_SNAPSHOT_DEPLOYER,'"$MAVEN_REPO_SNAPSHOT_DEPLOYER"',g' configuration.yml
- sed -i 's,MAVEN_REPO_RELEASES_DEPLOYER,'"$MAVEN_REPO_RELEASES_DEPLOYER"',g' configuration.yml
- sed -i 's,MAVEN_REPO_SNAPSHOT_RESOLVER,'"$MAVEN_REPO_SNAPSHOT_RESOLVER"',g' configuration.yml
- sed -i 's,MAVEN_REPO_RELEASES_RESOLVER,'"$MAVEN_REPO_RELEASES_RESOLVER"',g' configuration.yml
script:
# Run the MVN command
- ./jfrog rt mvn "clean install" configuration.yml --build-name=scdfrestrunner --build-number=$CI_JOB_ID
# Collect the environment variables
- ./jfrog rt bce gitlabci-maven-artifactory $CI_JOB_ID
# Pass the build information to Artifactory
- ./jfrog rt bp gitlabci-maven-artifactory $CI_JOB_ID
only:
- develop
这是我的Jfrog app的configuration.yml属性文件:
version: 1
type: maven
resolver:
snapshotRepo: MAVEN_REPO_SNAPSHOT_RESOLVER
releaseRepo: MAVEN_REPO_RELEASES_RESOLVER
serverID: Default-Server
deployer:
snapshotRepo: MAVEN_REPO_SNAPSHOT_DEPLOYER
releaseRepo: MAVEN_REPO_RELEASES_DEPLOYER
serverID: Default-Server
每次我尝试通过gitlab-ci部署我的工件时,都会收到下一个异常:
由以下原因引起:java.lang.RuntimeException:发布时发生错误 人工制品的人工制品: /builds/Aleksandr.Shapovalov/scdfrestrunner/target/scdf-rest-runner-1.0-SNAPSHOT.jar。 跳过剩余工件(如果有)和构建信息的部署。 在 org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:316) 在 org.jfrog.build.extractor.maven.BuildDeploymentHelper.deploy(BuildDeploymentHelper.java:108) 在 org.jfrog.build.extractor.maven.BuildInfoRecorder.sessionEnded(BuildInfoRecorder.java:173) ... 17更多原因:org.apache.http.ConnectionClosedException: 块编码消息正文的过早结束:预期在以下时间关闭块 org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:266) 在 org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:225) 在 org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:184) 在 org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137) 在sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)在 sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)在 sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)在 java.io.InputStreamReader.read(InputStreamReader.java:184)在 java.io.Reader.read(Reader.java:140)在 org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2369)在 org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2348)在 org.apache.commons.io.IOUtils.copy(IOUtils.java:2325)在 org.apache.commons.io.IOUtils.copy(IOUtils.java:2273)在 org.apache.commons.io.IOUtils.toString(IOUtils.java:1041)在 org.apache.commons.io.IOUtils.toString(IOUtils.java:1066)在 org.jfrog.build.client.ArtifactoryHttpClient.execute(ArtifactoryHttpClient.java:234) 在 org.jfrog.build.client.ArtifactoryHttpClient.upload(ArtifactoryHttpClient.java:225) 在 org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:687) 在 org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.doDeployArtifact(ArtifactoryBuildInfoClient.java:374) 在 org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:362) 在 org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:347) 在 org.jfrog.build.extractor.maven.BuildDeploymentHelper.deployArtifacts(BuildDeploymentHelper.java:314) ...还有19个
有人可以描述我哪里错了。 Artifactory版本为6.0.1 GitLab社区版11.1.4
更新:
似乎没有任何连接问题,我看到我的构建代理正在从我们的工件下载。例如,许多行之一:
下载: https://artifactory.mycompany.net:443/artifactory/libs-release/org/springframework/boot/spring-boot-starter-parent/2.0.3.RELEASE/spring-boot-starter-parent-2.0.3.RELEASE.pom (12 kB at 17 kB / s)下载: https://artifactory.mycompany.net:443/artifactory/libs-release/org/springframework/boot/spring-boot-dependencies/2.0.3.RELEASE/spring-boot-dependencies-2.0.3.RELEASE.pom
我的舞台就在这一行之后:
[main] INFO org.jfrog.build.extractor.maven.BuildInfoClientBuilder- 部署工件: https://artifactory.mycompany.net:443/artifactory/libs-snapshot-local/net/mycompany/scdf-rest-runner/1.0-SNAPSHOT/scdf-rest-runner-1.0-SNAPSHOT.jar
答案 0 :(得分:1)
我将检查注册表中是否存在您要推送的工件(人工工厂)
我能够重现此问题。
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipCachedTaskExecuter.execute(SkipCachedTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.UncheckedIOException: org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:784)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:751)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 31 more
Caused by: org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:266)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:225)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:184)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1680)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1659)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1636)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1611)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:668)
at org.jfrog.build.client.ArtifactoryHttpClient.execute(ArtifactoryHttpClient.java:225)
at org.jfrog.build.client.ArtifactoryHttpClient.upload(ArtifactoryHttpClient.java:216)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:680)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.doDeployArtifact(ArtifactoryBuildInfoClient.java:367)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:355)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:340)
at org.jfrog.gradle.plugin.artifactory.task.DeployTask.deployArtifacts(DeployTask.java:262)
at org.jfrog.gradle.plugin.artifactory.task.DeployTask.prepareAndDeploy(DeployTask.java:113)
at org.jfrog.gradle.plugin.artifactory.task.DeployTask.collectProjectBuildInfo(DeployTask.java:50)
at org.jfrog.gradle.plugin.artifactory.task.DeployTask.taskAction(DeployTask.java:44)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)