use the nexus api to create the npm repositories
This commit is contained in:
parent
43584e1089
commit
9c10197712
|
|
@ -5,9 +5,9 @@ This will:
|
||||||
* Configure Nexus through the API.
|
* Configure Nexus through the API.
|
||||||
* Create the `adhoc-package` repository.
|
* Create the `adhoc-package` repository.
|
||||||
* Create the `apt-hosted` repository.
|
* Create the `apt-hosted` repository.
|
||||||
|
* Create the `npm-group`, `npm-hosted` and `npmjs.org-proxy` repositories.
|
||||||
* Configure the NuGet `nuget-hosted` repository to accept pushing with an API key.
|
* Configure the NuGet `nuget-hosted` repository to accept pushing with an API key.
|
||||||
* Configure Nexus through Groovy scripts.
|
* Configure Nexus through Groovy scripts.
|
||||||
* Create the `npm-group`, `npm-hosted` and `npmjs.org-proxy` repositories.
|
|
||||||
* Create the `chocolatey-group`, `chocolatey-hosted` and `chocolatey.org-proxy` repositories.
|
* Create the `chocolatey-group`, `chocolatey-hosted` and `chocolatey.org-proxy` repositories.
|
||||||
* Create the `powershell-group`, `powershell-hosted` and `powershellgallery.com-proxy` repositories.
|
* Create the `powershell-group`, `powershell-hosted` and `powershellgallery.com-proxy` repositories.
|
||||||
* Schedule a task to remove the old snapshots from the `maven-snapshots` repository.
|
* Schedule a task to remove the old snapshots from the `maven-snapshots` repository.
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,89 @@ http \
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
# create the npm-hosted npm repository.
|
||||||
|
# see https://help.sonatype.com/display/NXRM3/Node+Packaged+Modules+and+npm+Registries
|
||||||
|
http \
|
||||||
|
--check-status \
|
||||||
|
--auth "$api_auth" \
|
||||||
|
POST \
|
||||||
|
https://$nexus_domain/service/rest/v1/repositories/npm/hosted \
|
||||||
|
<<'EOF'
|
||||||
|
{
|
||||||
|
"name": "npm-hosted",
|
||||||
|
"online": true,
|
||||||
|
"storage": {
|
||||||
|
"blobStoreName": "default",
|
||||||
|
"strictContentTypeValidation": true,
|
||||||
|
"writePolicy": "allow_once"
|
||||||
|
},
|
||||||
|
"component": {
|
||||||
|
"proprietaryComponents": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
# create the npmjs.org-proxy npm proxy repository.
|
||||||
|
# see https://help.sonatype.com/display/NXRM3/Node+Packaged+Modules+and+npm+Registries
|
||||||
|
http \
|
||||||
|
--check-status \
|
||||||
|
--auth "$api_auth" \
|
||||||
|
POST \
|
||||||
|
https://$nexus_domain/service/rest/v1/repositories/npm/proxy \
|
||||||
|
<<'EOF'
|
||||||
|
{
|
||||||
|
"name": "npmjs.org-proxy",
|
||||||
|
"online": true,
|
||||||
|
"storage": {
|
||||||
|
"blobStoreName": "default",
|
||||||
|
"strictContentTypeValidation": true,
|
||||||
|
"writePolicy": "allow_once"
|
||||||
|
},
|
||||||
|
"proxy": {
|
||||||
|
"remoteUrl": "https://registry.npmjs.org",
|
||||||
|
"contentMaxAge": 1440,
|
||||||
|
"metadataMaxAge": 1440
|
||||||
|
},
|
||||||
|
"negativeCache": {
|
||||||
|
"enabled": true,
|
||||||
|
"timeToLive": 1440
|
||||||
|
},
|
||||||
|
"httpClient": {
|
||||||
|
"blocked": false,
|
||||||
|
"autoBlock": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
# create the npm-group npm group repository.
|
||||||
|
# see https://help.sonatype.com/display/NXRM3/Node+Packaged+Modules+and+npm+Registries
|
||||||
|
http \
|
||||||
|
--check-status \
|
||||||
|
--auth "$api_auth" \
|
||||||
|
POST \
|
||||||
|
https://$nexus_domain/service/rest/v1/repositories/npm/group \
|
||||||
|
<<'EOF'
|
||||||
|
{
|
||||||
|
"name": "npm-group",
|
||||||
|
"online": true,
|
||||||
|
"storage": {
|
||||||
|
"blobStoreName": "default",
|
||||||
|
"strictContentTypeValidation": true
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"memberNames": [
|
||||||
|
"npm-hosted",
|
||||||
|
"npmjs.org-proxy"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# create the pypi-hosted repository.
|
# create the pypi-hosted repository.
|
||||||
http \
|
http \
|
||||||
--check-status \
|
--check-status \
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,6 @@ capabilityRegistry.all.findAll {it.context().type().toString().startsWith("Outre
|
||||||
//])
|
//])
|
||||||
|
|
||||||
|
|
||||||
// create a npm repository backed by the default blob store.
|
|
||||||
repository.createNpmHosted("npm-hosted", "default", true, WritePolicy.ALLOW_ONCE)
|
|
||||||
// create a npm proxy repository backed by the default blob store.
|
|
||||||
// see https://help.sonatype.com/display/NXRM3/Node+Packaged+Modules+and+npm+Registries
|
|
||||||
repository.createNpmProxy("npmjs.org-proxy", "https://registry.npmjs.org", "default")
|
|
||||||
// create a npm group repository that merges the npm-host and npmjs.org-proxy together.
|
|
||||||
repository.createNpmGroup("npm-group", ["npm-hosted", "npmjs.org-proxy"], "default")
|
|
||||||
|
|
||||||
|
|
||||||
// modify the default nuget-hosted repository for not allowing re-deployments.
|
// modify the default nuget-hosted repository for not allowing re-deployments.
|
||||||
config = repository.repositoryManager.get("nuget-hosted").configuration.copy()
|
config = repository.repositoryManager.get("nuget-hosted").configuration.copy()
|
||||||
config.attributes.storage.writePolicy = WritePolicy.ALLOW_ONCE
|
config.attributes.storage.writePolicy = WritePolicy.ALLOW_ONCE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue