docker 容器内带有 writeFile 的 Jenkinsfile?
Jenkinsfile with writeFile inside docker container?
如果我有一个 Jenkinsfile
docker.image('foo').inside {
writeFile file: bar, text: baz
}
文件被写入 Jenkins 代理的工作区,而不是容器内,对吧?有没有一种明智的方法可以在容器中写入文件?
我在网上找到的最接近的东西是 https://issues.jenkins-ci.org/browse/JENKINS-33510。我想我可以对 here-doc 使用 sh
步骤,但这听起来很难看。
容器中有一个工作区,您可以使用writeFiles
在容器中写入文件。
但它也与主机节点的工作区共享,因为它是作为卷安装的。
inside
will:
- Automatically grab a slave and a workspace (no extra node block is
required).
- Pull the requested image to the Docker server (if not already cached).
- Start a container running that image.
- Mount the Jenkins workspace as a “volume” inside the container, using
the same file path.
您可以在此处查看 inside
中发生的更多详细信息:https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/chapter-docker-workflow.html
如果我有一个 Jenkinsfile
docker.image('foo').inside {
writeFile file: bar, text: baz
}
文件被写入 Jenkins 代理的工作区,而不是容器内,对吧?有没有一种明智的方法可以在容器中写入文件?
我在网上找到的最接近的东西是 https://issues.jenkins-ci.org/browse/JENKINS-33510。我想我可以对 here-doc 使用 sh
步骤,但这听起来很难看。
容器中有一个工作区,您可以使用writeFiles
在容器中写入文件。
但它也与主机节点的工作区共享,因为它是作为卷安装的。
inside
will:
- Automatically grab a slave and a workspace (no extra node block is required).
- Pull the requested image to the Docker server (if not already cached).
- Start a container running that image.
- Mount the Jenkins workspace as a “volume” inside the container, using the same file path.
您可以在此处查看 inside
中发生的更多详细信息:https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/chapter-docker-workflow.html