PackProtocolException: invalid advertisement when using the jgitflow-maven-plugin withing a jenkins job

485 views Asked by At

I am using the following jgitflow-maven-plugin(created and no longer maintained) by the Atlassian team. Whenever I try to execute a release-start from within a Jenkins job I get the following error:

Caused by: org.eclipse.jgit.errors.PackProtocolException: invalid advertisement of <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The plugin is imported like this:

<plugin>
    <groupId>external.atlassian.jgitflow</groupId>
    <artifactId>jgitflow-maven-plugin</artifactId>
    <version>1.0-m5.1</version>
</plugin>

It is configured in the pom.xml as follows:

  1. SCM config
<scm>
    <url>https://myOwnRepo.com/test</url>
    <connection>scm:git:https://myOwnRepo.com/test.git</connection>
    <developerConnection>scm:git:https://myOwnRepo.com/test.git</developerConnection>
    <tag>HEAD</tag>
</scm>
  1. Plugin configuration
<configuration>
    <flowInitContext>
        <masterBranchName>master</masterBranchName>
        <developBranchName>dev</developBranchName>
        <versionTagPrefix>v</versionTagPrefix>
    </flowInitContext>

    <pushFeatures>true</pushFeatures>
    <pushHotfixes>true</pushHotfixes>

    <username>myRepoUser</username>
    <password>myRepoPassword</password>

    <allowUntracked>true</allowUntracked>
</configuration>
  1. Other configurations
<executions>
    <execution>
        <id>release</id>

        <goals>
            <goal>release-start</goal>
            <goal>release-finish</goal>
        </goals>

        <configuration>
            <scmCommentPrefix>[RELEASE]</scmCommentPrefix>
        </configuration>
    </execution>

    <execution>
        <id>feature</id>

        <goals>
            <goal>feature-start</goal>
            <goal>feature-finish</goal>
        </goals>

        <configuration>
            <allowSnapshots>true</allowSnapshots>
            <scmCommentPrefix>[FEATURE]</scmCommentPrefix>
        </configuration>

    </execution>

    <execution>
        <id>hotfix</id>

        <goals>
            <goal>hotfix-start</goal>
            <goal>hotfix-finish</goal>
        </goals>

        <configuration>
            <scmCommentPrefix>[HOTFIX]</scmCommentPrefix>
        </configuration>

    </execution>
</executions>

I have also tried changing the version of the following dependencies:

<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>

<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.sshagent</artifactId>

<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.jsch</artifactId>

<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.usocket-jna</artifactId>

The project is behind a proxy that is set using line arguments. It is cloned using https as per the scm configs. Also, in order to connect, it uses a token and not the password.

On my local machine, everything seems to be working and the only difference against the Jenkins job seems to be the proxy which is used.

1

There are 1 answers

0
LoolKovsky On BEST ANSWER

Apparently, the problem that was causing the wrong behavior of the jenkins job was the proxy(as expected).

The Jenkins instance was running behind a proxy. Whenever the maven-jgitflow-plugin was trying to reach the git repo, it would get a 403 page as a response from the repo.

After changing the proxy configs the error disappeared and the plugin worked.