Issue declaring the Nexus3 repositories as remote repositories in Artifactory - artifactory

I am setting up Nexus3 repository as a remote repository in Artifactory.
But when I update the Nexus3 repo URL(https://domainname/repository/reponame/) & necessary credentials for authentication in the admin section, during testing i am getting,
Connection failed: Error 404.
I have tried providing the rest URL(http://domainname/service/rest/repository/browse/reponame).
In this case, connection to the nexus server establishes successfully & able to see the directory structure for the remote repo in the Artifacts section , but could not find the artifacts inside & seeing below output/error,
{ "errors" : [ {
"status" : 404,
"message" : "Couldn't find item: XXXX:XXXXXXX" } ]

You have to ignore the error while saving. This is because of a header mismatch.
Repo path should be like:
https://<host>:<port>/repository/reponame
Once you save the repository and try to download, it will work.

The test is failing when creating an Artifactory remote repository which point to a hosted Nexus repository, since Artifactory is using a HEAD request for checking the remote repository and for some reason Nexus will return a 404 (while returning a 200 when the same request is sent using the GET method). This behavior does not happen with Nexus group repositories.

Related

Python-Poetry Errors Publishing to Artifactory

I'm having a dickens of a time publishing to our Artifactory instance using poetry (1.1.12). I've tried a couple different URL's to publish to, and I either get a 405 (Method not Allowed), or a 415 (Unsupported Media Type)
https://my.domain/artifactory/my-cool-reg/ --> 405
https://my-cool-reg.my.domain/artifactory/api/pypi/pypi/simple/ -> 415
Is there some magic that I'm missing to get publishing going? I have tried passing my credentials both with -u and -p on the CLI, as well as with the credential config for the repository via -r my_repo. Below is an example error message (from the pypi url test)
UploadError
HTTP Error 415: Unsupported Media Type
at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:216 in _upload
212│ self._register(session, url)
213│ except HTTPError as e:
214│ raise UploadError(e)
215│
→ 216│ raise UploadError(e)
217│
218│ def _do_upload(
219│ self, session, url, dry_run=False
220│ ): # type: (requests.Session, str, Optional[bool]) -> None
geudrik - For the PyPI deployment, local configuration (.pypirc) should be defined with the API endpoint as http://pythonpublishtest.com/artifactory/api/pypi/test-pypi-local
/api/pypi is the required endpoint and the test-pypi-local I have mentioned in the URL here is the local repository. The reason for the HTTP 405 and HTTP 415 errors could be due to missing/incorrect API endpoint or the missing deployment repository.
I see that you are attempting to publish with the following URL (https://my-cool-reg.my.domain/artifactory/api/pypi/pypi/simple/). Could you please remove "simple" from the URI and include your PyPI local repository's name & verify if that works?
[Additional note]
Artifactory also supports the deployment of artifacts through the virtual repository. In order to enable it, we need to define the local repositories to be aggregated by the virtual repository as a target for deployment. It can be achieved by setting the Default Deployment Repository under the Virutal repository settings.
By gum, I've figured it out
$ poetry config repositories.poetry-repo-name https://artifactory.domain.lan/artifactory/api/pypi/your-cool-repository

proxy to conan-center: Remote from remote is not json, but 'application/octet-stream'

I set up a jfrog artifactory with a conan "remote" repository to proxy the official conan-center repository. I see three different conan-center URLs, depending on with source I read: center.conan.io, conan.io/center, and conan.bintray.com. I used the latter, conan.bintray.com, as it's the default URL that artifactory proposes for a remote repository of type conan. I didn't change any settings.
Then I tried to do a conan install .. as I'd do normally on my local builds, but I removed the official conan-center repository that comes by default, and added my proxy repository (remote repository, as jfrog calls it)
$ conan remote list
conan-center-remote: http://conan.foo.com:8081/artifactory/conan-center-remote/ [Verify SSL: True]
And then I get this error:
$ conan install ..
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=10
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
libavrocpp/1.10.1: Not found in local cache, looking in remotes...
libavrocpp/1.10.1: Trying with 'conan-center-remote'...
ERROR: {
"conan_export.tgz" : "https://conan.bintray.com/artifactory/api/conan/conan-center-legacy/v1/files/_/libavrocpp/1.10.1/_/5413c1d93780b9806d4ffcf0e9436409/export/conan_export.tgz",
"conan_sources.tgz" : "https://conan.bintray.com/artifactory/api/conan/conan-center-legacy/v1/files/_/libavrocpp/1.10.1/_/5413c1d93780b9806d4ffcf0e9436409/export/conan_sources.tgz",
"conanmanifest.txt" : "https://conan.bintray.com/artifactory/api/conan/conan-center-legacy/v1/files/_/libavrocpp/1.10.1/_/5413c1d93780b9806d4ffcf0e9436409/export/conanmanifest.txt",
"conanfile.py" : "https://conan.bintray.com/artifactory/api/conan/conan-center-legacy/v1/files/_/libavrocpp/1.10.1/_/5413c1d93780b9806d4ffcf0e9436409/export/conanfile.py"
}
Response from remote is not json, but 'application/octet-stream'. [Remote: conan-center-remote]
Why do I get this error?
I had also meet this problem.
My solution was to change the remote URL from https://your.jfrog.url/artifactory/your-conan-proxy-name/ to https://your.jfrog.url/artifactory/api/conan/your-conan-proxy-name/
Then change the conan local config: conan config set general.revisions_enabled=1

SBT 1.1.1 not using credentials for Nexus proxy

We moved to a new authenticated Nexus to act as a proxy to get dependencies.
I've tried to to give SBT (1.1.1) the credentials it needs, in multiple ways, but I always endup getting :
[error] Unable to find credentials for [Sonatype Nexus Repository Manager # nexus3.company.com]
[debug] CLIENT ERROR: Unauthorized url=https://nexus3.company.com/repository/maven2-proxy-all/org/scala-sbt/actions_2.12/1.1.1/actions_2.12-1.1.1.pom
It's repeated for a lot of dependencies.
I've created a .credentials file in my project as follow:
realm=Sonatype Nexus Repository Manager
host=nexus3.company.com
user=xxxxx
password=xxxxx
Here's what I've tried, based on inputs I got from other threads on the internet:
Adding the path to this credentials file in the command : -Dsbt.boot.credentials=.credentials
Adding the path to this credentials file to an environment variable : $SBT_CREDENTIALS = PATH
Adding the following line in the build.sbt : credentials += Credentials(new File(".credentials"))
Adding the following line in the build.sbt : credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", "xxxxx", "xxxxxx")
Checking what's going on with a proxy : my requests don't seem to have any authorization header and all come back as HTTP 401
And yet, when I access the URL mentioned from the same machine, with the credentials in the file, there is no issue at all.
I'm running out of ideas here :(
After more attempts, adding :
~/.sbt/1.0/credentials.sbt
credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", USER, PWD)
AND
The SBT_CREDENTIALS variable mentioned above,
Seems to do the job.
I also updated the image we use for our pipelines, not sure if it helped.

Artifactory has lost track of local artifacts

I'm using Artifactory OSS 4.1.0 and Java 1.8.0_51.
When I try to download one of my local artifacts from the Artifactory web interface, I get this:
{
"errors" : [ {
"status" : 500,
"message" : "Could not process download request: Binary provider has no content for 'bab1c4e18f6c5edfb65b2503a388dea2fed0deb8'"
} ]
}
But I found this file in my Artifactory data area: ./files/ba/bab1c4e18f6c5edfb65b2503a388dea2fed0deb8, and upon further inspection it is the WAR file I tried to download.
I've come across other people on the web with the same error message, but their issue was with caching external artifacts, and their workaround was to delete the cache.
Does anyone have an idea what's going on and how I can fix the problem? BTW, I did stop and restart our Artifactory server, but with no noticeable difference.
Artifactory doesn't store the binaries under ./files directory, but under $ARTIFACTORY_HOME/data/filestore.
It looks like you had a symbolic link from the files directory to the filestore directory and this link was deleted.

Nexus Mark Oracle Maven Repository as Invalid

Creating a Proxy repository on Nexus that proxies Oracle Maven Repo (http://download.oracle.com/maven/) marks the Oracle Repo as "Attempting to Proxy and Remote Unavailable"
The problem might be that Oracle disabled directory listing and every attempt to get the content without the full GAV returns a 404 code.
How to workaround this on Nexus?
Using Nexus OS Edition 1.9.2.2
Configuration:
Remote Storage Location = http://download.oracle.com/maven/
Download Remote Indexes = True
Auto Blocking Active = False
File Content Validation = True
CheckSum Policy = Warn
There should be no need to proxy the oracle repos, we've merged all of that content into Central now, so you can safely remove these from your Nexus.
The url you are using is wrong. Did you mean the java.net repo at http://download.java.net/maven/2/

Resources