Created
February 7, 2019 17:47
-
-
Save nblair/64e1e33b2b4bde0700c36fe73b264d3e to your computer and use it in GitHub Desktop.
Create a Google Cloud Blobstore with the Nexus Repository Manager Script API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.sonatype.nexus.blobstore.api.BlobStoreConfiguration | |
import org.sonatype.nexus.blobstore.api.BlobStoreManager | |
def blobStoreManager = container.lookup(BlobStoreManager.class.name) | |
blobStoreManager.create(new BlobStoreConfiguration(name: 'default', type: 'Google Cloud Storage', | |
attributes: [ | |
'google cloud storage': [ | |
bucket: "bucket-name-goes-here" // if you use an interpolated Groovy String here, make sure you call toString() | |
] | |
])) |
This script only works up to and including Nexus Repository Manager 3.19.
In 3.20 and beyond, take a look at the changes needed here:
https://gist.github.com/nblair/85b34948de59e5a5f458fb81fb014d00
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`import groovy.json.JsonSlurper
import org.sonatype.nexus.blobstore.api.BlobStoreConfiguration
import org.sonatype.nexus.blobstore.api.BlobStoreManager
parsed_args = new JsonSlurper().parseText(args)
existingBlobStore = blobStore.getBlobStoreManager().get(parsed_args.name)
if (existingBlobStore == null) {
}
`