nev*_*ves 5 static-analysis lint shared-libraries jenkins jenkins-pipeline
I'm coding Jenkins pipelines but my development process is extremely inefficient. For each modification, I must commit and push my code, and manually run the pipeline. A simple typo makes me do it all again. My version control log is a mess.
I'm trying to use the Pipeline Linter, but it fails since it doesn't recognize the Shared Libraries that I'm using.
Here is a simplified version of my code that I'll try to lint. This code works when I run it from the interface:
//importing class MyClass defined in src/com/company/MyClass.groovy
import com.company.MyClass.*
//importing src/com/company/helper/Log.groovy
import com.company.helper.Log;
def call(String env) {
def mud
pipeline {
agent none
stages{
stage('Checkout') {
agent any
steps {
mud = new MyClass(script: this)
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
I run the pipeline linter with this command:
ssh -p 8222 jenkins declarative-linter < myPipeline.groovy
Run Code Online (Sandbox Code Playgroud)
And, although it works fine when I run the pipeline in Jenkins, I get the following lint validation error:
Errors encountered validating Jenkinsfile:
WorkflowScript: 2: unable to resolve class com.company.helper.Log
@ line 2, column 1.
import com.company.helper.Log;
^
WorkflowScript: 25: unable to resolve class MyClass
@ line 25, column 35.
mud = new MyClass(script: this)
Run Code Online (Sandbox Code Playgroud)
How do I use the pipeline linter with shared libraries?
I also welcome any help to streamline my development process!
答案是无法检查,Jenkins pipeline 开发人员注定会拥有一个非常低效的开发流程。
我刚刚发现Jenkins bug 数据库中有一个与此相关的问题。我尝试了一些解决方案,但没有任何效果。
我仍然想要有关如何有效编码 Jenkins 管道的任何提示。
| 归档时间: |
|
| 查看次数: |
828 次 |
| 最近记录: |