-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Our organization has moved our artifact repository to a system that uses custom headers authentication. These headers are currently not picked up and sent to the transport layer/Wagon. Our CI system is failing on Gradle builds because I cannot properly authenticate artifact repository to get dependencies.
Developer's settings.xml look like this, utilizing a private token:
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>Secret</value>
</property>
</httpHeaders>
</configuration>
</server>
Our CI settings.xml looks like this, allowing to token to rotate per job:
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
A workaround we've been trying in the build.gradle file has the potential but occasionally doesn't play nice with our IDEs
maven {
name = "gitlab-maven"
url = uri("https://gitlab.com/api/v4/projects/14262838/packages/maven")
val credentialProperties = listOf(
EnvProperty("CI_JOB_TOKEN", "Job-Token"),
EnvProperty("GITLAB_PRIVATE_TOKEN", "Private-Token")
)
val credential = credentialProperties.mapNotNull(EnvProperty::asCredential).firstOrNull() ?: throw RuntimeException("Gitlab credentials not found")
credentials(HttpHeaderCredentials::class) {
name = credential.name
value = credential.value
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
I will attempt to work on a pull request for this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels