首页 > 解决方案 > 在 docker 容器中安装 gerrit 插件

问题描述

运行gerritcodereview/gerritdocker 容器时。Gerrit 安装在/var/gerrit容器的目录中。但是当尝试通过从https://gerrit-ci.gerritforge.com/job/plugin-its-jira-bazel-stable-2.16/docker cp下载的插件 .jar 文件安装插件到目录中时,插件没有显示在已安装插件的列表中。即使我重新启动了容器。/var/gerrit/plugins

我用 gerrit 运行:

docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit

Gerrit 可通过以下方式访问: http://localhost:8080/admin/plugins

我在插件管理器中也有一个插件列表,但不知道如何将更多插件添加到列表中,曾尝试在 [httpd] 中使用 gerrit-ci.gerritforge.com url。http://localhost:8080/plugins/plugin-manager/static/index.html

我的gerrit.config文件如下所示:

[gerrit]
        basePath = git
        serverId = 62b710a2-3947-4e96-a196-6b3fb1f6bc2c
        canonicalWebUrl = http://10033a3fe5b7
[database]
        type = h2
        database = db/ReviewDB
[index]
        type = LUCENE
[auth]
        type = DEVELOPMENT_BECOME_ANY_ACCOUNT
[sendemail]
        smtpServer = localhost
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8080/
        filterClass = com.googlesource.gerrit.plugins.ootb.FirstTimeRedirect
        firstTimeRedirectUrl = /login/%23%2F?account_id=1000000
[cache]
        directory = cache
[plugins]
        allowRemoteAdmin = true
[container]
        javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        user = gerrit
        javaHome = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre
        javaOptions = -Djava.security.egd=file:/dev/./urandom
[receive]
        enableSignedPush = false
[noteDb "changes"]
        autoMigrate = true

标签: dockergerrit

解决方案


终于在我的用例中找到了一种适合我的方法。

  1. 复制您的公钥内容并插入 ssh Web 浏览器配置文件设置:my_gerrit_admin_username
  2. 将密钥添加到 ssh-agent:
eval `ssh-agent`
ssh-add .ssh/id_rsa
  1. 从容器外的终端运行:
ssh -p 29418 my_gerrit_admin_username@localhost gerrit plugin install -n its-base.jar https://gerrit-ci.gerritforge.com/job/plugin-its-base-bazel-stable-2.16/lastSuccessfulBuild/artifact/bazel-bin/plugins/its-base/its-base.jar
  1. 检查网络浏览器插件中是否安装了插件。

推荐阅读