Skip to content

Commit

Permalink
- NEXUS-301 - Automated Plugin For Releasing is Releasing too Many Re…
Browse files Browse the repository at this point in the history
…positories
  • Loading branch information
dhladky committed Apr 21, 2020
1 parent 8f53a7e commit 7f0f5c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-plugins</artifactId>
<version>2.14.16-01</version>
<version>2.14.17-01</version>
</parent>

<scm>
Expand All @@ -58,14 +58,14 @@
</dependency>

<!-- Needs to be added to Maven manually aka:
mvn install:install-file -Dfile=nexus-staging-plugin-2.14.16-01.jar -DgroupId=com.sonatype.nexus.plugins -DartifactId=nexus-staging-plugin -Dversion=2.14.16-01 -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=nexus-staging-plugin-2.14.17-01.jar -DgroupId=com.sonatype.nexus.plugins -DartifactId=nexus-staging-plugin -Dversion=2.14.17-01 -Dpackaging=jar -DgeneratePom=true
-->
<dependency>
<groupId>com.sonatype.nexus.plugins</groupId>
<artifactId>nexus-staging-plugin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<type>${nexus-plugin.type}</type> <!-- -->
<type>${nexus-plugin.type}</type> <!-- -->
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down Expand Up @@ -60,6 +61,27 @@ protected String doRun() throws Exception {
if(reposToPromote.size() > 0) {
try {
stagingManager.promoteStagingRepositories(reposToPromote, getParameter(CleanUpTaskDescriptor.FLD_DESCRIPTION), Boolean.parseBoolean(getParameter(CleanUpTaskDescriptor.FLD_AUTOMATIC_DROP)));

while (true) {
synchronized (this){
wait(60000);
}

Iterator<String> iterator = reposToPromote.iterator();
while (iterator.hasNext()) {
String repo = iterator.next();
if(!stagingManager.isTransitioning(repo)) {
iterator.remove(); // processed
}
}

if(reposToPromote.isEmpty()) {
logger.info("Automatic release of " + profileId +" finished.");
break;
} else {
logger.info("Automatic release of "+ profileId + " is running: "+reposToPromote.size()+" repositories to process.");
}
}
} catch (Exception e) {
logger.error("Error promoting repositories: ", e.getMessage());
}
Expand Down

0 comments on commit 7f0f5c3

Please sign in to comment.