Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The configuration httpHeaders in pom server settings is not working #830

Open
SGmuwa opened this issue May 17, 2024 · 1 comment
Open

The configuration httpHeaders in pom server settings is not working #830

SGmuwa opened this issue May 17, 2024 · 1 comment

Comments

@SGmuwa
Copy link

SGmuwa commented May 17, 2024

I have a project in gitlab, and for deploy to a gitlab maven registry, I need to set the custom http header in maven settings file (so-called ci_settings.xml):

<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>gitlab-maven</id>
            <configuration>
                <httpHeaders>
                    <property>
                        <name>Job-Token</name>
                        <value>${env.CI_JOB_TOKEN}</value>
                    </property>
                </httpHeaders>
            </configuration>
        </server>
    </servers>
</settings>

But when I try to deploy to the gitlab maven registry, I got a error 401 and I got a nothing for dependencies (404?). I tried open netcat server nc -l 7777 to see requests and I got this ❌ (fail):

GET /api/v4/projects/123/packages/maven/my/example/group/my-example-connector/1.0.0/my-example-connector-1.0.0.pom HTTP/1.1
Cache-Control: no-cache, no-store
Pragma: no-cache
Host: localhost:7777
Connection: Keep-Alive
User-Agent: Apache-Maven/3.8.6 (Java 11.0.16; Linux 6.5.0-28-generic)
Accept-Encoding: gzip,deflate

When I use 3.8.2, I got this ✅ (ok):

GET /api/v4/projects/123/packages/maven/my/example/group/my-example-connector/1.0.0/my-example-connector-1.0.0.pom HTTP/1.1
Cache-control: no-cache
Pragma: no-cache
Job-Token: ${env.CI_JOB_TOKEN}
Host: localhost:7777
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.16)
Accept-Encoding: gzip,deflate

For tests this issue, I manipulate this part of my pom.xml:

<properties>
    <app.runtime>4.4.0</app.runtime>
    <mule.maven.plugin.version>4.1.0</mule.maven.plugin.version>
</properties>
result mule.maven.plugin.version app.runtime
❌ FAIL 3.0.0 4.4.0
❌ FAIL 3.0.1 4.4.0
❌ FAIL 3.3.4 4.4.0
❌ FAIL 3.4.2 4.4.0
✅ OK 3.5.1 4.0.0, 4.4.0
✅ OK 3.5.3 4.4.0
✅ OK 3.6.3 4.4.0
✅ OK 3.7.3 4.4.0
✅ OK 3.8.0 4.4.0
✅ OK 3.8.2 4.4.0, 4.6.0
✅ OK 3.8.7 4.4.0, 4.6.0
❌ FAIL 4.0.0 4.4.0, 4.6.0
❌ FAIL 4.1.0 4.4.0, 4.6.0
❌ FAIL 4.1.2 4.4.0, 4.6.0

I did not check the build result to see if it actually runs on mule-runtime. I only checked whether the header was inserted or not.

When I disable the plugin, the dependencies are downloaded, but then there are difficulties with placing the jar in the gitlab maven registry. I have to use maven low level or even use curl.

Does anyone know

  1. If mule-maven-plugin actually affects the maven settings file? Or is it some property or some dependency that does this?
  2. Have I specified the http header settings correctly?
  3. Is there any plan to support custom http headers?
@SGmuwa SGmuwa changed the title The configuration httpHeaders in pom server setting is not working The configuration httpHeaders in pom server settings is not working May 17, 2024
@SGmuwa
Copy link
Author

SGmuwa commented May 21, 2024

This issue is also discussed on gitlab: https://gitlab.com/gitlab-org/gitlab/-/issues/222365#note_1914375625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant