[英]Using Artifactory plugin for Jenkins, is there a way to search repos for images with a property?
[英]Jenkins Artifactory Plugin
Jenkins Artifactory插件可以在docker-in-docker中运行吗? 我想在下面提供的管道构建中与Jenkins Kubernetes插件一起使用此插件。
示例管道创建一个Pod,该Pod首先使用git
容器克隆给定的project-examples
存储库,然后使用maven
容器构建项目。
我怀疑我遇到了这个问题,只是想再次检查是否仍然如此。 执行时,Artifactory插件在Pod中而不是maven
容器中搜索资源,例如MAVEN_HOME。 无法找到插件失败的资源。
def label = "worker-${UUID.randomUUID().toString()}"
podTemplate(label: label, containers: [
containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'git', image: 'alpine/git', command: 'cat', ttyEnabled: true)
]) {
node(label) {
container('maven') {
def server
def buildInfo
def rtMaven
stage ('Clone') {
git url: 'https://github.com/jfrogdev/project-examples.git'
}
stage ('Test a Maven project') {
server = Artifactory.server 'private-artifactory'
rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = 'maven'
rtMaven.run pom: 'maven-example/pom.xml', goals: 'clean build', buildInfo: buildInfo
buildInfo = Artifactory.newBuildInfo()
}
}
我遇到了同样的问题,并尝试在配置与Maven安装的连接上进行各种更改。
似乎可以完成在docker映像中安装的maven安装的最终配置如下:
stage("build") {
def server=Artifactory.server('My art')
def rtMaven=Artifactory.newMavenBuild()
rtMaven.resolver server: server, releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot'
rtMaven.deployer server: server, releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local'
env.MAVEN_HOME="/usr/share/maven"
def buildInfo = rtMaven.run pom: 'sub-dir/pom.xml', goals: 'clean install'
server.publishBuildInfo buildInfo
}
使用env.MAVEN_HOME而不是依赖工具配置似乎可以工作。 记住将其放置在rtMave.run之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.