Jira plugin + gerrit in docker problem

183 views
Skip to first unread message

Paweł Malczuk

unread,
Nov 28, 2019, 9:16:25 AM11/28/19
to Repo and Gerrit Discussion
Hello,

I try to integrate gerrit with jira 8.5.1 hosted on premise, so I configured gerrit 2.16.13 in container from docker-hub https://hub.docker.com/layers/gerritcodereview/gerrit/2.16.13-centos7/images/sha256-515ad9ca8adb3846c5493d3533e315ec45af6577a985c5728d29e772ab8ec54e and downloaded plugins its-jira and its-base from https://gerrit-ci.gerritforge.com/view/Plugins-stable-2.16/

I run container from docker-compose.yaml:
cat docker-compose.yaml
version: '3'

services:
  gerrit:
    image: hub.docker.xxxxx/gerritcodereview/gerrit:2.16.13-centos7
    ports:
      - "29418:29418"
      - "80:8080"
    volumes:
      - /var/volumes/gerritold/etc:/var/gerrit/etc
      - /var/volumes/gerritold/git:/var/gerrit/git
      - /var/volumes/gerritold/db:/var/gerrit/db
      - /var/volumes/gerritold/index:/var/gerrit/index
      - /var/volumes/gerritold/cache:/var/gerrit/cache
      - /var/volumes/gerritold/plugins:/var/gerrit/plugins
    environment:
      - CANONICAL_WEB_URL=http://xxx
    #command: >
      # bash -c "java -jar /var/gerrit/bin/gerrit.war init --batch --install-all-plugins -d /var/gerrit
              #  java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit"
              #  git config -f /var/gerrit/etc/gerrit.config --add container.javaOptions "-Djava.security.egd=file:/dev/./urandom""


etc/gerrit.config:
[gerrit]
        basePath = git
        serverId = e214c886-7004-489e-b6cc-ed9e0ad5f1b7
        canonicalWebUrl = http://XXXXXXXXXX
[database]
        type = h2
        database = /var/gerrit/db/ReviewDB
[container]
        javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        javaOptions = -Dlog4j.configuration=file:///var/gerrit/etc/log4j.properties
        user = gerrit
        javaHome = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre
        javaOptions = -Djava.security.egd=file:/dev/./urandom
[index]
        type = LUCENE
[auth]
        type = DEVELOPMENT_BECOME_ANY_ACCOUNT
[receive]
        enableSignedPush = false
[sendemail]
        smtpServer = localhost
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8080/
[cache]
        directory = cache
[noteDb "changes"]
        autoMigrate = true
[its-jira]
        url = http://dev-jira
        username = gerrit
        commentOnChangeAbandoned = true
        commentOnChangeCreated = true
        commentOnChangeMerged = true
        commentOnChangeRestored = true
        commentOnCommentAdded = false
        commentOnFirstLinkedPatchSetCreated = true
        commentOnPatchSetCreated = true
        commentOnRefUpdatedGitWeb = true
[commentlink "its-jira"]
        match = ([A-Z]*-[1-9][0-9]*)
        html = <a href=\"https://dev-jira/browse/$1\">$1</a>

[plugin "its-jira"]
        association = MANDATORY


etc/secure.config:
[its-jira]
        password = ...

etc/its/action.config:
[rule "patch-set"]
        event-type = patchset-created
        action = add-comment A new patchset was added to the Gerrit change
        action = log-event
[rule "merged"]
        event-type = change-merged
        action = add-standard-comment
        action = log-event
[rule "verified_no"]
        event-type = comment-added
        approval-Verified = -1
        action = add-comment Verification by Jenkins failed
        action = log-event
[rule "verified_yes"]
        event-type = comment-added
        approval-Verified = +1
        action = add-comment Verification by Jenkins was successful
[rule "ref-updated"]
        event-type = ref-updated
        action = add-standard-comment

For debugging I added log4j config to gerrit.config
[container]
        javaOptions = -Dlog4j.configuration=file:///var/gerrit/etc/log4j.properties

etc/log4j.properties:
log4j.rootCategory=DEBUG, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/var/gerrit/etc/logs/my.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

log4j.appender.stderr=org.apache.log4j.ConsoleAppender
log4j.appender.stderr.target=System.err
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
log4j.appender.stderr.layout.ConversionPattern=[%d] %-5p %c %x: %m%n

log4j.logger.com.google.gerrit=DEBUG
# Silence non-critical messages from MINA SSHD.
#
log4j.logger.org.apache.mina=DEBUG
log4j.logger.org.apache.sshd.common=DEBUG
log4j.logger.org.apache.sshd.server=DEBUG
log4j.logger.org.apache.sshd.common.keyprovider.FileKeyPairProvider=INFO
log4j.logger.com.google.gerrit.sshd.GerritServerSession=DEBUG


# Silence non-critical messages from Jetty.
#
log4j.logger.org.eclipse.jetty=INFO

# Silence non-critical messages from mime-util.
#
log4j.logger.eu.medsea.mimeutil=WARN

# Silence non-critical messages from openid4java
#
log4j.logger.org.apache.http=DEBUG

log4j.logger.org.apache.xml=WARN
log4j.logger.org.openid4java=WARN
log4j.logger.org.openid4java.consumer.ConsumerManager=FATAL
log4j.logger.org.openid4java.discovery.Discovery=ERROR
log4j.logger.org.openid4java.server.RealmVerifier=ERROR
log4j.logger.org.openid4java.message.AuthSuccess=ERROR

# Silence non-critical messages from c3p0 (if used).
#
log4j.logger.com.mchange.v2.c3p0=WARN
log4j.logger.com.mchange.v2.resourcepool=WARN
log4j.logger.com.mchange.v2.sql=WARN

# Silence non-critical messages from Velocity
#
log4j.logger.velocity=WARN

# Silence non-critical messages from apache.http
log4j.logger.org.apache.http=DEBUG
# ITS-Base debug
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.InitIts=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.InvalidTransitionException=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.ItsConfig=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.ItsFacade=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.ItsHookEnabledConfigEntry=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.its.NoopItsFacade=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.ItsHookModule=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.util.CommitMessageFetcher=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.util.IssueExtractor=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.util.PropertyAttributeExtractor=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.util.PropertyExtractor=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.validation.ItsAssociationPolicy=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.validation.ItsValidateComment=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.action.Action=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.action.AddComment=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.action.AddStandardComment=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.action.AddVelocityComment=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.action.LogEvent=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.ActionController=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.ActionExecutor=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.ActionRequest=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.Condition=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.GerritHookFilter=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.GerritHookFilterAddComment=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.GerritHookFilterAddRelatedLinkToChangeId=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.GerritHookFilterAddRelatedLinkToGitWeb=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.GerritHookFilterChangeState=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.Property=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.Rule=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.workflow.RuleBase=DEBUG

# ITS-JIRA debug
log4j.logger.com.googlesource.gerrit.plugins.hooks.jira.InitJira=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.jira.JiraClient=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.jira.JiraItsFacade=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.jira.JiraModule=DEBUG
log4j.logger.com.googlesource.gerrit.plugins.hooks.jira.JiraSession=DEBUG

Log shows that it is connecting to JIRA correctly on startup:
019-11-28 13:06:32 INFO  JiraModule:65 - JIRA is configured as ITS
2019-11-28 13:06:44 DEBUG JiraClient:160 - Health check on sysinfo result: {"status"="ok","system"="Jira","version"="8.5.1","url"="https://dev-jira","build"="805001"}
2019-11-28 13:06:44 INFO  JiraItsStartupHealthcheck:48 - Connection to Jira (http://dev-jira/) succeeded: {"status"="ok","system"="Jira","version"="8.5.1","url"="https://dev-jira","build"="805001"}

When I submit a patch in the log I can't see any hooks to JIRA Server and nothing happend in JIRA

Debug log is attached, containing startup and one connection where I push a new change set to the server.

Anything I missed in the config or done wrong? Any help appreciated.

Thanks,
Pawel
my.log

Paweł Malczuk

unread,
Dec 4, 2019, 7:24:55 AM12/4/19
to Repo and Gerrit Discussion
Ok I forgot about enabling plugin in project.config. After this plugin started working but in docker there are still some problems with actions in jira (adding comments, transitions, etc).
Today I tried to run it from .war file and after small configuration its-jira works like a charm :)
Reply all
Reply to author
Forward
0 new messages