Skip to content

Commit 4c1cda6

Browse files
authored
Extend rc-list goal with showAllDeployments param (#4)
Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
1 parent ab47292 commit 4c1cda6

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,37 +41,39 @@ Maven plugin for Sonatype Central Portal API ([API Doc](https://central.sonatype
4141

4242
## Plugin Parameters
4343

44-
| Parameter | Description | Default | Example Value |
45-
| ------------------------ | -------------------------------------------------------------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
46-
| central.bearerToken | Bearer token for authentication | | xxxxxxxx... |
47-
| central.serverId | Server id in settings.xml to use for bearer token | central | myserverid |
48-
| central.namespace | Namespace of the component | | org.eclipse.cbi |
49-
| central.name | Name of the component | | org.eclipse.cbi.tycho.example-parent |
50-
| central.version | Version of the component | | 1.0.0 |
51-
| central.deploymentId | Deployment id for release/drop operations | | xxxxx-xxxxx-xxxx-xxx-xxxxxxx |
52-
| central.centralApiUrl | Custom Central Portal API URL | https://central.sonatype.com/api/v1/publisher | https://central.sonatype.com/api/v1/publisher |
53-
| central.removeAll | If true, drop all deployments in the namespace | false | true |
54-
| central.removeFailedOnly | If true, only drop deployments in FAILED state (used with removeAll or when dropping by id/latest) | true | true |
55-
| central.dryRun | If true, only simulate the release/drop (no action performed) | false | true |
56-
| central.artifactFile | Path to the artifact file to upload (zip file containing Maven artifacts) | | /path/to/bundle.zip |
57-
| central.bundleName | Custom name for the upload bundle (defaults to artifact filename without extension) | | my-custom-bundle |
58-
| central.automaticPublishing | Whether to automatically publish after validation (true=AUTOMATIC, false=USER_MANAGED) | false | true |
59-
| central.maxWaitTime | Maximum wait time in seconds for validation to complete | 300 | 600 |
60-
| central.maxWaitTimePublishing | Maximum wait time in seconds for publishing to complete | 600 | 900 |
61-
| central.pollInterval | Polling interval in seconds when checking deployment status | 5 | 10 |
62-
| central.waitForCompletion | If true, wait for complete publishing process. If false, return after validation/publishing starts | false | true |
44+
| Parameter | Description | Default | Example Value |
45+
| ------------------------ |--------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------------------------------- |-----------------------------------------------|
46+
| central.bearerToken | Bearer token for authentication | | xxxxxxxx... |
47+
| central.serverId | Server id in settings.xml to use for bearer token | central | myserverid |
48+
| central.namespace | Namespace of the component | | org.eclipse.cbi |
49+
| central.name | Name of the component | | org.eclipse.cbi.tycho.example-parent |
50+
| central.version | Version of the component | | 1.0.0 |
51+
| central.deploymentId | Deployment id for release/drop operations | | xxxxx-xxxxx-xxxx-xxx-xxxxxxx |
52+
| central.centralApiUrl | Custom Central Portal API URL | https://central.sonatype.com/api/v1/publisher | https://central.sonatype.com/api/v1/publisher |
53+
| central.removeAll | If true, drop all deployments in the namespace | false | true |
54+
| central.removeFailedOnly | If true, only drop deployments in FAILED state (used with removeAll or when dropping by id/latest) | true | true |
55+
| central.dryRun | If true, only simulate the release/drop (no action performed) | false | true |
56+
| central.artifactFile | Path to the artifact file to upload (zip file containing Maven artifacts) | | /path/to/bundle.zip |
57+
| central.bundleName | Custom name for the upload bundle (defaults to artifact filename without extension) | | my-custom-bundle |
58+
| central.automaticPublishing | Whether to automatically publish after validation (true=AUTOMATIC, false=USER_MANAGED) | false | true |
59+
| central.maxWaitTime | Maximum wait time in seconds for validation to complete | 300 | 600 |
60+
| central.maxWaitTimePublishing | Maximum wait time in seconds for publishing to complete | 600 | 900 |
61+
| central.pollInterval | Polling interval in seconds when checking deployment status | 5 | 10 |
62+
| central.waitForCompletion | If true, wait for complete publishing process. If false, return after validation/publishing starts | false | true |
63+
| central.showAllDeployments | Lists all deployments available (goal: rc-list) | false | true |
64+
| central.showArtifacts | If true (or not set as default), shows all info including artifacts. If false, shows only deployment's details without artifacts. (goal: rc-list) | true | false |
6365

6466
You can provide your Bearer token either via the command line or securely via your Maven `settings.xml` file.
6567

6668
## Plugin Goals
6769

68-
| Goal/Function | Description | Main Parameters | Example Command |
69-
| ------------- | -------------------------------------------------------------------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
70-
| rc-status | List publication status for a component | namespace, name, version, bearerToken | mvn central-staging-plugins:rc-status -Dcentral.namespace=org.eclipse.cbi -Dcentral.name=org.eclipse.cbi.tycho.example-parent -Dcentral.version=1.0.0 |
70+
| Goal/Function | Description | Main Parameters | Example Command |
71+
| ------------- | -------------------------------------------------------------------------------- |-------------------------------------------------------------------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------- |
72+
| rc-status | List publication status for a component | namespace, name, version, bearerToken | mvn central-staging-plugins:rc-status -Dcentral.namespace=org.eclipse.cbi -Dcentral.name=org.eclipse.cbi.tycho.example-parent -Dcentral.version=1.0.0 |
7173
| rc-upload | Upload artifact bundle to Central Portal with validation waiting | artifactFile, bundleName, automaticPublishing, waitForCompletion, bearerToken | mvn central-staging-plugins:rc-upload -Dcentral.artifactFile=/path/to/bundle.zip -Dcentral.automaticPublishing=false -Dcentral.waitForCompletion=true |
72-
| rc-publish | Publish a deployment (publish if validated, supports dry run) | deploymentId (optional), bearerToken, dryRun | mvn central-staging-plugins:rc-publish -Dcentral.deploymentId=xxxxx-xxxxx-xxxx-xxx-xxxxxxx -Dcentral.dryRun=true |
73-
| rc-drop | Drop (delete) a deployment (supports dry run) | deploymentId, bearerToken, dryRun | mvn central-staging-plugins:rc-drop -Dcentral.deploymentId=xxxxx-xxxxx-xxxx-xxx-xxxxxxx -Dcentral.dryRun=true |
74-
| rc-list | List all deployments for a namespace, with state, date, and errors per component | namespace, bearerToken | mvn central-staging-plugins:rc-list -Dcentral.namespace=org.eclipse.cbi |
74+
| rc-publish | Publish a deployment (publish if validated, supports dry run) | deploymentId (optional), bearerToken, dryRun | mvn central-staging-plugins:rc-publish -Dcentral.deploymentId=xxxxx-xxxxx-xxxx-xxx-xxxxxxx -Dcentral.dryRun=true |
75+
| rc-drop | Drop (delete) a deployment (supports dry run) | deploymentId, bearerToken, dryRun | mvn central-staging-plugins:rc-drop -Dcentral.deploymentId=xxxxx-xxxxx-xxxx-xxx-xxxxxxx -Dcentral.dryRun=true |
76+
| rc-list | List all deployments for a namespace, with state, date, and errors per component | namespace, showAllDeployments, showArtifacts, bearerToken | mvn central-staging-plugins:rc-list -Dcentral.namespace=org.eclipse.cbi |
7577

7678
### Publishing Mode Examples
7779

src/main/java/org/eclipse/cbi/central/plugin/RcListMojo.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ public class RcListMojo extends AbstractCentralMojo {
1515
@Parameter(property = "central.showAllDeployments", defaultValue = "false")
1616
protected boolean showAllDeployments;
1717

18+
/**
19+
* If true (or not set as default), shows all info including artifacts.
20+
* If false shows only deployment's details without artifacts.
21+
*/
22+
@Parameter(property = "central.showArtifacts", defaultValue = "true")
23+
protected boolean showArtifacts;
24+
1825
/**
1926
* The namespace to use for listing deployments. Defaults to the project's
2027
* groupId if not set.
@@ -78,9 +85,11 @@ private void printDeployment(Object depObj) {
7885
Object createTimestamp = dep.get(DeploymentConstants.CREATE_TIMESTAMP);
7986
String dateStr = formatTimestamp(createTimestamp);
8087
getLog().info("DeploymentId: " + deploymentId + ", State: " + deploymentState + ", Created: " + dateStr);
81-
Object componentsObj = dep.get(DeploymentConstants.DEPLOYED_COMPONENT_VERSIONS);
82-
if (componentsObj instanceof java.util.List) {
83-
printComponents((java.util.List<?>) componentsObj);
88+
if (showArtifacts) {
89+
Object componentsObj = dep.get(DeploymentConstants.DEPLOYED_COMPONENT_VERSIONS);
90+
if (componentsObj instanceof java.util.List) {
91+
printComponents((java.util.List<?>) componentsObj);
92+
}
8493
}
8594
}
8695

0 commit comments

Comments
 (0)