Azure Artifacts - Downloading Maven package content throws azure UnhandledPromiserejectionWarning - maven

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.

Related

Azure DevOps: Error importing Maven artifact from Azure Artifacts into Release

So I'm trying to do a proof of concept with the Azure DevOps stack and a project Java Maven project I usually build with Jenkins and host with Heroku. Initially I was trying to setup a release pipeline straight from the build pipeline WAR file but since it couldn't find it I said to myself "well, if you publish to artifacts it should be straighforward" so I did.
Build is publishing a maven artifact to Azure Artifacts
No issues here as far as I'm concerned. I didn't mess with permissions, but I did notice that under Feed Settings, I cannot selected (it's greyed out) "Allow builds and releases". But the Project Collection Build Services is set as a contributor.
Configuring the artifact in the release
So here is the first potential issue. The feed shows up in the dropdown but the artifact doesn't. There's only one artifact on the feed so I find this strange:
So I'm asked to entered it manually and this is where things start to get tricky. To me the id of the artifact should be the maven coordinates com.acme.demo:reading-time-app. If I enter that I can proceed, but there's no confirmation that's the right ID:
Creating and triggering the release
So as I create a new release it asks me for the version number and again the dropdown doesn't come up. So I write in version 1.1 which you can confirm from the first screenshot it exists:
I trigger the release and I get the following error during the Download Artifact phase:
2019-01-19T17:11:46.7642756Z ##[section]Starting: Download artifact - _com.acme.demoreading-time-app (Azure Artifacts)
2019-01-19T17:11:46.7895376Z ==============================================================================
2019-01-19T17:11:46.7895486Z Task : Download Package
2019-01-19T17:11:46.7895573Z Description : Download a package from a Package Management feed in Azure Artifacts or TFS.
Requires the Package Management extension.
2019-01-19T17:11:46.7895642Z Version : 0.1.17
2019-01-19T17:11:46.7895704Z Author : ms-vscs-rm
2019-01-19T17:11:46.7895757Z Help : Needs Package Management extension to be installed
2019-01-19T17:11:46.7895859Z ==============================================================================
2019-01-19T17:11:48.2563329Z SYSTEMVSSCONNECTION exists true
2019-01-19T17:11:48.2619024Z ##[error]Failed to get package metadata with error Error: Invalid Resource
2019-01-19T17:11:48.9982590Z ##[section]Finishing: Download artifact - _com.acme.demoreading-time-app (Azure Artifacts)
I'm losing my mind here. I'm thinking this should be pretty straighforward but I'm not even at the stage to debug any issues with the deployment into the Azure App Service yet. Any help is deeply appreciated.
Thank you in advance!
Sorry for the confusion here - currently, the "Azure Artifacts" artifact type only supports NuGet packages. We should have a string change out in the current deployment making that clearer. We're also working to expand it to support all the other types (Maven, npm, Python, and Universal); that should be available around end of February.

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 get Jenkins repository server to host only stable builds?

I have Jenkins version 2.7.1 running on a Windows 7 machine. It is successfully pulling code from a subversion repository and running tests. I have the test jobs set up for the development branch of each project only.
We periodically make stable releases of the projects in jar files with version numbers. I would like to have Jenkins be the repository manager for those stable releases. These are made by hand - There is no Jenkins job making or testing stable releases. The projects do use Maven.
Each stable build is tagged in the subversion repository, so it could be made again on demand if needed.
I downloaded the Maven repository server hoping to make this fit the purpose. I read the documentation that's provided, but it's pretty terse. As I understand it and have it configured now, this appears to have a couple of issues:
If I go to jenkins-ip/plugin/repository/project, it has made directories there that expose the names of all of my projects, which seems undesirable. (Here jenkins-ip is the IP where I access Jenkins on my local network.)
On the other hand, there's nothing but empty directories under these projects, so they're currently useless.
These projects all correspond to the continuous testing of the development branch. There's no apparent way to get the stable builds into the hierarchy. (It doesn't seem efficient to create a job for each stable release...)
Is there anyway to get Jenkins (with this plugin or through another method) to be the repository manager just for the stable builds? I know that I can start a different repository manager like archiva, but it would be ideal to use Jenkins since it's already running and it seems to claim capability for this function now.
To use Maven repository server you have to build the project on Jenkins.
Then the plugin will expose all archived artifacts as maven repo.
Note you need to use a "Maven project" type for it to work (freestyle is not supported)
There are several plugins that will help you manage building from multiple tags, however not all of them work with "Maven project" type.
You could also try Jenkins pipeline (previously "Workflow") or the Job-DSL plugin.
A simplest solution would be to have a build parameter specify the tag name (then checkout e.g. ^/tags/projectname/${tagParam}), but you have to figure out how to trigger the job then.

What exactly are teamcity artifacts?

A noob question, but googling and stack overflow search didn't seem to yield an answer.
Can someone explain what exactly are teamcity artifacts?
From the documentation
"Typically these include distribution packages, WAR files, reports,
log files, etc. When creating a build configuration, you specify artifacts
of your build at the General Settings page.
It doesn't really explain to me what an artifact is. A .Net oriented answer will be very helpful. I have a couple of builds already working on teamcity, but I'm not sure what exactly I would need an artifact for ?
thank you
Artifacts are the files you want the TeamCity server to store so that they can be downloaded after the build has finished. They will be downloadable from the TeamCity dashboard from each build.
For a .NET project you might choose the store the output of the compiler (i.e. .exe and .dll files), and the log files from running unit tests. You might just have a Windows Installer package (i.e. .msi).
It is completely up to you what gets stored for your specific needs. Just note that build artifacts do take up disk space on the TeamCity server, so if yours are large you'll want to configure the Build History Clean-up rules.

TeamCity copying artifacts from one agent to another

I'm extremely new to TeamCity and need to copy files from one TeamCity agent to another. I'm basically looking for some conceptual direction so I can start researching on how to accomplish the following:
Currently have a TeamCity Agent which builds program and creates corresponding artifacts. I need to copy these artifacts to another TeamCity Agent machine.
I'm getting acquainted with the build steps, we are using a commandline build runner. So I'll need to setup the build step for copying files via commandline--any hints on how to get started is greatly appreciated.
I apologize for any conceptual or term errors. I guess this is why I'm posting this question.
Kme,
In case you want to re-use the results of one build in another (e.g., run tests using results of compilation), you should take a look at two things:
Publish your build artifacts to server (more details here)
Download an artifact from server before build starts (more details here)
This will allow TeamCity to ensure that artifacts arrive at correct agent at correct moment of time. Also TeamCity will track usages of such artifacts.

Resources