如何通过jenkins文件将文件夹中的所有内容部署到具有相似文件夹结构的工件中
How to deploy all the content in a folder to artifactory with similar folder structure through jenkins file
我们正在使用 artifactory 来存储我们的文件。位置 ${WORKSPACE}/build/processed/webApps/epmapp/*
下的所有文件和文件夹应复制到下面提到的目标位置。
但是只复制了文件。
stage('Deploy Artifacts')
{
def targetLocation="epmpbcs-release-local/Platform/PBCSVB/${BRANCH_NAME}/latest/"
def targetLocationBuildNumber="epmpbcs-release/PBCSVB/${BRANCH_NAME}/${env.BUILD_NUMBER}/"
stdout = sh(script: 'rm -fv ${WORKSPACE}/buildversion.txt', returnStdout: true)
println("Delete buildversion.txt stdout ################ " + stdout + " ####################")
def buildversion = new File("${WORKSPACE}/buildversion.txt")
// def w = buildversion.newWriter()
buildversion<<"PBCSVB Branch:${BRANCH_NAME}, Build Number:${BUILD_NUMBER}"
//
def uploadSpec = """{
"files": [
{
"pattern": "${WORKSPACE}/build/processed/webApps/epmapp/*",
"target" : "$targetLocation"
}
]
}"""
您不能一次上传文件和文件夹。这是上传部分工件的限制。
在上传工件之前,您需要再添加一项任务。
添加一个步骤以创建 .zip 或 .gzp 格式的“epmapp”文件夹,然后上传。
def uploadSpec = """{
"files": [
{
"pattern": "epmapp.zip",
"target" : "$targetLocation",
"recursive": "false"
}
]
}"""
使用此 link 了解更多信息。
我们正在使用 artifactory 来存储我们的文件。位置 ${WORKSPACE}/build/processed/webApps/epmapp/*
下的所有文件和文件夹应复制到下面提到的目标位置。
但是只复制了文件。
stage('Deploy Artifacts')
{
def targetLocation="epmpbcs-release-local/Platform/PBCSVB/${BRANCH_NAME}/latest/"
def targetLocationBuildNumber="epmpbcs-release/PBCSVB/${BRANCH_NAME}/${env.BUILD_NUMBER}/"
stdout = sh(script: 'rm -fv ${WORKSPACE}/buildversion.txt', returnStdout: true)
println("Delete buildversion.txt stdout ################ " + stdout + " ####################")
def buildversion = new File("${WORKSPACE}/buildversion.txt")
// def w = buildversion.newWriter()
buildversion<<"PBCSVB Branch:${BRANCH_NAME}, Build Number:${BUILD_NUMBER}"
//
def uploadSpec = """{
"files": [
{
"pattern": "${WORKSPACE}/build/processed/webApps/epmapp/*",
"target" : "$targetLocation"
}
]
}"""
您不能一次上传文件和文件夹。这是上传部分工件的限制。 在上传工件之前,您需要再添加一项任务。 添加一个步骤以创建 .zip 或 .gzp 格式的“epmapp”文件夹,然后上传。
def uploadSpec = """{
"files": [
{
"pattern": "epmapp.zip",
"target" : "$targetLocation",
"recursive": "false"
}
]
}"""
使用此 link 了解更多信息。