简体   繁体   English

Jenkins 多分支管道卡在旧的 Jenkinsfile 上

[英]Jenkins multi-branch pipeling stuck on an old Jenkinsfile

I am practicing a CI workflow using cowsay as an app with a local git repository.我正在使用 cowsay 作为具有本地 git 存储库的应用程序来练习 CI 工作流程。 I have a docker-compose that builds three docker containers: a Jenkins, a gitLab and an Artifactory.我有一个 docker-compose,它构建了三个 docker 容器:一个 Jenkins、一个 Z37F6651DB68B605B074594D51ZDC。 all three use a named volume to store consistent data.这三个都使用命名卷来存储一致的数据。 I am running a multi-branch pipeline based on a Jenkinsfile (declarative) and a webhook for push events.我正在运行基于 Jenkinsfile(声明性)和用于推送事件的 webhook 的多分支管道。 So far so good.到目前为止,一切都很好。 BUT - Jenkins is STUCK on an old version of Jenkinsfile.但是 - Jenkins 卡在旧版本的 Jenkinsfile 上。 Solutions I tried:我尝试过的解决方案:

  1. I manually emptied jenkins-home from all versions of Jenkinsfile I could find (I looked in ~/jobs/<job_name> and in ~/caches )我从我能找到的所有版本的 Jenkinsfile 中手动清空了 jenkins-home(我查看了 ~/jobs/<job_name> 和 ~/caches )
  2. I deleted Jenkins entirely and re-built the image, including a volume prune.我完全删除了 Jenkins 并重新构建了映像,包括卷修剪。
  3. I migrated files manually into a new repository我手动将文件迁移到新的存储库中
  4. I used "git filter-branch" to delete all version of Jenkinsfile from all branches and commits.我使用“git filter-branch”从所有分支和提交中删除所有版本的 Jenkinsfile。
  5. I manually rewrote (not copy-paste) the Jenkinsfile我手动重写(不是复制粘贴)Jenkinsfile
  6. I event went as desprate as to clean my entire browser cache for no reason.我的事件就像无缘无故清理我的整个浏览器缓存一样绝望。

Jenknis refuses to re-cache and in some bizzare way keeps running this line: "docker build -t cowsay/master." Jenknis 拒绝重新缓存并以某种奇怪的方式继续运行此行:“docker build -t cowsay/master”。 which is non-existant in the Jenkinsfile.这在 Jenkinsfile 中不存在。

I can't find any more caches to clean other than.我找不到更多要清理的缓存。 Help?帮助?

EDIT: I am not running any commands.编辑:我没有运行任何命令。 This is configured so the Jenkins job runs upon a 'git push' to any branch.这是这样配置的,因此 Jenkins 作业在“git push”到任何分支时运行。 The error I am seeing is this line: +docker build -t 'cowsay'.我看到的错误是这一行:+docker build -t 'cowsay'。 It's a line that used to be in the Jenkinsfile in one of the stages, but isn't for at least the last 5 commits/pushes.这是曾经在某个阶段的 Jenkinsfile 中的一行,但至少在最后 5 次提交/推送中不是。 This line causes an error that fails the job.此行会导致作业失败的错误。

I have never experienced this failure myself but here a couple of things I would try to debug what's wrong:我自己从未经历过这种失败,但这里有几件事我会尝试调试问题所在:

  1. I would first ensure that the is configured to use a Jenkinsfile from git, and not a static script.我将首先确保将其配置为使用 git 中的 Jenkinsfile,而不是 static 脚本。 To do that, go to your multibranch pipeline, click "Configure", and in the "Build Configuration" block it should say that the mode is "by Jenkinsfile" and the path is the relative path of your Jenkinsfile in the repo.为此,将 go 连接到您的多分支管道,单击“配置”,在“构建配置”块中,它应该说模式是“由 Jenkinsfile”,并且路径是您的 Jenkinsfile 在 repo 中的相对路径。 If you go to the per branch build jobs, and you click on "View Configuration", you should see that their pipeline definition is "Pipeline from multibranch configuration".如果您 go 到每个分支构建作业,然后单击“查看配置”,您应该看到他们的管道定义是“来自多分支配置的管道”。
  2. I would verify that the issue you're seeing has to do with Jenkinsfile caching and not with one of your scripts running a command you didn't expect (eg if you run a shell script or a make file, they might be calling the command that's failing).我会验证您看到的问题与 Jenkinsfile 缓存有关,而不是与您的脚本之一运行您没想到的命令有关(例如,如果您运行 shell 脚本或 make 文件,他们可能正在调用命令那是失败的)。 To do that, I'd add an echo at the top of the Jenkinsfile, build the job and see if the echo is in the job output.为此,我将在 Jenkinsfile 的顶部添加一个回显,构建作业并查看回显是否在作业 output 中。 If it is, you're getting latest from Jenkins and something else is calling that command you removed from your Jenkinsfile.如果是这样,您将从 Jenkins 获取最新信息,并且其他东西正在调用您从 Jenkinsfile 中删除的命令。
  3. If you don't see the echo command mentioned in step 2 you are definitely not getting latest.如果您没有看到步骤 2 中提到的 echo 命令,那么您肯定不是最新的。 You mentioned you use a local git repo.您提到您使用本地 git 存储库。 How did you configure the git scm?您是如何配置 git 单片机的? Is it possible that jenkins is waiting for push notifications from a remote server that you're not pushing your local changes to? jenkins 是否有可能正在等待来自远程服务器的推送通知,而您没有将本地更改推送到? If you're seeing builds getting automatically triggers on every commit you make, that would probably eliminate this case.如果您看到构建在每次提交时都会自动触发,那可能会消除这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用多分支管道 Jenkins 时? - When using multi-branch pipline Jenkins? Jenkins多分支管道不修剪从远程删除的分支 - Jenkins Multi-Branch Pipeline Not Pruning Branches Deleted from Remote 如何使用Jenkins DSL插件创建多分支项目? - How to create multi-branch project with Jenkins DSL plugin? 如何使用 Gitlab Webhook 触发 Jenkins 多分支流水线 - How to trigger Jenkins Multi-Branch Pipeline with Gitlab Webhook git多分支差异? - Multi-branch diff with git? GitSCMExtension 或 GitSCM 分支源配置以获取 Jenkins 多分支管道中的所有/一些其他远程分支 - GitSCMExtension or GitSCM branch source configuration to fetch all/some additional remote branches in Jenkins multi-branch pipeline “java.lang.Exception: None or multiple repos”与 Jenkins 多分支管道中的 BitBucket Notifier - "java.lang.Exception: None or multiple repos" with BitBucket Notifier in Jenkins multi-branch pipeline 如何格式化多分支项目中的代码? - How can I format the code in a multi-branch project? 在 Jenkins Pipeline/Jenkinsfile 中获取 git 分支名称 - Get git branch name in Jenkins Pipeline/Jenkinsfile 找到“Jenkinsfile”,符合条件,没有为 jenkins 触发自动构建,对于 git 分支 - ‘Jenkinsfile’ found, Met criteria, No automatic build triggered for jenkins, for git branch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM