Store Gradle distribution in Azure devops artifacts? - gradle

The distribution url in my gradle-wrapper.properties is pointing at
https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
That is, its pointing towards the internet. Is it possible to use the Azure devops artifacts url instead, and let it cache gradle distributions for future proofing?

We (Azure Artifacts) don't have anything that would handle that directly. You might be able to script something up to store the files using Universal Packages, but you'd have to handle all the details yourself.

Related

Azure Artifacts - Downloading Maven package content throws azure UnhandledPromiserejectionWarning

One of our development teams have recently migrated their Maven project files from another version control system to Azure DevOps. However, a major caveat is that these Maven projects were created with no POM files (I have no idea why).
The project team have in any case managed to move all of their Maven packages into Azure Artifacts. When a release pipeline job is then run, it is then expected to retrieve the desired artifacts (*.war files) from Azure Artifacts, download to the agent's artifacts directory and subsequently deploy to the target server. The pipeline itself is completed successfully (all tasks set to green status), however when we review the output log, we discover that the artifacts were never downloaded and instead, the download task returns an "UnhandledPromiserejectionWarning". Any idea why this is happening?
So far, we've tried using CURL as an alternative to download the artifacts, but all has been in vain. Naturally, we've also tried and failed with the Azure Artifacts' dedicated "Download Package" pipeline task, but are willing to try an alternative solution, if anyone has some kind suggestions. Been wondering something like Powershell (or other script) can for instance be used to download the desired package files.
I must also mention that the CURL option only appears to fail over a failed OAuth authentication. Any advice on that front will also be helpful, as it is probably our quickest route to a workaround.
I had a similar issue, it turns out the problem was just the capital case.
The DownloadPackage task was trying to download 0.0.30-SNAPSHOT, but instead you can only download the package as 0.0.30-snapshot, as it states on the microsoft official docs.
In order to fix it, I had to install an external plugin, then add an additional task before download, that task was converting the name to lower case.
I was using the classical release pipeline, btw.

Upload or Publish Multiple Artifacts to Azure DevOps Package Manager

I am looking for a solution to what appears a simple problem but is proving quite difficult to crack.
I have a number of artifacts (predominantly jar files) downloaded from Artifactory and which I am looking to bulk upload to our new repository, DevOps Azure Package Manager.
I am open to any solution, ideally one that can be run from the command line or set up as an Azure DevOps (VSTS) build/release pipeline Task. The key requirement though is that it should have the capability to perform a bulk upload, not singularly. Would appreciate any positive ideas or suggestions on how to achieve this.
Microsoft’s Package Manager looks as norml Maven repository so You can use any method thats supports publishing artifacts to remote repository.
Here is sample with gradle https://dzone.com/articles/how-to-upload-a-list-of-jars-into-nexus-or-artifac
Please follow standard procedure to generate credentials for Maven/Gradle to be able to publish one artifact, then adjust sample gradle script to Your needs

How to pull down Nexus OSS repo files with a Jenkins pipeline?

I'm trying to replicate a Jenkins production need in my lab, and it involves fetching/pulling files from Github & Nexus 2, building with ant/gradle, then publishing to Nexus. The Github part is working fine in my Jenkins pipeline, but I'm having some issues with the syntax/reqs for Nexus. I installed Nexus OSS in my lab to duplicate Nexus 2's functionality. I am able to upload files manually to the repo using curl, and I'm sure I can use it to download as well. This doesn't seem like the best or most efficient option however, if there will be multiple files.
I keep seeing references to Maven/pom.xml on all my searches for this topic, but I can't find a good primer on how to use them in this context. Would a pom.xml file be the best option for
this Jenkins/Nexus configuration and the requirements? Also, how close are Nexus 2/3 in functionality to Nexus OSS? Will I be able to port over the code for use with nexus 2 fairly easily?

Download maven2 repository for offline use

We are developing offline due to limited internet resources and would like to run once every several months a whole grab of an external repository (e.g repo1.maven.org/maven2 - Disk space isn't an issue).
Today I'm using a simple POM that contains a lot of common dependencies that we are using, I've set my local maven to use a mirror to proxy thru a local nexus repository to cache locally and this is how I'm grabbing for offline use - but that isn't very effective.
I'm now looking for a command line tool that allow me to run searches on maven repositories so that I can write a script that grab them all to my local nexus installation and would like to hear if there is any or if there is another way to achieve that.
Thanks
Not a whole solution (yet) but I'm using httrack to grab the whole content of repo1.maven.org/maven2 - That is already better than nothing :)
In general, there is a goal in Maven dependency plugin called "go-offline"
So it allows to grab all the project dependencies and to store them in local .m2 repo.
You can find more information here.
If you want to run Maven and tell it to behave like the network does not exist you can run it with "-o" option (offline mode). So that if there is no dependency installed locally, Maven won't even try to go to network and bring it - but will fail the build.
On the opposite, if you want to force Maven to check and bring new versions (otherwise they already should be in your repo), you can use "-U" option.
I'm not really sure I've got the point about general search-and-download use case. Usually people install Nexus or Artifactory once in a network so that each dependency will be downloaded only once. In local development machines people usually just work with filesystem and don't maintain tools like this.
Now if you want to copy the whole repository from internet (for copying it later to some other network or something) you can just use crawlers like Apache Nutch for example or craft your own script that will recursively download all the files.

Does Artifactory offer similar feature that the procurement suite in Sonatype Nexus Pro does?

I am researching the pros/cons of Artifactory and Nexus.
There is a feature in Nexus that I like very much -- the procurement suite. It provides GUI to define the procurement rule. After the procured repository is populated with all the artifacts needed for the build, the admin can choose to stop the procurement and the procured repository is reverted back to be a local repository. As I understand, Artifactory provides includes/excludes pattern definition in the remote repository to achieve similar control, but it is far more rudimentary than what Nexus offers. I am not an expert on Artifactory. Does Artifactory offers something more advanced to tight control the artifacts used in the build, like the procurement suite does?
BTW, I like Artifactory's Watch feature, sending email when a add/delete/update happens in a watched repository. Nexus does not offer email notification, though it provides RSS feed. Artifactory does not support RSS feed now, but it says this feature is in development. Sometimes I just wish there is one product that can offer all these features combined. :-)
Ok. The JFrog folks gave me the official answer and would like to share with everyone. Theincludes/excludes pattern I mentioned in my original question is the main mechanism Artifactory uses to control the access the artifacts in the build. Besides that, Artifactory also offers something called License Control Addon in their Pro version. It basically allows you to manage and get alerted for unauthorized licenses of 3rd party libraries and dependencies when they are getting deployed from your CI server. It does not directly apply to my use case, but it is good to know. Also they pointed out that as a user, I can use their User plugin API to do whatever I want. That's also good to know, but at least for now, I am not interested in developing a plugin for Artifactory myself.
It's been a while since I used artifactory, but I think when you configure a repo, you have the option on applying a regex to the artifacts that it will pull. That might do what you need/want.

Resources