Vedran Kopanja
Vedran Kopanja

Reputation: 1299

How do you properly deploy from Azure Artifact Feed

I have an issue with my deployment/release process using Azure DevOps.

I have a Spring Boot API and I use Azure Pipelines to build the project and deploy it to my Artifact Feed. Using the SNAPSHOT version (I'm using Maven), the feed saves last 25 items, which in and of itself is fine. But the issue I have is when I create a new release (I'm also using Azure Release pipelines), it will take all the jar files from the feed for the SNAPSHOT version and deploy them to my App Service.

enter image description here

What I wanna know, is there a way for me to filter only the latest jar file during the release pipeline? I created a startup script which does that on the App Service, but deploys take like 10 minutes, because it uploads 5 GB of jar files each time.

The build pipeline is fine, and the release one is in the screenshots below.

enter image description here

enter image description here

enter image description here

Any and all help will be appreciated, thanks!

Upvotes: 1

Views: 85

Answers (2)

Alvin Zhao - MSFT
Alvin Zhao - MSFT

Reputation: 6037

As of now, there is no functionality out-of-the-box to filter out the expected latest snapshot package to be downloaded during a release. The artifact file names cannot be referenced by any predefined release/artifacts variable, therefore the file naming pattern filter can only provide limited assistance.

The sample script is run to eliminate the unexpected snapshot packages after the default download of artifacts and before deployment. This will not reduce the time to download packages but can help you reduce the time for deployment.

tree

cd $(System.DefaultWorkingDirectory)/mvn

Get-Item "JavaAppDemoHelloAlvin*.jar" | Sort-Object -Descending Name | Select-Object -SkipIndex 0 | Remove-Item

tree

enter image description here

Image

enter image description here

Upvotes: 1

Rui Jarimba
Rui Jarimba

Reputation: 18094

As per Handling Maven snapshots:

When using Maven snapshots, multiple versions can be downloaded at once. You might need to remove the old versions and only keep the latest artifact before deployment.

Upvotes: 1

Related Questions