Create a Bazel archives tar for an airgapped environment - bazel

I created a Bazel archive tar using the steps provides in the Bazel docs. Most of the packages are being loaded locally except for this one. Please see error below.
C:\Developers\examples-master\java-tutorial>bazel build --distdir=C:\Developers\bazel-tar //:ProjectRunner Starting local Bazel server and connecting to it... INFO: Repository remotejdk11_win instantiated at: no stack (--record_rule_instantiation_callstack not enabled) Repository rule http_archive defined at: C:/users/syuopm/_bazel_syuopm/v5bxa2ms/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in WARNING: Download from https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip failed: class java.io.IOException connect timed out ERROR: An error occurred during the fetch of repository 'remotejdk11_win': java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip] to C:/users/syuopm/_bazel_syuopm/v5bxa2ms/external/remotejdk11_win/zulu11.37.17-ca-jdk11.0.6-win_x64.zip: connect timed out INFO: Repository remote_java_tools_windows instantiated at: no stack (--record_rule_instantiation_callstack not enabled) Repository rule http_archive defined at: C:/users/syuopm/_bazel_syuopm/v5bxa2ms/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in ERROR: C:/users/syuopm/_bazel_syuopm/v5bxa2ms/external/bazel_tools/tools/jdk/BUILD:492:6: #bazel_tools//tools/jdk:remote_jdk11 depends on #remotejdk11_win//:jdk in repository #remotejdk11_win which failed to fetch. no such package '#remotejdk11_win//': java.io.IOException: Error downloading [https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip] to C:/users/syuopm/_bazel_syuopm/v5bxa2ms/external/remotejdk11_win/zulu11.37.17-ca-jdk11.0.6-win_x64.zip: connect timed out ERROR: Analysis of target '//:ProjectRunner' failed; build aborted: Analysis failed INFO: Elapsed time: 68.089s INFO: 0 processes. FAILED: Build did NOT complete successfully (16 packages loaded, 305 targets configured)

It seems to be a network issue most likely due to some firewall or proxy server sitting between your computer and the Bazel repo. The following download failed:
Download from https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip failed
I suggest you download the file manually and follow the guidance here:
A work around is to fetch the files manually and put them in a directory specified via the --distdir option.

Those are mirror artifacts which are updated by the bazel team here. I think the archive URL which you mentioned above is mirrored and updated with latest files. If you see such observations may be you can raise the issues in that specific templates.

Related

bazel tell external dependency maven to use local jar

GAPID uses bazel, and has external dependency that uses maven. I get this error:
ERROR: C:/users/pemgithub/_bazel_pemgithub/3mdmxsrc/external/gapic_third_party/BUILD.bazel:19:1: no such package '#io_grpc_context//jar': Failed to fetch Maven dependency: Could not transfer artifact io.grpc:grpc-context:jar:1.16.1 from/to io_grpc_context (https://repo1.maven.org/maven2/): connect timed out and referenced by '#gapic_third_party//:grpc'
ERROR: Analysis of target '//:pkg' failed; build aborted: no such package '#io_grpc_context//jar': Failed to fetch Maven dependency: Could not transfer artifact io.grpc:grpc-context:jar:1.16.1 from/to io_grpc_context (https://repo1.maven.org/maven2/): connect timed out
INFO: Elapsed time: 11.014s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
Fetching #com_github_pkg_errors; Restarting. 10s
I think it's related to proxy (corporate network). I tried adding proxy settings to C:/users/pemgithub/.m2/settings.html. However, bazel maven does not seem to be using the proxy settings.
So I'd rather just download the jar files manually and tell bazel maven to use the local jar files. How do I do this?
Bazel currently (July 2019) does not support this properly. While rules_jvm_external is recommended as the successor to maven_jar, it does not read Maven's ~/.m2/settings.xml and it also does not supporting using already downloaded artifacts from ~/.m2/repository.
One workaround is to use your own little reverse proxy, which reads from ~/.m2/repository and tell Bazel to download from localhost. I've created bazel-maven-proxy for this purpose. It does support proxies the same way Bazel does, i.e. reading http(s) and no_proxy environment variables.
Please do not use the maven_jar rule. It is being deprecated in favor of the Maven resolver ruleset rules_jvm_external.
In rules_jvm_external, you can use a proxy through the HTTP_PROXY/HTTPS_PROXY environment variables (documentation), and set a custom repository URL with auth credentials (documentation).

Sonarqube->SVN Authentication required error although supplied

I'm setting up sonarqube scan jobs in Jenkins and I have ensured to provide my svn credentials in sonarqube at 'Administration>Configuration>SCM>Username+Password.
Most of the jobs scan fine with svn blame data however one particular job I'm still getting the authentication error as below during the scm data scanning phase:
19:42:06.883 INFO: SCM provider for this project is: svn
19:42:06.883 INFO: 10938 files to be analyzed
19:42:16.899 INFO: 3/10938 files analyzed
19:42:26.901 INFO: 4/10938 files analyzed
.......
19:46:27.024 INFO: 246/10938 files analyzed
19:46:37.028 INFO: 247/10938 files analyzed
19:46:47.036 INFO: 247/10938 files analyzed
19:46:57.044 INFO: 247/10938 files analyzed
19:47:07.044 INFO: 247/10938 files analyzed
19:47:17.044 INFO: 247/10938 files analyzed
19:47:27.044 INFO: 247/10938 files analyzed
19:47:37.044 INFO: 247/10938 files analyzed
19:47:40.763 INFO: 248/10938 files analyzed
19:47:40.888 INFO: ------------------------------------------------------------------------
19:47:40.888 INFO: EXECUTION FAILURE
19:47:40.888 INFO: ------------------------------------------------------------------------
19:47:40.888 INFO: Total time: 2:02:46.450s
19:47:41.075 INFO: Final Memory: 36M/3064M
19:47:41.075 INFO: ------------------------------------------------------------------------
19:47:41.075 ERROR: Error during SonarQube Scanner execution
19:47:41.075 ERROR: Error when executing blame for file foo/bar.java
19:47:41.075 ERROR: Caused by: svn: E170001: Authentication required for '<http://svn-app:1234> john'
19:47:41.075 ERROR:
19:47:41.075 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
What's weird is that I've ran this scan multiple times and this error always pop around the 240-250th file it was analyzing i.e. not always the same file. Weirdly, authentication went through initially, just that around the 240-250th file then this error pops.
Various solutions recommend to disable scm sensor (sonar.scm.disabled=true) which my requirements forbids. I need the scm blame data.
I have tried the following things:
Restarting Jenkins Server
Restarting Sonarqube Server
Restarting SVN Server
In jenkins job configuration> sonarqube analysis properties, setting sonar.scm.username and sonar.scm.password
Deleting the job as well as workspace and recreating a new job.
Turns out it was due to the KeepAliveTimeout parameter at SVN being set too low. When it was analyzing the particular large file then it hits this timeout (for instance, more than 1 minute on the 207th file as per my code example), causing SVN to rechallenge sonarqube for credentials.
Now other svn clients would've created a credential cache under %HOMEPATH%/AppData/Roaming/Subversion/auth/svn.simple/ and retrieve this cache when this situation is encountered. However Sonarqube's svn plugin (svnkit) does not store credentials cache, and even if a cache exist it would not know how to read it(tried it with both encrypted and plaintext cache).
Editing the svn's KeepAliveTimeout parameter in httpd.conf solved this problem with a trade-off on svn server's performance theoretically - because svn would have wait longer before confirming a client is idle to close connection to reclaim resources, so increasing the KeepAliveTimeout parameter would cause svn to hold more requests at any given time.
References:
SVN Authentication Network Model: http://svnbook.red-bean.com/nightly/en/svn.serverconfig.netmodel.html#svn.serverconfig.netmodel.creds
Similar Issue: https://groups.google.com/forum/#!topic/sonarqube/-Vz2zoOBS1Y
SVNkit Authentication Mechanism: https://wiki.svnkit.com/Authentication:
https://github.com/jenkinsci/svnkit
Sonarqube SVNkit plugin repo: https://github.com/SonarSource/sonar-scm-svn
Jenkins SVNkit plugin repo: https://github.com/jenkinsci/svnkit

Jenkins: Maven release plugin giving "undefined symbol: apr_crypto_block_cleanup" when trying to dry run using SVN

We're using Jenkins 2.138.1 on Amazon Linux. We're trying to use the Maven Release plugin to build from our SVN repository. Although we can build snapshots fine, when we attempt to do a dry run of the Maven release plugin using the goals
-Dresume=false -DdryRun=true release:prepare
we run into this error
Waiting for Jenkins to finish collecting data[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project springboard: Unable to check for local modifications
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: /opt/bitnami/common/lib/libsasl2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libsvn_ra_svn-1.so.1)
[ERROR] svn: /opt/bitnami/common/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libserf-1.so.1)
[ERROR] svn: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libserf-1.so.1)
[ERROR] svn: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsvn_subr-1.so.1: undefined symbol: apr_crypto_block_cleanup
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project springboard: Unable to check for local modifications
Provider message:
The svn command failed.
Command output:
svn: /opt/bitnami/common/lib/libsasl2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libsvn_ra_svn-1.so.1)
svn: /opt/bitnami/common/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libserf-1.so.1)
svn: /opt/bitnami/common/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libserf-1.so.1)
svn: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsvn_subr-1.so.1: undefined symbol: apr_crypto_block_cleanup
Prior to this, we got "[ERROR] /bin/sh: 1: svn: not found" so we installed svn on the Linux machine using yum. Anyway, what can we do to overcome the problem above?
So the issue is because you have multiple version of the same library, specifically the following
libsasl2.so.2
libssl.so.1.0.0
libcrypto.so.1.0.0
Do a locate libxml2.so.2 to confirm and remove the old versions and create a symbolic link using ln -s
Repeat for the others.
https://github.com/sitespeedio/sitespeed.io/issues/220
Talks about a similar issue
Hope it helps :)
You seem to have issue between 32bits and 64bits packages mixing.
The first libraries in messages are about 32 bits, and information about SVN are about 64 bits (x86_64).
First, you should check your architecture, either with:
uname -r
or, if available with:
arch
You may get something like:
i686
Then you can install the good version of subversion corresponding to your OS.
Using apt-get like specified in one of your comment (adapt architecture):
sudo apt-get install subversion:i686
Or using yum, like specified in your original question (adapt architecture):
sudo yum install subversion.i686
Let me know if you need further help.

Newer version Artifactory is having problems with Jenkins Artifactory plugin

I have two Artifactory servers, one is a version 3.4.1 and the other is 6.0.2
The Jenkins is configured to push to two Artifactories with different Ids as shown below
The old Artifactory is working fine and Jenkins is able to connect to it but, the new Artifactory is throwing an exception and is not able to connect to it.
Here is an excerpt from the log:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project JavaApplications: Could not resolve dependencies for project JavaApplications:JavaApplications:jar:1.0.0: Failed to collect dependencies at net.sf.jt400:jt400-full:jar:5.4: Failed to read artifact descriptor for net.sf.jt400:jt400-full:jar:5.4: Could not transfer artifact net.sf.jt400:jt400-full:pom:5.4 from/to central (http://artifactory/artifactory/libs-release): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
Clearly, something to do with the certificates? please help
You need to add Jenkis *.crt file into cacerts. There is simple guild on Artifactory page.

maven clean install Failed to execute goal org.apache.maven.plugins

From Eclipse mars version, pom.xml - Run As - maven clean and i got the following error message with Build Failure.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project testing-framework:
Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.apache.maven:maven-plugin-api:jar:2.0.6:
Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6:
Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
I had the same problem. I solved it by killing java.exe process in Task Manager and re-excuting maven clean install.
Unknown host repo.maven.apache.org
sounds like a networking issue. Maybe check wether you need to supply proxy information within your settings.xml. Here's the documentation on how to supply one.
Alternativly, Eclipse might expose its own proxy settings to its Maven integration, but I'm not sure about that, I only use Maven from console. Still, its worth the check and maybe the config.

Resources