[Jenkins] CI报错及解决方案汇总
1
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 24: unexpected char: '\' @ line 24, column 51.
-e /usr1/build/output \
最后的“\”原本表示换行,但现在被认为是错误。经测试,最好去掉所有反斜杠换行符。
2
Still waiting to schedule task
‘Jenkins’ doesn’t have label ‘ci_agt’
检查label是否一致。
3
+ git clone https://gitee.com/openeuler/embedded-ci.git -v /home/jenkins/agent/embedded-ci --depth=1
Cloning into '/home/jenkins/agent/embedded-ci'...
fatal: unable to access 'https://gitee.com/openeuler/embedded-ci.git/': Could not resolve host: gitee.com
Jenkins需要安装Gitee 插件。
4
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: e498480d-51b9-4db5-bb0e-af9e3c413e48
groovy.lang.MissingPropertyException: No such property: USERNAME for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
需要安装groovy postbuild插件。
5
There were errors checking the update sites: UnknownHostException: updates.jenkins.io
参考:https://www.cnblogs.com/yunzimo/p/15003154.html
换源:
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json
6
+ python3 main.py ci -e /usr1/build/output ' ' $'//\345\241\253\345\206\231\344\275\240\346'
main.py ci: error: unrecognized arguments: //����������������
pipeline scripts 中的注释被识别了,去掉注释即可。
pipeline script 示例
带注释的pipeline script(主要是看注释、了解作用,不建议直接使用):
pipeline {
agent { node "dockercloud" } //这里的dockercloud即之前在 Docker Agent templates 中配置的Labels值
environment {
PATH = "/home/jenkins/.local/bin:${env.PATH}"
}
stages {
stage('clone openeuler-ci') {
steps {
dir('/home/jenkins/agent'){
script {
if(fileExists('embedded-ci') == false) {
sh 'git clone https://gitee.com/openeuler/embedded-ci.git -v /home/jenkins/agent/embedded-ci --depth=1'
}
}
}
}
}
stage('run ci') {
steps {
dir('/home/jenkins/agent/embedded-ci'){
script{
withCredentials([usernamePassword(credentialsId: 'test_credentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
sh """python3 main.py ci \
-e /path \ //填写你想存储构建产物的路径
-i "101.1.10.101" \ //填写你想存储构建产物的机器的ip地址
-u $USERNAME \ //登录构建产物存储的机器时,使用的用户名
-w $PASSWORD \ //登录构建产物存储的机器时,使用的密码
-dm \ //删除构建的tmp目录,该选项,默认为真,因为tmp目录使用较大空间,所以默认会删除tmp目录
-o openeuler \ //此参数当前无用,保留即可
-p yocto-meta-openeuler //此参数当前无用,保留即可
"""
}
}
}
}
}
}
}
经测试可用的pipeline script(去掉了注释和行末的反斜杠):
pipeline {
agent { node "ci_agt" }
environment {
PATH = "/home/jenkins/.local/bin:${env.PATH}"
}
stages {
stage('clone openeuler-ci') {
steps {
dir('/home/jenkins/agent'){
script {
if(fileExists('embedded-ci') == false) {
sh 'git clone https://gitee.com/openeuler/embedded-ci.git -v /home/jenkins/agent/embedded-ci --depth=1'
}
}
}
}
}
stage('run ci') {
steps {
dir('/home/jenkins/agent/embedded-ci'){
script{
withCredentials([usernamePassword(credentialsId: 'test_credentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
sh """python3 main.py ci
-e /usr1/build/output
-i "127.0.0.1"
-u $USERNAME
-w $PASSWORD
-dm
-o openeuler
-p yocto-meta-openeuler
"""
}
}
}
}
}
}
}
标签:CI,Embedded,embedded,ci,agent,报错,home,jenkins,openeuler
From: https://www.cnblogs.com/EndPoem-ZH/p/17803598.html