Skip to content

Commit

Permalink
- added licensing and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dhladky committed Jan 9, 2020
1 parent 4f5785f commit a20c795
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 21 deletions.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
# nexus-release-staging-repositories
Sonatype Nexus plugin to automatically releasing promoted/staged staging repositories after a period of time.
is extending possibilities of Sonatype Nexus Staging Plugin. It allows to automatically release promoted/staged staging repositories after a period of time. Because it extends the Nexus Staging Suite, it is usable only in conjunction with Nexus 2.x Professional.

It adds a new scheduled task type with name **Automatic Release of Promoted Repositories**. It contains following settings:

- **Target Staging Profile** - only repositories, that were promoted by this staging profile will be released. You need to put the staging profile ID here.
- **Staging Repository Age** - how long after the latest update of the staging repository will the automatic release be done (in days).
- **Automatic Drop after Release** - if checked, the released staging repositories will be dropped. It is identical to the checkbox of the same name you can check when you do the release manually in Nexus Web UI.
- **Description** - the optional text identical to the same field in the release form when doing the release manually in Nexus web UI.

## Limitations

- so far it is necessary to copy-paste the _Target Staging Profile_ manually. This is not convenient and I hope I will be able to replace with a combobox, where you could select the profile. I failed to make it, but I asked Sonatype for help in this matter.
- the plugin runs with full permissions. If someone can guess the staging profile ID and you give him access to schedule tasks, he can release anything with this plugin.

## Installation

- shut down Nexus
- expand the bundle zip file to sonatype-work/nexus/plugin-repository folder
- on Mac/Linux set the file access permissions so Nexus can access the files. Example:
`chmod -R 0764 ~/xxx/sonatype-work/nexus/plugin-repository/nexus-release-staging-repositories-plugin-2.14.15-01`
- start Nexus and wait for the web UI to become active
- go to Administration -> Scheduled Tasks tab
- create the new scheduled tasks as necessary

## Build
- NX2 uses old Google framework for dependency injection and all its dependencies requires specific range of Maven. Use version 3.0.5
- If you decide updating this code, you may work with Java 8 or higher, however never use more modern language patterns (like lambda). Dependency injections stops working.
- In order to build this plugin you must have access to NX2 Professional and add com.sonatype.nexus.plugins:nexus-staging-plugin:{actual-version-number} to your Maven cache.


27 changes: 26 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,39 @@
<name>Nexus Release Staging Repositories</name>
<description>Plugin for automatic cleanup of promoted repositories.</description>

<licenses>
<license>
<name>Eclipse Public License Version 2.0</name>
<url>https://www.eclipse.org/legal/epl-2.0/</url>
<distribution>manual</distribution>
<comments>See more information at https://www.sonatype.com/usage/attributions</comments>
</license>
</licenses>

<organization>
<name>Red Hat, Inc.</name>
<url>https://developers.redhat.com</url>
</organization>

<properties>
<!-- nexus-plugin-bundle configuration -->
<pluginSiteUrl>https://github.com/dhladky/nexus-release-staging-repositories</pluginSiteUrl>
<copyright.year>2020</copyright.year>
</properties>

<parent>
<groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-plugins</artifactId>
<version>2.14.15-01</version>
</parent>

<scm>
<url>https://github.com/dhladky/nexus-release-staging-repositories</url>
<connection>scm:git:git://github.com/dhladky/nexus-release-staging-repositories.git</connection>
<developerConnection>scm:git:git://github.com/dhladky/nexus-release-staging-repositories.git</developerConnection>
</scm>

<dependencies>

<!-- Main plugin API, pulling in what is needed -->
<dependency>
<groupId>org.sonatype.nexus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
@EagerSingleton
public class ReleaseStagingRepositoriesPlugin extends PluginIdentity
{
/**
* Prefix for ID-like things.
*/
@NonNls
public static final String ID_PREFIX = "rsr";

/**
* Expected groupId for plugin artifact.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.redhat.nexus.releasestagingrepositories.ui;

import org.sonatype.nexus.formfields.Combobox;
//fixme does not work

/** Combobox for picking of staging profile. */
public class StagingProfileComboFormField extends Combobox<String> {
Expand Down
13 changes: 0 additions & 13 deletions src/main/resources/com/redhat/nexus/rsr-about.vm

This file was deleted.

0 comments on commit a20c795

Please sign in to comment.