no support NO_PROXY variable on maven
Describe the bug We have a Jenkins pipeline with a proxy defined with these environments variables. And the NO_PROXY variable with the domain name of our Artifactory server. We use jfrog-cli for the maven build but it does not work because the no proxy seems to be not used. If we disable the HTTPS_PROXY variable. It works.
To Reproduce Enable a proxy with authentication and configure jfrog like
export HTTP_PROXY="https://login:[email protected]:port"
export HTTPS_PROXY="https://login:[email protected]:port"
export NO_PROXY="artifactoryDomainName"
jfrog config add <serverIdName> --artifactory-url=https://<artifactoryName>/artifactory --user=<user_from_access_token> --access-token=<token> --enc-password
jfrog rt mvnc --server-id-resolve <serverIdName> --repo-resolve-releases maven --repo-resolve-snapshots maven
jfrog rt mvn clean install -B -Dartifactory.publish.artifacts=false
We didn't configure deploy repo for maven. Because the result will be in an docker image and only the docker image will be published.
Expected behavior If the NO_PROXY is defined. The jfrog rt mvn command access to Artifactory without the proxy configuration.
Screenshots The problem is "nonProxyHosts='null'" in the log. The SSL error is an effect and not the cause. Trace of our log :
2022-06-17 14:40:11 [main] ERROR org.apache.maven.cli.MavenCli - The project org.springframework.boot:spring-websockets:2.6.2 (/tmp/srv_jenkins/workspace/<pipelinePath>/pom.xml) has 1 error
2022-06-17 14:40:11 [main] ERROR org.apache.maven.cli.MavenCli - Non-resolvable parent POM for org.springframework.boot:spring-websockets:2.6.2: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.6.2 from/to dummy (https://<artifactoryHost>/artifactory/maven): Transfer failed for https://<artifactoryHost>/artifactory/maven/org/springframework/boot/spring-boot-starter-parent/2.6.2/spring-boot-starter-parent-2.6.2.pom ProxyInfo{host='<proxy.mydomain>', userName='null', port=<port>, type='', nonProxyHosts='null'} and 'parent.relativePath' points at no local POM @ line 10, column 13: Remote host terminated the handshake: SSL peer shut down incorrectly -> [Help 2]
Versions Test with jfrog cli 1.53.1 and 2.12.1. build-info-extractor : org/jfrog/buildinfo/build-info-extractor-maven3/2.33.0/build-info-extractor-maven3-2.33.0-uber.jar openjdk 13.0.1 maven 3.6.3 No settings.xml or maven options.
- Artifactory Version: 7.11.5
Thanks for your support
Hi,
Searching information from this problem, I found this issue #728. I'm wondering if is it not the same problem?
It seems the author write a PR but it's not merged. @Enquier Were you able to make any progress on the subject?
Hi, Anyone has news about this problem? Do you miss informations?
This issue has been fixed in JFrog-CLI v2.38. If you have any feedback, please let me know.
We tested with Jfrog-cli version 2.48.0 and the problem seems to persist.
Despite adding the NO_PROXY variable, the jfrog mvn clean install command continues to use the proxy configuration.
What do you think about this error?
Here are the test logs
$ export HTTP_PROXY=http://${PROXY_USER}:${PROXY_PWD}@${PROXY_URL}
$ export HTTPS_PROXY=http://${PROXY_USER}:${PROXY_PWD}@${PROXY_URL}
$ export NO_PROXY="artifactoryDomainName"
$ curl -sS --cacert ${CERTIFICATE} -u ${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -O "https://<artifactoryName>/artifactory/jfrog-cli-go-remote/${JFROG_VERSION}/${JFROG_OS}/jfrog"
$ chmod 755 jfrog
$ export UUID=$(cat /proc/sys/kernel/random/uuid)
$ touch uuid.txt
$ echo ${UUID} > uuid.txt
$ export JFROG_CLI_RELEASES_REPO="${UUID}/jfrogcli-maven-new-remote"
$ mkdir -p "${JFROG_CLI_HOME_DIR}security/certs/"
$ cp ${CERTIFICATE} "${JFROG_CLI_HOME_DIR}security/certs/"
$ keytool -importcert -alias artifactory -file "/certs/CERT.crt" -keystore ${JAVA_HOME}/jre/lib/security/cacerts -storepass changeit -noprompt
Certificate was added to keystore
$ mkdir -p "${PATH_M2_REPO}"
$ ./jfrog config add ${UUID} --artifactory-url=https://<artifactoryName>/artifactory --access-token=<token>
$ ./jfrog mvn-config --server-id-deploy ${UUID} --repo-deploy-snapshots testci-maven-dev --repo-deploy-releases testci-maven --server-id-resolve ${UUID} --repo-resolve-releases testci-maven --repo-resolve-snapshots testci-maven-dev
10:40:23 [Info] maven build config successfully created.
$ echo "'Version de JFROG_CLI:' ${JFROG_VERSION}"
'Version de JFROG_CLI:' v2/2.48.0
$ ./jfrog mvn clean install -B -Dartifactory.publish.artifacts=false -Dmaven.repo.local="${pwd}/${PATH_M2_REPO}"
10:40:23 [Info] Downloading JFrog's Dependency from https://<artifactoryHost>/artifactory/jfrogcli-maven-new-remote/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.41.5/build-info-extractor-maven3-2.41.5-uber.jar
10:40:24 [Info] Running Mvn...
10:40:24 [Info] Running mvn command: /usr/local/openjdk-8/bin/java -classpath /usr/share/maven/boot/plexus-classworlds-2.6.0.jar -Dmaven.home=/usr/share/maven -DbuildInfoConfig.propertiesFile=/tmp/jfrog/properties/extractorProperties2443863991 -Dm3plugin.lib=.jfrog/dependencies/maven/2.41.5 -Dclassworlds.conf=.jfrog/dependencies/maven/2.41.5/classworlds.conf -Dmaven.multiModuleProjectDirectory=/builds/usinelogicielle/private/validation/validation_ul/validation-no-proxy-maven -DbuildInfoConfig.artifactoryResolutionEnabled=true org.codehaus.plexus.classworlds.launcher.Launcher clean install -B -Dartifactory.publish.artifacts=false -Dmaven.repo.local=/.m2/repository
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Build Order:
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Simple Multi Modules Build [pom]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 1 [jar]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 2 [jar]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 3 [jar]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - jacoco_coverage [pom]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - -------------------------< multi.multi:multi >--------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building Simple Multi Modules Build 3.7-SNAPSHOT [1/5]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ pom ]---------------------------------
[main] INFO org.apache.maven.cli.transfer.Slf4jMavenTransferListener - Downloading from central: https://<artifactoryHost>/artifactory/testci-maven/org/jacoco/jacoco-maven-plugin/0.8.11/jacoco-maven-plugin-0.8.11.pom
[main] INFO org.apache.maven.cli.transfer.Slf4jMavenTransferListener - Downloading from artifactory-release: https://<artifactoryHost>/artifactory/testci-maven/org/jacoco/jacoco-maven-plugin/0.8.11/jacoco-maven-plugin-0.8.11.pom
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary for Simple Multi Modules Build 3.7-SNAPSHOT:
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Simple Multi Modules Build ......................... FAILURE [02:30 min]
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 1 ............................................ SKIPPED
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 2 ............................................ SKIPPED
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Multi 3 ............................................ SKIPPED
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - jacoco_coverage .................................... SKIPPED
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 02:30 min
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2024-03-25T10:42:56Z
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] ERROR org.apache.maven.cli.MavenCli - Plugin org.jacoco:jacoco-maven-plugin:0.8.11 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.jacoco:jacoco-maven-plugin:jar:0.8.11: Could not transfer artifact org.jacoco:jacoco-maven-plugin:pom:0.8.11 from/to central (https://<artifactoryHost>/artifactory/testci-maven): transfer failed for https://<artifactoryHost>/artifactory/testci-maven/org/jacoco/jacoco-maven-plugin/0.8.11/jacoco-maven-plugin-0.8.11.pom, status: 504 Gateway Timeout, proxy: ProxyInfo{host='****', userName='null', port=****, type='https', nonProxyHosts='null'} -> [Help 1]
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
[main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
[main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
10:42:56 [Error] exit status 1
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1
Hi @Or-Geva ,
Did you look to the log to give an explanation why the NO_PROXY work doesn't work on maven?