jenkins-artifactory-plugin
jenkins-artifactory-plugin copied to clipboard
Grade 7 allowInsecureProtocol support
Describe the bug
Unable to run gradle 7 artifactoryPublish on "http://" artifactory, with jenkins "Gradle-Artifactory Integration",
Environment:
- Artifactory server with HTTP access
- Jenkins "Gradle-Artifactory Integration"
- Gradle version 7
- Gradle task artifactoryPublish
Error:
Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'artifactory-maven-resolver(http://xxxxx:8081/artifactory/libs-release)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. ... Caused by: org.gradle.api.InvalidUserCodeException: Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'artifactory-maven-resolver(http://xxxx:8081/artifactory/libs-release)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. at org.gradle.api.internal.artifacts.repositories.DefaultUrlArtifactRepository.throwExceptionDueToInsecureProtocol(DefaultUrlArtifactRepository.java:103) at org.gradle.internal.verifier.HttpRedirectVerifierFactory.create(HttpRedirectVerifierFactory.java:55) at org.gradle.api.internal.artifacts.repositories.DefaultUrlArtifactRepository.createRedirectVerifier(DefaultUrlArtifactRepository.java:139) at org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.getTransport(DefaultMavenArtifactRepository.java:344) at org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.createResolver(DefaultMavenArtifactRepository.java:268) at org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.createRealResolver(DefaultMavenArtifactRepository.java:259) at org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.createResolver(DefaultMavenArtifactRepository.java:226)
To Reproduce Run gradle 7 artifactoryPublish with "http://" artifactory
Expected behavior Support of Gradle 7 allowInsecureProtocol
Versions
- Jenkins Artifactory plugin version: 3.11.4
- Jenkins operating system: Ubuntu
- Artifactory Version: 4.1.3
Still happening with:
- Jenkins Artifactory plugin version: 3.13.1
- Artifactory Version: 4.24.18
- Gradle: 7.0.1
- Removing resolve block in artifactoryPublish
- Adding allowInsecureProtocol at repositories level
repositories {
mavenCentral()
maven {
url "http://localhost:8081/artifactory/gradle"
allowInsecureProtocol true
credentials {
username = "admin"
password = "AKCp8k8srBKD68ULhBq8XNfZvZ8zYZH7HCFyF4PELkyt3KBjFyQPJTQdfGQU3ETagJU2g8QPa"
}
}
}
Removing resolve block in artifactoryPublish
- Adding allowInsecureProtocol at repositories level
repositories { mavenCentral() maven { url "http://localhost:8081/artifactory/gradle" allowInsecureProtocol true credentials { username = "admin" password = "AKCp8k8srBKD68ULhBq8XNfZvZ8zYZH7HCFyF4PELkyt3KBjFyQPJTQdfGQU3ETagJU2g8QPa" } } }
Yes! Removing the resolve block in artifactory block and setting allowInsecureProtocol to true seems to help. Thanks.
Even I faced this issue. But I'm not sure what is that resolve block for? It looks something like resolve { repokey "libs-release" username = "xxxx" password = "xxxx' } and when I do a gradle refresh, my context url (http://orgname:8080.artifactory) which I provide at the top of artifactory block is merged with repokey and throws the above specified error as asked in the question.
Can someone help me or make me understand the need of resolve block? If I remove resolve block do I need to replace with any alternate block/code? Any help is much appreciated.