具有Dockerized声明性管道的Artifactory插件

时间:2018-09-27 18:54:02

标签: docker jenkins jenkins-plugins jenkins-pipeline artifactory

我正在尝试使用Jenkins声明性管道来进行dockerized构建。我正在使用Artifactory插件来解决依赖关系。以下管道适用于agent: any,但给出了dockerfile的授权错误。

def server = Artifactory.server ARTIFACTORY_NAME
def rtMaven = Artifactory.newMavenBuild()
def buildInfo

pipeline {
    agent {
        dockerfile true
    }

    stages {
        stage('Artifactory configuration') {
            steps {
                script {
//                    rtMaven.tool = "maven 3.3.9"
                    rtMaven.deployer server: server
                    rtMaven.resolver server: server
                    buildInfo = Artifactory.newBuildInfo()
                }
            }
        }
        stage('Build') {
            steps {
                script {
                    env.MAVEN_HOME="/usr/share/maven"
                    env.JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
                    echo "MAVEN_HOME ${MAVEN_HOME}"
                    echo "JAVA_HOME ${JAVA_HOME}"
                    rtMaven.run pom: 'pom.xml', goals: 'clean install test', buildInfo: buildInfo
                }
            }
        }
    }

}

JAVA_HOMEMAVEN_HOME的设置与Dockerfile中的设置相同。错误显示如下:

 Non-resolvable parent POM for ARTIFACTORY: Could not transfer artifact ARTIFACTORY from/to artifactory (ARTIFACTORY_PATH): 
Not authorized , ReasonPhrase:Unauthorized. and 'parent.relativePath' points at wrong local POM @ line 11, column 13 -> [1m[Help 2][m

0 个答案:

没有答案