我正在尝试使用称为Gradle工具的Jenkins Pipeline将人工制品推到Artifactory。
我正在关注在GitHub上发布的示例:
我的詹金斯管道脚本:
stage('Perform Gradle Release') { //ssh-agent required to perform GIT push (when tagging the branch on release) sshagent([git_credential]) { sh "./gradlew clean release unSnapshotVersion -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${release_version} -Prelease.newVersion=${development_version}" } // Create an Artifactory server instance def server = Artifactory.server('my-artifactory') // Create and set an Artifactory Gradle Build instance: def rtGradle = Artifactory.newGradleBuild() rtGradle.resolver server: server, repo: 'libs-release' rtGradle.deployer server: server, repo: 'libs-release-local' //Use Gradle Wrapper rtGradle.useWrapper = true //Creates buildinfo def buildInfo = Artifactory.newBuildInfo() buildInfo.env.capture = true buildInfo.env.filter.addInclude("*") // Run Gradle: rtGradle.run rootDir: "./", buildFile: 'build.gradle', tasks: 'clean artifactoryPublish', buildInfo: buildInfo // Publish the build-info to Artifactory: server.publishBuildInfo buildInfo }
我的Gradle文件非常轻巧,我只是使用插件Gradle Release Plugin执行Gradle发布。
执行管道时,它失败并显示以下消息:
:artifactoryPublish BUILD SUCCESSFUL Total time: 17.451 secs ERROR: Couldn't read generated build info at : /tmp/generated.build.info4898776990575217114.json [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline hudson.model.Run$RunnerAbortedException at org.jfrog.hudson.pipeline.Utils.getGeneratedBuildInfo(Utils.java:188) at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:127) at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:96) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40) ... Finished: FAILURE
当我在服务器上检查时,没有这样的文件/tmp/generated.build.info4898776990575217114.json(用户当然有权写入/ tmp)。
谢谢你的帮助。
[编辑]很奇怪,但是我发现了一些名为“ buildInfo2408849984051060030.properties”的文件,其中包含这些信息。名称不相同,格式也不相同,这些文件存储在我的Jenkins机器上,而不是我的从属计算机执行管道中。
感谢@ tamir-hadad,它的确已在2.8.2中修复。