[BUILD-549] Automatically update SNAPSHOTs to their staged final versions Created: 29/Sep/21  Updated: 06/Oct/21  Resolved: 06/Oct/21

Status: Closed
Project: Build
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Maxime Michel Assignee: Maxime Michel
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File staging.xml    
Template:
Acceptance criteria:
Empty
Epic Link: Release automation

 Description   

5.7.12's release has us realize that the following doesn't work:

// look for potential staged dependencies
sh "mvn versions:use-releases -DgenerateBackupPoms=false -Pstaging"

It doesn't pick up on staged repositories, and it also updates other, unwanted dependencies.

This is critical in order to automate a release because if the SNAPHOTs stay, the release will fail. Also, we do not want a developer manually updating the pom.xml at every step of the way.

It should be possible to resolve a list of staged repositories using the following endpoint, though: https://nexus.magnolia-cms.com/service/local/staging/profile_repositories (see sample XML file)

Maybe using Nexus 3 or Artifactory and its neat CLI would be other solutions.

Or by using a GAV search.



 Comments   
Comment by Maxime Michel [ 06/Oct/21 ]

I got it to work with the exact same setup that was used for last release. I need to take a closer look if the issue happens again. But the command does work:

 ➜  usage-metrics git:(master) ✗ sed -n '132p' pom.xml
      <version>1.1.3-SNAPSHOT</version>
➜  usage-metrics git:(master) ✗ mvn versions:use-releases -Pstaging
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ---------< info.magnolia.usagemetrics:magnolia-usage-metrics >----------
[INFO] Building magnolia-usage-metrics 1.1.3-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.8.1:use-releases (default-cli) @ magnolia-usage-metrics ---
[INFO] Updated info.magnolia.log:magnolia-log-tools:jar:1.1.3-SNAPSHOT to version 1.1.3
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.923 s
[INFO] Finished at: 2021-10-06T10:45:05+02:00
[INFO] ------------------------------------------------------------------------
➜  usage-metrics git:(master) ✗ sed -n '132p' pom.xml
      <version>1.1.3</version>

Generated at Sun Feb 11 23:42:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.