Hi,
I want to apply cleanup on NPM repository. So far i was able to delete assets but i hade difficulties in root json changes.
Here is my groovy script:
import groovy.json.JsonSlurper
import org.sonatype.nexus.repository.storage.Asset
import org.sonatype.nexus.repository.storage.Query
import org.sonatype.nexus.repository.storage.StorageFacet
def request = new JsonSlurper().parseText(args)
assert request.repoName: 'repoName parameter is required'
assert request.startDate: 'startDate parameter is required, format: yyyy-mm-dd'
def repo = repository.repositoryManager.get(request.repoName)
StorageFacet storageFacet = repo.facet(StorageFacet)
def tx = storageFacet.txSupplier().get()
tx.begin()
Iterable<Asset> assets = tx.findAssets(Query.builder().where("last_updated > '2017-08-01'").and("content_type != 'application/json'").build(), [repo])
assets.each {asset ->
tx.deleteAsset(asset)
}
tx.commit()
return "DONE"
This script successfully delete assets but in PACKAGE_ROOT asset(application/json) was not updated.
Any suggestions?
Thanks in advance,
Georgi
Are you able to use “npm deprecate” with nexus 3.5?
I’m running the latest nexus 3.5.2-01 and get a server error (500) when I try to deprecate a package:
$ npm deprecate http://mynexus:8081/nexus/repository/npm-local my...@1.0.0 “This package is deprecated”
Error in the nexus.log:
2017-09-14 15:26:26,832+0200 WARN [qtp1419408657-426] admin org.sonatype.nexus.repository.httpb
ridge.internal.ViewServlet - Failure servicing: PUT /nexus/repository/npm-local/mynpm
java.lang.ClassCastException: Cannot cast java.lang.Boolean to java.lang.String
at java.lang.Class.cast(Class.java:3369)
at org.sonatype.nexus.common.collect.AttributesMap.coerce(AttributesMap.java:75)
at org.sonatype.nexus.common.collect.AttributesMap.get(AttributesMap.java:153)
at org.sonatype.nexus.common.collect.AttributesMap.get(AttributesMap.java:162)
at com.sonatype.nexus.repository.npm.internal.NpmHostedFacetImpl.updateDeprecationFlags(
NpmHostedFacetImpl.java:159)
Met vriendelijke groet/Kind regards,
Mariska Hoogenboom
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
nexus-users...@glists.sonatype.com.
To post to this group, send email to
nexus...@glists.sonatype.com.
To view this discussion on the web visit
https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/dca54aed-7cad-47a8-887d-479971b82eab%40glists.sonatype.com.
For more options, visit
https://groups.google.com/a/glists.sonatype.com/d/optout.
Are you able to use “npm deprecate” with nexus 3.5?
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/dca54aed-7cad-47a8-887d-479971b82eab%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/1CBB0AB25CBB3645938B01960A52A58A7E4ACE35%40ccv-arn-exmb02.ccveu.local.
You are right, something was wrong with my versioning (or other field). I’ve published another test package and now I can deprecate this just fine. Not sure yet what was wrong, because I was able to install the published package. But will investigate this further.
Thanks for the hint!
Met vriendelijke groet/Kind regards,
Mariska Hoogenboom
From: nexus...@glists.sonatype.com [mailto:nexus...@glists.sonatype.com]
On Behalf Of Peter Lynch
Sent: donderdag 14 september 2017 16:06
Cc: Nexus Users (nexus...@glists.sonatype.com)
Subject: Re: Nexus 3 regular cleanup on NPM repository
On Thu, Sep 14, 2017 at 10:30 AM, Mariska Hoogenboom <M.Hoog...@nl.ccv.eu> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/dca54aed-7cad-47a8-887d-479971b82eab%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/1CBB0AB25CBB3645938B01960A52A58A7E4ACE35%40ccv-arn-exmb02.ccveu.local.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to
nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/CAC16qPgYzP1NOq8PGDhkwp3h%3DkPHHAcuUrnBCoFhWwashwhevw%40mail.gmail.com.
For more options, visit
https://groups.google.com/a/glists.sonatype.com/d/optout.