use the nexus api to create the apt-hosted apt repository

This commit is contained in:
Rui Lopes 2024-12-09 08:40:17 +00:00
parent 07553f6c30
commit 43584e1089
No known key found for this signature in database
3 changed files with 29 additions and 5 deletions

View File

@ -4,6 +4,7 @@ This will:
* Configure Nexus through the API.
* Create the `adhoc-package` repository.
* Create the `apt-hosted` repository.
* Configure the NuGet `nuget-hosted` repository to accept pushing with an API key.
* Configure Nexus through Groovy scripts.
* Create the `npm-group`, `npm-hosted` and `npmjs.org-proxy` repositories.

View File

@ -191,6 +191,34 @@ http \
EOF
# create the apt-hosted apt repository.
# see https://help.sonatype.com/repomanager3/formats/apt-repositories
http \
--check-status \
--auth "$api_auth" \
POST \
https://$nexus_domain/service/rest/v1/repositories/apt/hosted \
<<EOF
{
"name": "apt-hosted",
"online": true,
"storage": {
"blobStoreName": "default",
"strictContentTypeValidation": true,
"writePolicy": "allow_once"
},
"component": {
"proprietaryComponents": true
},
"apt": {
"distribution": "jammy"
},
"aptSigning": {
"keypair": $(cat /vagrant/shared/apt-hosted-private.key | jq --slurp --raw-input .),
"passphrase": "abracadabra"
}
}
EOF
# create the pypi-hosted repository.
http \
--check-status \

View File

@ -25,11 +25,6 @@ capabilityRegistry.all.findAll {it.context().type().toString().startsWith("Outre
// ]}
//])
// create a apt repository backed by the default blob store.
// see https://help.sonatype.com/repomanager3/formats/apt-repositories
pgpPrivateKey = new File('/vagrant/shared/apt-hosted-private.key').getText('UTF-8')
repository.createAptHosted("apt-hosted", "jammy", pgpPrivateKey, "abracadabra", "default", WritePolicy.ALLOW_ONCE, true)
// create a npm repository backed by the default blob store.
repository.createNpmHosted("npm-hosted", "default", true, WritePolicy.ALLOW_ONCE)