jenkins-artifactory-plugin icon indicating copy to clipboard operation
jenkins-artifactory-plugin copied to clipboard

Grade 7 allowInsecureProtocol support

Open waileong opened this issue 3 years ago • 4 comments

Describe the bug

Unable to run gradle 7 artifactoryPublish on "http://" artifactory, with jenkins "Gradle-Artifactory Integration",

Environment:

  1. Artifactory server with HTTP access
  2. Jenkins "Gradle-Artifactory Integration"
  3. Gradle version 7
  4. 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

waileong avatar Jun 04 '21 06:06 waileong

Still happening with:

  • Jenkins Artifactory plugin version: 3.13.1
  • Artifactory Version: 4.24.18
  • Gradle: 7.0.1

checoalejandro avatar Sep 21 '21 16:09 checoalejandro

  1. Removing resolve block in artifactoryPublish
  2. Adding allowInsecureProtocol at repositories level
repositories {
		mavenCentral()
	
	maven {
		url "http://localhost:8081/artifactory/gradle"
		allowInsecureProtocol true
		credentials {
			username = "admin"
			password = "AKCp8k8srBKD68ULhBq8XNfZvZ8zYZH7HCFyF4PELkyt3KBjFyQPJTQdfGQU3ETagJU2g8QPa"
		}
	}

}

senthilsivanath avatar Dec 01 '21 05:12 senthilsivanath

  1. Removing resolve block in artifactoryPublish

    1. 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.

ravihara avatar May 25 '22 11:05 ravihara

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.

striker551 avatar Jun 22 '23 21:06 striker551