以下是声明性管道的示例,其中代理程序是为管道设置的,但未在各个阶段中设置:
pipeline {
agent { node { label 'linux' } }
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build') {
steps {
sh 'make'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我发现有关脚本化管道的文档清楚地表明,单个工作空间将在单个节点块中使用,但多个节点块可能被分配多个工作空间,因此必须在这些步骤之间存储,使用外部工作空间插件等如果你想确定步骤之间工作区中的内容.
我很难找到有关声明性管道的工作空间保证的文档.这个例子对于工作空间有什么保证?
我相信在测试类似管道的过程中,我遇到了在不同工作空间中执行的两个阶段,但我不确定发生了什么.我真的希望避免在构建步骤之前隐藏我的结帐或使用外部工作区插件,所以我希望有办法强制我的所有阶段在一个工作区/一个节点上运行.
When I am building a declarative Jenkins pipeline for my python project, I get the following error message when using Pip.
WARNING: The directory '/.cache/pip' or its parent directory is not owned or is not writable by the current user.
Run Code Online (Sandbox Code Playgroud)
My Jenkinsfile:
#!groovy
pipeline {
agent {
docker {
image 'python:3.7.5'
}
}
stages {
stage('Build Dependencies') {
steps {
sh "pip install -r requirements.txt"
}
}
}
post {
always {
sh "Job finished"
}
}
}
Run Code Online (Sandbox Code Playgroud)
How …