sách gpt4 ai đã đi

Jenkins pipeline, làm thế nào để sao chép các hiện vật từ bản dựng trước sang bản dựng hiện tại?

In lại 作者:行者123 更新时间:2023-12-03 18:40:53 30 4
mua khóa gpt4 Nike

在 Jenkins Pipeline 中,如何将工件从以前的构建复制到当前构建?
即使之前的构建失败,我也想这样做。

1 Câu trả lời

Stuart Rowe 还在 Pipeline Authoring Sig Gitter channel 上向我推荐了我查看 Copy Artifact Plugin,但也给了我一些示例 Jenkins Pipeline syntax to use .

根据他给出的建议,我想出了这个更完整的 Pipeline 示例
它将先前构建中的工件复制到当前构建中,
之前的构建是成功还是失败。

pipeline {
agent any;

stages {
stage("Zeroth stage") {
steps {
script {
if (currentBuild.previousBuild) {
thử {
copyArtifacts(projectName: currentBuild.projectName,
selector: specific("${currentBuild.previousBuild.number}"))
def previousFile = readFile(file: "usefulfile.txt")
echo("The current build is ${currentBuild.number}")
echo("The previous build artifact was: ${previousFile}")
} catch(err) {
// ignore error
}
}
}
}
}

stage("First stage") {
steps {
echo("Hello")
writeFile(file: "usefulfile.txt", text: "This file ${env.BUILD_NUMBER} is useful, need to archive it.")
archiveArtifacts(artifacts: 'usefulfile.txt')
}
}

stage("Error") {
steps {
error("Failed")
}
}
}
}

关于Jenkins 管道,如何将工件从以前的构建复制到当前构建?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54382949/

30 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com