我想从自动清理中保护一些Jenkins构建。我找到http://ci.jenkins.com/job/[job_name]/[build_v]/toggleLogKeep但是这需要我检查状态。我还可以使用其他任何终点吗?理想情况下,它将是/ keepBuildForever / dontKeepBuildForever
答案 0 :(得分:0)
看起来没有好的解决方案。最好的方法是列出所有保持永久构建。然后检查它是否已经在列表中,如果没有点击/ toggleLogKeep端点
buildsXml = http://ci.jenkins.com/api/xml?depth=2&xpath=/hudson/job/build[keepLog=%22true%22]/url&wrapper=forever
#check if your build is in buildsXml
答案 1 :(得分:0)
在意外删除重要版本后,我找到了另一种解决方案:
# if running inside a job, the following vars are already populated:
#JOB_NAME=yourjobname
#BUILD_NUMBER=123 #your build number
#JENKINS_HOST=192.168.1.11
#JENKINS_PORT=8080
#JENKINS_URL=http://${JENKINS_HOST}:${JENKINS_PORT}
wget --no-check-certificate "${JENKINS_URL}/jnlpJars/jenkins-cli.jar"
java -jar jenkins-cli.jar -s "$JENKINS_URL" keep-build "$JOB_NAME" "$BUILD_NUMBER"