我试图改善Jenkins作业的构建时间,并尝试使用预先安装的依赖项构建docker容器。
我有以下(部分)Jenkinsfile
:
pipeline {
agent {
docker {
image 'docker-local.artifactory.com/app-chromium:latest'
registryUrl 'https://docker-local.artifactory.com/'
registryCredentialsId 'artifactoryapikey'
}
}
}
而且,根据日志,詹金斯正在正确下载此图像。尝试运行时会出现问题:
[Pipeline] withDockerContainer
swarm-sjc01-0270eda05830-0.0.0.0 seems to be running inside container 0270eda05830a074668a5864c52d153377eb67b6406e3912b99f79686cfaca1c
but /home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ could not be found among []
but /home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ@tmp could not be found among []
$ docker run -t -d -u 1000:1000 -w /home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ -v /home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ:/home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ:rw -v /home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ@tmp:/home/jenkins/workspace/app_PR-6011-N3O6YOXQAC4KEFHSOKKCS7CFV3GUTIIJAVHDJCR5T7LMXUPU3SLQ@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat icm-docker-local.artifactory.swg-devops.com/app-chromium:latest
ERROR: Timeout after 10 seconds
[Pipeline] // withDockerContainer
有人理解为什么会超时吗?如果我提供一个dockerfile(agent {dockerfile:true}),它就可以正常构建。并不是说这不是像管道语法这样的脚本,而是更新的声明性格式。