简体   繁体   English

在Docker中安装Jenkins插件(Mercurial)显示在plugins文件夹中,而不显示在Jenkins本身中

[英]Installing Jenkins plugin (mercurial) in Docker shows in plugins folder but not in Jenkins itself

Problem: I can't seem to successfully install the mercurial plugin to jenkins using the Dockerfile and plugins.txt combination. 问题:我似乎无法使用Dockerfile和plugins.txt组合成功将Mercurial插件安装到jenkins。

What I've done so far: 到目前为止,我所做的是:

I have a Dockerfile that's loading Jenkins. 我有一个正在加载Jenkins的Dockerfile。 It has the following lines: 它包含以下几行:

FROM jenkins:1.642.1
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt

My plugins.txt has this line: 我的plugins.txt具有以下行:

mercurial:1.54

When I build the image and run the container, everything seems to work, there are no errors or complaints. 当我构建映像并运行容器时,一切似乎都可以正常工作,没有任何错误或抱怨。 But the Mercurial plugin isn't marked as installed when I go to Manage Plugins, and if I try to make a build, Mercurial isn't an option under Source Code Management. 但是当我转到“管理插件”时,Mercurial插件未标记为已安装,并且如果我尝试进行构建,则在源代码管理下,Mercurial不是一个选项。

Jenkins插件管理器

Jenkins中的源代码管理选项

I've tried going to: 我尝试去:

<jenkins ip address>:8080/reload

As well as the "Reload Configuration from Disk" option in Manage Jenkins. 以及Manage Jenkins中的“从磁盘重新加载配置”选项。 Mercurial still isn't visibly installed after either of these. 在这两个之后,Mercurial仍未明显安装。

I've also done this on the command line: 我也在命令行上完成了此操作:

docker exec -i -t container bash
ls /var/jenkins_home/plugins/

ls插件的输出

And at this point I'm totally confused, because there's mercurial, mercurial.jpi and mercurial.jpi.pinned right there in the list. 在这一点上,我完全感到困惑,因为列表中就在那里固定了mercurial,mercurial.jpi和mercurial.jpi.pin。 Does anyone have any ideas on this? 有人对此有任何想法吗? I would like to have Mercurial installed on Jenkins as soon as it's loaded from the Dockerfile without having to do it manually... 我想从Dockerfile加载Mercurial后立即将其安装在Jenkins上,而无需手动进行...

Also, I tried doing this with git-changelog as well to see if another plugin would work better, and had the same result. 另外,我也尝试使用git-changelog进行此操作,以查看另一个插件是否可以更好地工作,并获得相同的结果。

As you can see on the Mercurial Plugin wiki page , the plugin currently has four mandatory dependencies, and one optional: 如您在Mercurial插件Wiki页面上所见,该插件当前具有四个强制性依赖项,以及一个可选的依赖项:

  • credentials 证书
  • matrix-project 矩阵项目
  • multiple-scms (optional) 多个SMS(可选)
  • ssh-credentials SSH-凭证
  • scm-api SCM-API

The plugin installation mechanism that you're using with the Jenkins Docker image does not automatically install dependent plugins for you, as mentioned in the documentation for the jenkins image : 您在Jenkins Docker映像中使用的插件安装机制不会自动为您安装相关的插件,如jenkins映像的文档中所述:

All plugins need to be listed as there is no transitive dependency resolution. 由于没有传递依赖项解析,因此需要列出所有插件。

Therefore you need to additionally list those plugins, and any of their transitive dependencies, in your plugins.txt file. 因此,您需要在plugins.txt文件中另外列出这些插件及其传递依赖项。

At the moment, the simplest way to get the full list would be to start your container (potentially without plugins.txt ), and then install the Mercurial plugin via the Plugin Manager, which will be installed along with all of its dependencies. 目前,获取完整列表的最简单方法是启动容器(可能没有plugins.txt ),然后通过插件管理器安装Mercurial插件,该插件将连同其所有依赖项一起安装。 Then you can see a list of which plugins are required via $JENKINS_HOME/plugins . 然后,您可以通过$JENKINS_HOME/plugins查看所需的插件列表。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM